From aa1c720306c0cf24dc40c90bf1b21c4f53c2ddfa Mon Sep 17 00:00:00 2001 From: Yee Cheng Chin Date: Sat, 10 Sep 2022 21:52:04 -0700 Subject: [PATCH] Allows smooth resizing of MacVim's window Adds a setting that allows for smoothly resizing the window. Previously, MacVim would only allow resizing in fixed increment of the grid size and snap to such sizes. This was a little more consistent with how terminals tend to work, and allows for optimal window sizing, and it was also an artifact of the old MacVim renderer where it didn't have a stateful renderer that could repaint the text view. The snapping could be jarring for users more used to modern text editors which allow for smoothly resizing of the window though, and it makes third party tools that could snap macOS windows to the side not work properly as there's usually a gap near the bottom. With guioption-k, MacVim already allows for decoupling the window size from the Vim's grid size anyway, so adding smooth resizing allows to work much better under those assumptions. In addition to allowing smooth resizing, this change also makes it so that the CoreText renderer will fill to the right a little bit when rendering the rightmost column when MacVim's window size isn't exactly the Vim grid size. Previously, if a color scheme has NonText color (e.g. desert), or the user has 'cursorline' set, smooth resize (or in full screen or guioption-k) would leave a gap to the right, looking a little ugly. This allows the last column's to fully fill to the right, resulting in a much more consistent look when resizing the window. Close #948 --- runtime/doc/gui_mac.txt | 1 + runtime/doc/tags | 1 + src/MacVim/Base.lproj/Preferences.xib | 48 ++++++++++++++++++++------ src/MacVim/MMAppController.h | 1 + src/MacVim/MMAppController.m | 10 ++++++ src/MacVim/MMCoreTextView.m | 38 ++++++++++++++++++++- src/MacVim/MMPreferenceController.h | 7 ++++ src/MacVim/MMPreferenceController.m | 5 +++ src/MacVim/MMWindowController.h | 1 + src/MacVim/MMWindowController.m | 49 +++++++++++++++++---------- src/MacVim/Miscellaneous.h | 1 + src/MacVim/Miscellaneous.m | 1 + 12 files changed, 135 insertions(+), 28 deletions(-) diff --git a/runtime/doc/gui_mac.txt b/runtime/doc/gui_mac.txt index 9151d0f414..5404cd3267 100644 --- a/runtime/doc/gui_mac.txt +++ b/runtime/doc/gui_mac.txt @@ -273,6 +273,7 @@ KEY VALUE ~ *MMNoTitleBarWindow* hide title bar [bool] *MMTitlebarAppearsTransparent* enable a transparent titlebar [bool] *MMAppearanceModeSelection* dark mode selection (|macvim-dark-mode|)[bool] +*MMSmoothResize* allow smooth resizing of MacVim window [bool] *MMShareFindPboard* share search text to Find Pasteboard [bool] *MMShowAddTabButton* enable "add tab" button on tabline [bool] *MMTabMaxWidth* maximum width of a tab [int] diff --git a/runtime/doc/tags b/runtime/doc/tags index b814dc448b..1e44be0000 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -5418,6 +5418,7 @@ MMNonNativeFullScreenSafeAreaBehavior gui_mac.txt /*MMNonNativeFullScreenSafeAre MMNonNativeFullScreenShowMenu gui_mac.txt /*MMNonNativeFullScreenShowMenu* MMShareFindPboard gui_mac.txt /*MMShareFindPboard* MMShowAddTabButton gui_mac.txt /*MMShowAddTabButton* +MMSmoothResize gui_mac.txt /*MMSmoothResize* MMTabMaxWidth gui_mac.txt /*MMTabMaxWidth* MMTabMinWidth gui_mac.txt /*MMTabMinWidth* MMTabOptimumWidth gui_mac.txt /*MMTabOptimumWidth* diff --git a/src/MacVim/Base.lproj/Preferences.xib b/src/MacVim/Base.lproj/Preferences.xib index 84216c9283..3fa5badc61 100644 --- a/src/MacVim/Base.lproj/Preferences.xib +++ b/src/MacVim/Base.lproj/Preferences.xib @@ -20,12 +20,12 @@ - + - - + + @@ -70,8 +70,8 @@ - - + + @@ -149,8 +149,8 @@ - - + + @@ -182,9 +182,37 @@ + + + + + + + + + + + + + + + + - - + +