diff options
author | Raphael <glephunter@gmail.com> | 2023-01-10 17:36:48 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-10 10:36:48 +0100 |
commit | 87cfe50944ef2c84de98eb6b124fe312eef31313 (patch) | |
tree | e75b9cf5327b095dcc71d9271e0966d5f60a37de | |
parent | 1df2db0bc4dfa2e4f632f9b3dbae00b8b29f2d9f (diff) | |
download | rneovim-87cfe50944ef2c84de98eb6b124fe312eef31313.tar.gz rneovim-87cfe50944ef2c84de98eb6b124fe312eef31313.tar.bz2 rneovim-87cfe50944ef2c84de98eb6b124fe312eef31313.zip |
fix(ui): set stc to empty in floatwin with minimal style (#21720)
fix(ui): set stc to emtpy in floatwin with minimal style
-rw-r--r-- | runtime/doc/api.txt | 8 | ||||
-rw-r--r-- | src/nvim/api/win_config.c | 5 | ||||
-rw-r--r-- | src/nvim/window.c | 6 | ||||
-rw-r--r-- | test/functional/ui/float_spec.lua | 48 |
4 files changed, 61 insertions, 6 deletions
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index fcd9bd0fe5..c827da4554 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -3042,10 +3042,10 @@ nvim_open_win({buffer}, {enter}, {*config}) *nvim_open_win()* Disables 'number', 'relativenumber', 'cursorline', 'cursorcolumn', 'foldcolumn', 'spell' and 'list' options. 'signcolumn' is changed to `auto` and - 'colorcolumn' is cleared. The end-of-buffer region is - hidden by setting `eob` flag of 'fillchars' to a space - char, and clearing the |hl-EndOfBuffer| region in - 'winhighlight'. + 'colorcolumn' is cleared. 'statuscolumn' is changed to + empty. The end-of-buffer region is hidden by setting + `eob` flag of 'fillchars' to a space char, and clearing + the |hl-EndOfBuffer| region in 'winhighlight'. • border: Style of (optional) window border. This can either be a string or an array. The string values are diff --git a/src/nvim/api/win_config.c b/src/nvim/api/win_config.c index 602802d651..3fdd062ef0 100644 --- a/src/nvim/api/win_config.c +++ b/src/nvim/api/win_config.c @@ -114,8 +114,9 @@ /// float where the text should not be edited. Disables /// 'number', 'relativenumber', 'cursorline', 'cursorcolumn', /// 'foldcolumn', 'spell' and 'list' options. 'signcolumn' -/// is changed to `auto` and 'colorcolumn' is cleared. The -/// end-of-buffer region is hidden by setting `eob` flag of +/// is changed to `auto` and 'colorcolumn' is cleared. +/// 'statuscolumn' is changed to empty. The end-of-buffer +/// region is hidden by setting `eob` flag of /// 'fillchars' to a space char, and clearing the /// |hl-EndOfBuffer| region in 'winhighlight'. /// - border: Style of (optional) window border. This can either be a string diff --git a/src/nvim/window.c b/src/nvim/window.c index e836fa50fb..5c05417dd8 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -786,6 +786,12 @@ void win_set_minimal_style(win_T *wp) free_string_option(wp->w_p_cc); wp->w_p_cc = xstrdup(""); } + + // statuscolumn: cleared + if (wp->w_p_stc != NULL && *wp->w_p_stc != NUL) { + free_string_option(wp->w_p_stc); + wp->w_p_stc = xstrdup(""); + } } void win_config_float(win_T *wp, FloatConfig fconfig) diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 61143e953c..f0950959ff 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -1329,6 +1329,54 @@ describe('float window', function() end end) + it("would not break 'minimal' style with statuscolumn set", function() + command('set number') + command('set signcolumn=yes') + command('set colorcolumn=1') + command('set cursorline') + command('set foldcolumn=1') + command('set statuscolumn=%l%s%C') + command('hi NormalFloat guibg=#333333') + feed('ix<cr>y<cr><esc>gg') + meths.open_win(0, false, {relative='editor', width=20, height=4, row=4, col=10, style='minimal'}) + if multigrid then + screen:expect{grid=[[ + ## grid 1 + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [3:----------------------------------------]| + ## grid 2 + {20:1}{21: }{19: }{20: }{22:^x}{21: }| + {14:2 }{19: }{14: }{22:y} | + {14:3 }{19: }{14: }{22: } | + {0:~ }| + {0:~ }| + {0:~ }| + ## grid 3 + | + ## grid 4 + {15:x }| + {15:y }| + {15: }| + {15: }| + ]], float_pos={[4] = {{id = 1001}, "NW", 1, 4, 10, true}}} + else + screen:expect{grid=[[ + {20:1}{21: }{19: }{20: }{22:^x}{21: }| + {14:2 }{19: }{14: }{22:y} | + {14:3 }{19: }{14: }{22: } {15:x } | + {0:~ }{15:y }{0: }| + {0:~ }{15: }{0: }| + {0:~ }{15: }{0: }| + | + ]]} + end + end) + it('can have border', function() local buf = meths.create_buf(false, false) meths.buf_set_lines(buf, 0, -1, true, {' halloj! ', |