aboutsummaryrefslogtreecommitdiffhomepage
path: root/cocoa/PlatCocoa.mm
diff options
context:
space:
mode:
authorPetko Georgiev <unknown>2021-04-20 14:50:28 +1000
committerPetko Georgiev <unknown>2021-04-20 14:50:28 +1000
commit37a05f796d8bb636873e411f24f94d8f37f4c51e (patch)
tree44005bb0932db639c84b457acd51a996133a3c39 /cocoa/PlatCocoa.mm
parent295b9b2bc3b97aaea7099d5fbfcb36b907619f30 (diff)
downloadscintilla-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.
Diffstat (limited to 'cocoa/PlatCocoa.mm')
-rw-r--r--cocoa/PlatCocoa.mm21
1 files changed, 12 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