diff options
author | Petko Georgiev <unknown> | 2021-04-20 14:50:28 +1000 |
---|---|---|
committer | Petko Georgiev <unknown> | 2021-04-20 14:50:28 +1000 |
commit | 37a05f796d8bb636873e411f24f94d8f37f4c51e (patch) | |
tree | 44005bb0932db639c84b457acd51a996133a3c39 | |
parent | 295b9b2bc3b97aaea7099d5fbfcb36b907619f30 (diff) | |
download | scintilla-mirror-37a05f796d8bb636873e411f24f94d8f37f4c51e.tar.gz |
Bug [#2248]. Make autocompletion look the same on macOS 11 as macOS 10
by using NSTableViewStylePlain. This prevents truncation of the text of items
as well as avoiding problems with size and padding.
-rw-r--r-- | cocoa/PlatCocoa.mm | 21 | ||||
-rw-r--r-- | doc/ScintillaHistory.html | 5 |
2 files changed, 17 insertions, 9 deletions
diff --git a/cocoa/PlatCocoa.mm b/cocoa/PlatCocoa.mm index 7f26f4bb0..50e42f38e 100644 --- a/cocoa/PlatCocoa.mm +++ b/cocoa/PlatCocoa.mm @@ -1986,6 +1986,11 @@ void ListBoxImpl::Create(Window & /*parent*/, int /*ctrlID*/, Scintilla::Point p table.target = ds; table.doubleAction = @selector(doubleClick:); table.selectionHighlightStyle = NSTableViewSelectionHighlightStyleSourceList; + + if (@available(macOS 11.0, *)) { + [table setStyle: NSTableViewStylePlain]; + } + wid = (__bridge_retained WindowID)winLB; } @@ -2016,8 +2021,13 @@ PRectangle ListBoxImpl::GetDesiredRect() { PRectangle rcDesired; rcDesired = GetPosition(); - // There appears to be an extra pixel above and below the row contents - CGFloat itemHeight = table.rowHeight + 2; + CGFloat itemHeight; + if (@available(macOS 11.0, *)) { + itemHeight = table.rowHeight; + } else { + // There appears to be an extra pixel above and below the row contents + itemHeight = table.rowHeight + 2; + } int rows = Length(); if ((rows == 0) || (rows > desiredVisibleRows)) @@ -2027,13 +2037,6 @@ PRectangle ListBoxImpl::GetDesiredRect() { rcDesired.right = rcDesired.left + maxItemWidth + aveCharWidth; rcDesired.right += 4; // Ensures no truncation of text - if (@available(macOS 11, *)) { - // macOS 11 requires some extra space possibly due to the rounded highlight. - // There may be a better way to discover how much space is required - // but an extra 22 pixels fixes it for almost all tested cases. - rcDesired.right += 22; - } - if (Length() > rows) { [scroller setHasVerticalScroller: YES]; rcDesired.right += [NSScroller scrollerWidthForControlSize: NSControlSizeRegular diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index 5ced2dd86..b01c7f2ae 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -579,6 +579,11 @@ Released 9 April 2021. </li> <li> + On Cocoa with macOS 11, use plain style for autocompletion to fix problems with truncating text + and padding. This makes autocompletion look the same on macOS 11 as macOS 10. + <a href="https://sourceforge.net/p/scintilla/bugs/2248/">Bug #2248</a>. + </li> + <li> On Windows, fix encoding used for text display with DirectWrite. <a href="https://sourceforge.net/p/scintilla/bugs/2246/">Bug #2246</a>. </li> |