Skip to content

Commit

Permalink
Update Scintilla 2020-08-12 8479:dcab8335677e.
Browse files Browse the repository at this point in the history
Changes: fixed bug in hover indicator.
  • Loading branch information
zufuliu committed Aug 16, 2020
1 parent 8c8f879 commit 224553a
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 20 deletions.
6 changes: 6 additions & 0 deletions scintilla/src/Editor.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -4526,6 +4526,7 @@ void Editor::DwellEnd(bool mouseMoved) {

void Editor::MouseLeave() {
SetHotSpotRange(nullptr);
SetHoverIndicatorPosition(Sci::invalidPosition);
if (!HaveMouseCapture()) {
ptMouseLast = Point(-1, -1);
DwellEnd(true);
Expand Down Expand Up @@ -4895,12 +4896,14 @@ void Editor::ButtonMoveWithModifiers(Point pt, unsigned int, int modifiers) {
if (PointInSelMargin(pt)) {
DisplayCursor(GetMarginCursor(pt));
SetHotSpotRange(nullptr);
SetHoverIndicatorPosition(Sci::invalidPosition);
return; // No need to test for selection
}
}
// Display regular (drag) cursor over selection
if (PointInSelection(pt) && !SelectionEmpty()) {
DisplayCursor(Window::Cursor::arrow);
SetHoverIndicatorPosition(Sci::invalidPosition);
} else {
SetHoverIndicatorPoint(pt);
if (PointIsHotspot(pt)) {
Expand Down Expand Up @@ -5794,6 +5797,9 @@ sptr_t Editor::StyleGetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lPar
}

void Editor::SetSelectionNMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam) noexcept {
if (wParam >= sel.Count()) {
return;
}
InvalidateRange(sel.Range(wParam).Start().Position(), sel.Range(wParam).End().Position());

switch (iMessage) {
Expand Down
6 changes: 3 additions & 3 deletions scintilla/src/Indicator.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void Indicator::Draw(Surface *surface, PRectangle rc, PRectangle rcLine, PRectan
alphaFull = 0xff, alphaSide = 0x2f, alphaSide2 = 0x5f
};
for (int x = 0; x < width; x++) {
if (x % 2) {
if (x & 1) {
// Two halfway columns have a full pixel in middle flanked by light pixels
image.SetPixel(x, 0, sacDraw.fore, alphaSide);
image.SetPixel(x, 1, sacDraw.fore, alphaFull);
Expand Down Expand Up @@ -175,8 +175,8 @@ void Indicator::Draw(Surface *surface, PRectangle rc, PRectangle rcLine, PRectan
rcBox.top = rcLine.top + 1;
rcBox.bottom = rcLine.bottom;
const Surface::GradientOptions options = Surface::GradientOptions::topToBottom;
const ColourAlpha start(sacNormal.fore, fillAlpha);
const ColourAlpha end(sacNormal.fore, 0);
const ColourAlpha start(sacDraw.fore, fillAlpha);
const ColourAlpha end(sacDraw.fore, 0);
std::vector<ColourStop> stops;
switch (sacDraw.style) {
case INDIC_GRADIENT:
Expand Down
1 change: 0 additions & 1 deletion scintilla/src/RESearch.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,6 @@ int RESearch::Execute(const CharacterIndexer &ci, Sci::Position lp, Sci::Positio
if (lp >= endp) /* if EOS, fail, else fall through. */
return 0;
[[fallthrough]];
// fall through
default: /* regular matching all the way. */
while (lp < endp) {
Sci::Position offset = 1;
Expand Down
2 changes: 1 addition & 1 deletion scintilla/src/SparseVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class SparseVector {
}

Sci::Position Length() const noexcept {
return starts->PositionFromPartition(starts->Partitions());
return starts->Length();
}

Sci::Position Elements() const noexcept {
Expand Down
3 changes: 1 addition & 2 deletions scintilla/win32/PlatWin.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1493,7 +1493,6 @@ void SurfaceD2D::Polygon(const Point *pts, size_t npts, ColourDesired fore, Colo
D2DPenColour(fore);
pRenderTarget->DrawGeometry(geometry, pBrush);
}

ReleaseUnknown(geometry);
}
}
Expand Down Expand Up @@ -1632,7 +1631,7 @@ void SurfaceD2D::GradientRectangle(PRectangle rc, const std::vector<ColourStop>
pRenderTarget->FillRectangle(&rectangle, pBrushLinear);
ReleaseUnknown(pBrushLinear);
}
ReleaseUnknown(pBrushLinear);
ReleaseUnknown(pGradientStops);
}
}

Expand Down
27 changes: 16 additions & 11 deletions scintilla/win32/ScintillaWin.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ class ScintillaWin :
void ChangeScrollPos(int barType, Sci::Position pos);
sptr_t GetTextLength() const noexcept;
sptr_t GetText(uptr_t wParam, sptr_t lParam) const;
Window::Cursor ContextCursor();
Window::Cursor SCICALL ContextCursor(Point pt);
#if SCI_EnablePopupMenu
sptr_t ShowContextMenu(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
#endif
Expand Down Expand Up @@ -1550,19 +1550,20 @@ sptr_t ScintillaWin::GetText(uptr_t wParam, sptr_t lParam) const {
}
}

Window::Cursor ScintillaWin::ContextCursor() {
Window::Cursor ScintillaWin::ContextCursor(Point pt) {
if (inDragDrop == ddDragging) {
return Window::Cursor::up;
} else {
// Display regular (drag) cursor over selection
POINT pt;
if (0 != ::GetCursorPos(&pt)) {
::ScreenToClient(MainHWND(), &pt);
if (PointInSelMargin(PointFromPOINT(pt))) {
return GetMarginCursor(PointFromPOINT(pt));
} else if (PointInSelection(PointFromPOINT(pt)) && !SelectionEmpty()) {
return Window::Cursor::arrow;
} else if (PointIsHotspot(PointFromPOINT(pt))) {
if (PointInSelMargin(pt)) {
return GetMarginCursor(pt);
} else if (!SelectionEmpty() && PointInSelection(pt)) {
return Window::Cursor::arrow;
} else if (PointIsHotspot(pt)) {
return Window::Cursor::hand;
} else if (hoverIndicatorPos != Sci::invalidPosition) {
const Sci::Position pos = PositionFromLocation(pt, true, true);
if (pos != Sci::invalidPosition) {
return Window::Cursor::hand;
}
}
Expand Down Expand Up @@ -2190,7 +2191,11 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam

case WM_SETCURSOR:
if (LOWORD(lParam) == HTCLIENT) {
DisplayCursor(ContextCursor());
POINT pt;
if (::GetCursorPos(&pt)) {
::ScreenToClient(MainHWND(), &pt);
DisplayCursor(ContextCursor(PointFromPOINT(pt)));
}
return TRUE;
}
return ::DefWindowProc(MainHWND(), iMessage, wParam, lParam);
Expand Down
4 changes: 2 additions & 2 deletions version.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ git clone https://github.com/XhmikosR/notepad2-mod.git
Scintilla (upstream)
hg clone http://hg.code.sf.net/p/scintilla/code scintilla
4.4.4
2020-07-30 8464:5d134721c303
2020-08-12 8479:dcab8335677e

SciTE (upstream)
hg clone http://hg.code.sf.net/p/scintilla/scite
4.4.4
2020-07-30 5503:6b23fe205543
2020-08-12 5509:994299e3975a

Notepad3 (3-clause BSD)
https://github.com/rizonesoft/Notepad3
Expand Down

0 comments on commit 224553a

Please sign in to comment.