diff --git a/src/platform/guimac.mm b/src/platform/guimac.mm index ad4871a4..33901ff6 100644 --- a/src/platform/guimac.mm +++ b/src/platform/guimac.mm @@ -952,9 +952,10 @@ public: } void SetScrollbarPosition(double pos) override { - if(pos > ssView.scrollerMax) { + if(pos > ssView.scrollerMax) pos = ssView.scrollerMax; - } + if(GetScrollbarPosition() == pos) + return; [nsScroller setDoubleValue:(pos / (ssView.scrollerMax - ssView.scrollerMin))]; if(onScrollbarAdjusted) { onScrollbarAdjusted(pos); diff --git a/src/platform/guiwin.cpp b/src/platform/guiwin.cpp index b2ae8105..bd1b42e7 100644 --- a/src/platform/guiwin.cpp +++ b/src/platform/guiwin.cpp @@ -1354,7 +1354,11 @@ public: SCROLLINFO si = {}; si.cbSize = sizeof(si); si.fMask = SIF_POS; - si.nPos = (UINT)(pos * SCROLLBAR_UNIT); + sscheck(GetScrollInfo(hWindow, SB_VERT, &si)); + if(si.nPos == (int)(pos * SCROLLBAR_UNIT)) + return; + + si.nPos = (int)(pos * SCROLLBAR_UNIT); sscheck(SetScrollInfo(hWindow, SB_VERT, &si, /*redraw=*/TRUE)); // Windows won't synthesize a WM_VSCROLL for us here. diff --git a/src/textwin.cpp b/src/textwin.cpp index 11d30484..131e12e9 100644 --- a/src/textwin.cpp +++ b/src/textwin.cpp @@ -1129,8 +1129,10 @@ void TextWindow::MouseLeave() { } void TextWindow::ScrollbarEvent(double newPos) { - if(window->IsEditorVisible()) + if(window->IsEditorVisible()) { + window->SetScrollbarPosition(scrollPos); return; + } int bottom = top[rows-1] + 2; newPos = min((int)newPos, bottom - halfRows);