diff options
author | Neil Hodgson <nyamatongwe@gmail.com> | 2017-09-18 12:24:00 +1000 |
---|---|---|
committer | Neil Hodgson <nyamatongwe@gmail.com> | 2017-09-18 12:24:00 +1000 |
commit | b7fc7c238595d50bab92a0160ebd8c45b8486977 (patch) | |
tree | c43e3a178d3fe0bfaeb2c25cea4ffabad69c3c64 | |
parent | b119ea4f496f4ac92afd26c8cf5408572ab34873 (diff) | |
download | scintilla-mirror-b7fc7c238595d50bab92a0160ebd8c45b8486977.tar.gz |
Backport: Bug [#1885]. Improve scrolling on macOS 10.12.
Backport of changeset 6393:711d6bbf62b6.
-rw-r--r-- | cocoa/ScintillaView.mm | 23 | ||||
-rw-r--r-- | doc/ScintillaHistory.html | 4 |
2 files changed, 19 insertions, 8 deletions
diff --git a/cocoa/ScintillaView.mm b/cocoa/ScintillaView.mm index f7c9dcf1b..96d212138 100644 --- a/cocoa/ScintillaView.mm +++ b/cocoa/ScintillaView.mm @@ -777,21 +777,21 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) //-------------------------------------------------------------------------------------------------- /** - * Mouse wheel with command key magnifies text. - * Enabling this code causes visual garbage to appear when scrolling - * horizontally on OS X 10.9 with a retina display. - * Pinch gestures and key commands can be used for magnification. + * Implementing scrollWheel makes scrolling work better even if just + * calling super. + * Mouse wheel with command key may magnify text if enabled. + * Pinch gestures and key commands can also be used for magnification. */ -#ifdef SCROLL_WHEEL_MAGNIFICATION - (void) scrollWheel: (NSEvent *) theEvent { +#ifdef SCROLL_WHEEL_MAGNIFICATION if (([theEvent modifierFlags] & NSCommandKeyMask) != 0) { mOwner.backend->MouseWheel(theEvent); - } else { - [super scrollWheel:theEvent]; + return; } -} #endif + [super scrollWheel:theEvent]; +} //-------------------------------------------------------------------------------------------------- @@ -811,6 +811,13 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) long lineHeight = mOwner.backend->WndProc(SCI_TEXTHEIGHT, 0, 0); rc.origin.y = roundf(static_cast<XYPOSITION>(rc.origin.y) / lineHeight) * lineHeight; } + // Snap to whole points - on retina displays this avoids visual debris + // when scrolling horizontally. + if ((rc.origin.x > 0) && (NSMaxX(rc) < contentRect.size.width)) { + // Only snap for positions inside the document - allow outside + // for overshoot. + rc.origin.x = roundf(static_cast<XYPOSITION>(rc.origin.x)); + } return rc; } diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index f4a061a93..45d0e3255 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -592,6 +592,10 @@ <a href="http://sourceforge.net/p/scintilla/bugs/1919/">Bug #1919</a>. </li> <li> + On Cocoa, improve scrolling on macOS 10.12. + <a href="http://sourceforge.net/p/scintilla/bugs/1885">Bug #1885</a>. + </li> + <li> On Cocoa, fix line selection by clicking in the margin when scrolled. <a href="http://sourceforge.net/p/scintilla/bugs/1971">Bug #1971</a>. </li> |