From afef7b27d25b91bb3e446446b91519bcc3770876 Mon Sep 17 00:00:00 2001 From: Neil Hodgson Date: Sun, 7 Feb 2021 10:19:03 +1100 Subject: On macOS 11, autocompletion list text was being truncated. An extra 22 pixels was added to the width just on macOS 11. Its likely that there is a better way to discover the additional width needed. --- cocoa/PlatCocoa.mm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cocoa/PlatCocoa.mm b/cocoa/PlatCocoa.mm index da30ac4f4..f30bc93e4 100644 --- a/cocoa/PlatCocoa.mm +++ b/cocoa/PlatCocoa.mm @@ -1782,6 +1782,13 @@ 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 22 pixels fixes it for almost all tested cases. + rcDesired.right += 22; + } + if (Length() > rows) { [scroller setHasVerticalScroller: YES]; rcDesired.right += [NSScroller scrollerWidthForControlSize: NSControlSizeRegular -- cgit v1.2.3 From f5af58162f689c4159cb245d0aea9244aa972009 Mon Sep 17 00:00:00 2001 From: Neil Hodgson Date: Sun, 7 Feb 2021 10:26:33 +1100 Subject: Made comment make sense. --- cocoa/PlatCocoa.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocoa/PlatCocoa.mm b/cocoa/PlatCocoa.mm index f30bc93e4..5eb5bf018 100644 --- a/cocoa/PlatCocoa.mm +++ b/cocoa/PlatCocoa.mm @@ -1785,7 +1785,7 @@ PRectangle ListBoxImpl::GetDesiredRect() { 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 22 pixels fixes it for almost all tested cases. + // but an extra 22 pixels fixes it for almost all tested cases. rcDesired.right += 22; } -- cgit v1.2.3