macvim-dev / macvim

Vim - the text editor - for macOS
https://macvim.org
Vim License
7.47k stars 680 forks source link

Fix macOS 14 Sonoma non-native full screen background color #1448

Closed ychin closed 8 months ago

ychin commented 8 months ago

Non-native full screen's configured background color (default to black) stopped working when building using macOS 14 SDK, because the main CoreText view was now drawing over it in drawRect, due to the new clipToBounds property defaulting to false in macOS 14 SDK.

We could just fix this issue by setting clipToBounds to true on the text view, but we would lose the benefits of the new behavior which allows us to show tall texts (e.g. Tibetan texts or other characters with composing chars) on the first line and not have it be clipped at the top. Currently with the unclipped behavior, the character can be drawn and poke up into the window frame or the notch area.

To properly fix this, just clip the background color fill in drawRect, and allow texts etc to still draw outside the rect.

ychin commented 8 months ago

The new macOS 14 behavior (not clipping views by default) actually allows tall texts on the first line to not be clipped now, as they are allowed to be drawn further above. This works both in regular windowed mode and non-native full screen. Sadly, for native full screen the text will still be clipped because macOS doesn't really allow you to use the notch area in native full screen.

Windowed:

windowed no clip

Non-native full screen (only when not showing menu bar). The black part is the notch area (the black color can be configured by set fuopt=background:...:

non-native full screen no clipping