diff options
author | Sean Dewar <seandewar@users.noreply.github.com> | 2023-04-18 10:01:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-18 10:01:42 +0100 |
commit | 9033d5eccc505d31b4a95d9fd23a7e2a8d2f282c (patch) | |
tree | 70b76b061e9b54c57baa2ea17b5e2e6f74612e79 /test/functional | |
parent | d4eff4052a29079e108b5efcb030f07643978994 (diff) | |
parent | 65dd3c1180cef5ec15a46bd278ab3a0cb1c3460d (diff) | |
download | rneovim-9033d5eccc505d31b4a95d9fd23a7e2a8d2f282c.tar.gz rneovim-9033d5eccc505d31b4a95d9fd23a7e2a8d2f282c.tar.bz2 rneovim-9033d5eccc505d31b4a95d9fd23a7e2a8d2f282c.zip |
Merge pull request #23005 from seandewar/fix-ruf-cmdline-pos
fix(ruler): fix some ruler issues with no statusline
Diffstat (limited to 'test/functional')
-rw-r--r-- | test/functional/legacy/cmdline_spec.lua | 19 | ||||
-rw-r--r-- | test/functional/ui/float_spec.lua | 160 | ||||
-rw-r--r-- | test/functional/ui/statusline_spec.lua | 59 |
3 files changed, 238 insertions, 0 deletions
diff --git a/test/functional/legacy/cmdline_spec.lua b/test/functional/legacy/cmdline_spec.lua index 2fceb6a132..f7df6ae8d7 100644 --- a/test/functional/legacy/cmdline_spec.lua +++ b/test/functional/legacy/cmdline_spec.lua @@ -239,6 +239,25 @@ describe('cmdline', function() | ]]) end) + + -- oldtest: Test_rulerformat_position() + it("ruler has correct position with 'rulerformat' set", function() + local screen = Screen.new(20, 3) + screen:set_default_attr_ids { + [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText + } + screen:attach() + meths.set_option('ruler', true) + meths.set_option('rulerformat', 'longish') + meths.set_option('laststatus', 0) + meths.set_option('winwidth', 1) + feed [[<C-W>v<C-W>|<C-W>p]] + screen:expect [[ + │^ | + {0:~ }│{0:~}| + longish | + ]] + end) end) describe('cmdwin', function() diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 3203b187cc..e2fe0a2df5 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -2295,6 +2295,166 @@ describe('float window', function() end end) + it("correct ruler position in current float with 'rulerformat' set", function() + command 'set ruler rulerformat=fish:<><' + meths.open_win(0, true, {relative='editor', width=9, height=3, row=0, col=5}) + if multigrid then + screen:expect{grid=[[ + ## grid 1 + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [3:----------------------------------------]| + ## grid 2 + | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + ## grid 3 + fish:<>< | + ## grid 4 + {1:^ }| + {2:~ }| + {2:~ }| + ]], float_pos={ + [4] = {{id = 1001}, "NW", 1, 0, 5, true, 50}; + }, win_viewport={ + [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + }} + else + screen:expect{grid=[[ + {1:^ } | + {0:~ }{2:~ }{0: }| + {0:~ }{2:~ }{0: }| + {0:~ }| + {0:~ }| + {0:~ }| + fish:<>< | + ]]} + end + end) + + it('does not show ruler of not-last current float during ins-completion', function() + screen:try_resize(50,9) + command 'set ruler showmode' + meths.open_win(0, false, {relative='editor', width=3, height=3, row=0, col=0}) + meths.open_win(0, false, {relative='editor', width=3, height=3, row=0, col=5}) + feed '<c-w>w' + neq('', meths.win_get_config(0).relative) + neq(funcs.winnr '$', funcs.winnr()) + if multigrid then + screen:expect{grid=[[ + ## grid 1 + [2:--------------------------------------------------]| + [2:--------------------------------------------------]| + [2:--------------------------------------------------]| + [2:--------------------------------------------------]| + [2:--------------------------------------------------]| + [2:--------------------------------------------------]| + [2:--------------------------------------------------]| + [2:--------------------------------------------------]| + [3:--------------------------------------------------]| + ## grid 2 + | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + ## grid 3 + 0,0-1 All | + ## grid 4 + {1: }| + {2:~ }| + {2:~ }| + ## grid 5 + {1:^ }| + {2:~ }| + {2:~ }| + ]], float_pos={ + [5] = {{id = 1002}, "NW", 1, 0, 5, true, 50}; + [4] = {{id = 1001}, "NW", 1, 0, 0, true, 50}; + }, win_viewport={ + [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + }} + else + screen:expect{grid=[[ + {1: } {1:^ } | + {2:~ }{0: }{2:~ }{0: }| + {2:~ }{0: }{2:~ }{0: }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + 0,0-1 All | + ]]} + end + feed 'i<c-x>' + if multigrid then + screen:expect{grid=[[ + ## grid 1 + [2:--------------------------------------------------]| + [2:--------------------------------------------------]| + [2:--------------------------------------------------]| + [2:--------------------------------------------------]| + [2:--------------------------------------------------]| + [2:--------------------------------------------------]| + [2:--------------------------------------------------]| + [2:--------------------------------------------------]| + [3:--------------------------------------------------]| + ## grid 2 + | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + ## grid 3 + {3:-- ^X mode (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)} | + ## grid 4 + {1: }| + {2:~ }| + {2:~ }| + ## grid 5 + {1:^ }| + {2:~ }| + {2:~ }| + ]], float_pos={ + [5] = {{id = 1002}, "NW", 1, 0, 5, true, 50}; + [4] = {{id = 1001}, "NW", 1, 0, 0, true, 50}; + }, win_viewport={ + [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + }} + else + screen:expect{grid=[[ + {1: } {1:^ } | + {2:~ }{0: }{2:~ }{0: }| + {2:~ }{0: }{2:~ }{0: }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {3:-- ^X mode (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)} | + ]]} + end + end) + it('can have minimum size', function() insert("the background text") local buf = meths.create_buf(false, true) diff --git a/test/functional/ui/statusline_spec.lua b/test/functional/ui/statusline_spec.lua index 8e301dc70c..c41d4983a7 100644 --- a/test/functional/ui/statusline_spec.lua +++ b/test/functional/ui/statusline_spec.lua @@ -653,3 +653,62 @@ it('ruler is redrawn in cmdline with redrawstatus #22804', function() other value | ]]) end) + +it("shows correct ruler in cmdline with no statusline", function() + clear() + local screen = Screen.new(30, 8) + screen:set_default_attr_ids { + [1] = {bold = true, foreground = Screen.colors.Blue}, -- NonText + [2] = {bold = true, reverse = true}, -- StatusLine + [3] = {reverse = true}, -- StatusLineNC + } + screen:attach() + -- Use long ruler to check 'ruler' with 'rulerformat' set has correct width. + command [[ + set ruler rulerformat=%{winnr()}longlonglong ls=0 winwidth=10 + split + wincmd b + vsplit + wincmd t + wincmd | + mode + ]] + -- Window 1 is current. It has a statusline, so cmdline should show the + -- last window's ruler, which has no statusline. + command '1wincmd w' + screen:expect [[ + ^ | + {1:~ }| + {1:~ }| + {2:[No Name] 1longlonglong }| + │ | + {1:~ }│{1:~ }| + {1:~ }│{1:~ }| + 3longlonglong | + ]] + -- Window 2 is current. It has no statusline, so cmdline should show its + -- ruler instead. + command '2wincmd w' + screen:expect [[ + | + {1:~ }| + {1:~ }| + {3:[No Name] 1longlonglong }| + ^ │ | + {1:~ }│{1:~ }| + {1:~ }│{1:~ }| + 2longlonglong | + ]] + -- Window 3 is current. Cmdline should again show its ruler. + command '3wincmd w' + screen:expect [[ + | + {1:~ }| + {1:~ }| + {3:[No Name] 1longlonglong }| + │^ | + {1:~ }│{1:~ }| + {1:~ }│{1:~ }| + 3longlonglong | + ]] +end) |