diff options
-rw-r--r-- | src/nvim/option.c | 2 | ||||
-rw-r--r-- | src/nvim/window.c | 2 | ||||
-rw-r--r-- | test/functional/ui/statusline_spec.lua | 101 |
3 files changed, 103 insertions, 2 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c index c6a9d6b7db..208112561a 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -2469,7 +2469,7 @@ static char *set_num_option(int opt_idx, char_u *varp, long value, char *errbuf, // Only compute the new window layout when startup has been // completed. Otherwise the frame sizes may be wrong. if ((p_ch != old_value - || tabline_height() + topframe->fr_height != Rows - p_ch) + || tabline_height() + global_stl_height() + topframe->fr_height != Rows - p_ch) && full_screen) { command_height(); } diff --git a/src/nvim/window.c b/src/nvim/window.c index 5993df64cd..b505350892 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -6409,7 +6409,7 @@ void command_height(void) curtab->tp_ch_used = p_ch; // Update cmdline_row to what it should be: just below the last window. - cmdline_row = topframe->fr_height + tabline_height(); + cmdline_row = topframe->fr_height + tabline_height() + global_stl_height(); // If cmdline_row is smaller than what it is supposed to be for 'cmdheight' // then set old_p_ch to what it would be, so that the windows get resized diff --git a/test/functional/ui/statusline_spec.lua b/test/functional/ui/statusline_spec.lua index add5144e1b..18391a575d 100644 --- a/test/functional/ui/statusline_spec.lua +++ b/test/functional/ui/statusline_spec.lua @@ -178,6 +178,7 @@ describe('global statusline', function() [2] = {bold = true, reverse = true}; [3] = {bold = true}; [4] = {reverse = true}; + [5] = {bold = true, foreground = Screen.colors.Fuchsia}; }) command('set laststatus=3') command('set ruler') @@ -398,6 +399,106 @@ describe('global statusline', function() meths.input_mouse('left', 'drag', '', 0, 14, 10) eq(1, meths.get_option('cmdheight')) end) + + it('cmdline row is correct after setting cmdheight #20514', function() + command('botright split test/functional/fixtures/bigfile.txt') + meths.set_option('cmdheight', 1) + feed('L') + screen:expect([[ + | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + ────────────────────────────────────────────────────────────| + 0000;<control>;Cc;0;BN;;;;;N;NULL;;;; | + 0001;<control>;Cc;0;BN;;;;;N;START OF HEADING;;;; | + 0002;<control>;Cc;0;BN;;;;;N;START OF TEXT;;;; | + 0003;<control>;Cc;0;BN;;;;;N;END OF TEXT;;;; | + 0004;<control>;Cc;0;BN;;;;;N;END OF TRANSMISSION;;;; | + 0005;<control>;Cc;0;BN;;;;;N;ENQUIRY;;;; | + ^0006;<control>;Cc;0;BN;;;;;N;ACKNOWLEDGE;;;; | + {2:test/functional/fixtures/bigfile.txt 7,1 Top}| + | + ]]) + feed('j') + screen:expect([[ + | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + ────────────────────────────────────────────────────────────| + 0001;<control>;Cc;0;BN;;;;;N;START OF HEADING;;;; | + 0002;<control>;Cc;0;BN;;;;;N;START OF TEXT;;;; | + 0003;<control>;Cc;0;BN;;;;;N;END OF TEXT;;;; | + 0004;<control>;Cc;0;BN;;;;;N;END OF TRANSMISSION;;;; | + 0005;<control>;Cc;0;BN;;;;;N;ENQUIRY;;;; | + 0006;<control>;Cc;0;BN;;;;;N;ACKNOWLEDGE;;;; | + ^0007;<control>;Cc;0;BN;;;;;N;BELL;;;; | + {2:test/functional/fixtures/bigfile.txt 8,1 0%}| + | + ]]) + meths.set_option('showtabline', 2) + screen:expect([[ + {3: }{5:2}{3: t/f/f/bigfile.txt }{4: }| + | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + ────────────────────────────────────────────────────────────| + 0002;<control>;Cc;0;BN;;;;;N;START OF TEXT;;;; | + 0003;<control>;Cc;0;BN;;;;;N;END OF TEXT;;;; | + 0004;<control>;Cc;0;BN;;;;;N;END OF TRANSMISSION;;;; | + 0005;<control>;Cc;0;BN;;;;;N;ENQUIRY;;;; | + 0006;<control>;Cc;0;BN;;;;;N;ACKNOWLEDGE;;;; | + ^0007;<control>;Cc;0;BN;;;;;N;BELL;;;; | + {2:test/functional/fixtures/bigfile.txt 8,1 0%}| + | + ]]) + meths.set_option('cmdheight', 0) + screen:expect([[ + {3: }{5:2}{3: t/f/f/bigfile.txt }{4: }| + | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + ────────────────────────────────────────────────────────────| + 0001;<control>;Cc;0;BN;;;;;N;START OF HEADING;;;; | + 0002;<control>;Cc;0;BN;;;;;N;START OF TEXT;;;; | + 0003;<control>;Cc;0;BN;;;;;N;END OF TEXT;;;; | + 0004;<control>;Cc;0;BN;;;;;N;END OF TRANSMISSION;;;; | + 0005;<control>;Cc;0;BN;;;;;N;ENQUIRY;;;; | + 0006;<control>;Cc;0;BN;;;;;N;ACKNOWLEDGE;;;; | + ^0007;<control>;Cc;0;BN;;;;;N;BELL;;;; | + {2:test/functional/fixtures/bigfile.txt 8,1 0%}| + ]]) + meths.set_option('cmdheight', 1) + screen:expect([[ + {3: }{5:2}{3: t/f/f/bigfile.txt }{4: }| + | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + ────────────────────────────────────────────────────────────| + 0002;<control>;Cc;0;BN;;;;;N;START OF TEXT;;;; | + 0003;<control>;Cc;0;BN;;;;;N;END OF TEXT;;;; | + 0004;<control>;Cc;0;BN;;;;;N;END OF TRANSMISSION;;;; | + 0005;<control>;Cc;0;BN;;;;;N;ENQUIRY;;;; | + 0006;<control>;Cc;0;BN;;;;;N;ACKNOWLEDGE;;;; | + ^0007;<control>;Cc;0;BN;;;;;N;BELL;;;; | + {2:test/functional/fixtures/bigfile.txt 8,1 0%}| + | + ]]) + end) end) it('statusline does not crash if it has Arabic characters #19447', function() |