diff options
author | bfredl <bjorn.linse@gmail.com> | 2023-10-31 21:33:00 +0100 |
---|---|---|
committer | bfredl <bjorn.linse@gmail.com> | 2023-11-03 11:35:42 +0100 |
commit | 44f0480a22af8f87f8784dac430416cb9913adea (patch) | |
tree | aeb487ea271274f92c59c275bf6cb26e42ed2eac /test/functional/ui/cmdline_spec.lua | |
parent | d4dc1355eda78ca2a8aece08d1ab6c6bc1e91505 (diff) | |
download | rneovim-44f0480a22af8f87f8784dac430416cb9913adea.tar.gz rneovim-44f0480a22af8f87f8784dac430416cb9913adea.tar.bz2 rneovim-44f0480a22af8f87f8784dac430416cb9913adea.zip |
refactor(grid): implement rightleftcmd as a post-processing step
Previously, 'rightleftcmd' was implemented by having all code which
would affect msg_col or output screen cells be conditional on `cmdmsg_rl`.
This change removes all that and instead implements rightleft as a
mirroring post-processing step.
Diffstat (limited to 'test/functional/ui/cmdline_spec.lua')
-rw-r--r-- | test/functional/ui/cmdline_spec.lua | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua index 497b2e7f4c..188b9ee87b 100644 --- a/test/functional/ui/cmdline_spec.lua +++ b/test/functional/ui/cmdline_spec.lua @@ -24,6 +24,7 @@ local function new_screen(opt) [7] = {bold = true, foreground = Screen.colors.Brown}, [8] = {background = Screen.colors.LightGrey}, [9] = {bold = true}, + [10] = {background = Screen.colors.Yellow1}; }) return screen end @@ -771,6 +772,84 @@ describe('cmdline redraw', function() :^abc | ]]) end) + + it('with rightleftcmd', function() + command('set rightleft rightleftcmd=search shortmess+=s') + meths.buf_set_lines(0, 0, -1, true, {"let's rock!"}) + screen:expect{grid=[[ + !kcor s'te^l| + {1: ~}| + {1: ~}| + {1: ~}| + | + ]]} + + feed '/' + screen:expect{grid=[[ + !kcor s'tel| + {1: ~}| + {1: ~}| + {1: ~}| + ^ /| + ]]} + + feed "let's" + -- note: cursor looks off but looks alright in real use + -- when rendered as a block so it touches the end of the text + screen:expect{grid=[[ + !kcor {2:s'tel}| + {1: ~}| + {1: ~}| + {1: ~}| + ^ s'tel/| + ]]} + + -- cursor movement + feed "<space>" + screen:expect{grid=[[ + !kcor{2: s'tel}| + {1: ~}| + {1: ~}| + {1: ~}| + ^ s'tel/| + ]]} + + feed "rock" + screen:expect{grid=[[ + !{2:kcor s'tel}| + {1: ~}| + {1: ~}| + {1: ~}| + ^ kcor s'tel/| + ]]} + + feed "<right>" + screen:expect{grid=[[ + !{2:kcor s'tel}| + {1: ~}| + {1: ~}| + {1: ~}| + ^kcor s'tel/| + ]]} + + feed "<left>" + screen:expect{grid=[[ + !{2:kcor s'tel}| + {1: ~}| + {1: ~}| + {1: ~}| + ^ kcor s'tel/| + ]]} + + feed "<cr>" + screen:expect{grid=[[ + !{10:kcor s'te^l}| + {1: ~}| + {1: ~}| + {1: ~}| + kcor s'tel/ | + ]]} + end) end) describe('statusline is redrawn on entering cmdline', function() |