aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorluukvbaal <31730729+luukvbaal@users.noreply.github.com>2023-03-07 01:45:08 +0100
committerGitHub <noreply@github.com>2023-03-07 08:45:08 +0800
commitbf4eada2c83f5402fc56370fd22af11029a4a3aa (patch)
treedc9c8e9ac0f61f7530ac7b6c26dc415bbce63c0b /test
parent39096f48f0a632870f0792955b37dc32e77458fb (diff)
downloadrneovim-bf4eada2c83f5402fc56370fd22af11029a4a3aa.tar.gz
rneovim-bf4eada2c83f5402fc56370fd22af11029a4a3aa.tar.bz2
rneovim-bf4eada2c83f5402fc56370fd22af11029a4a3aa.zip
fix(column): issues with 'statuscolumn' width (#22542)
Problem: 'statuscolumn' width can be incorrect when toggling 'number' or setting 'statuscolumn'. Solution: Make sure the width is reset and re-estimated when 'statuscolumn' and 'number' are set. (When 'relativenumber' is set this already happens because it always changes "nrwidth_line_count".)
Diffstat (limited to 'test')
-rw-r--r--test/functional/ui/statuscolumn_spec.lua38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/functional/ui/statuscolumn_spec.lua b/test/functional/ui/statuscolumn_spec.lua
index 08b5d1913b..dfbdbb4898 100644
--- a/test/functional/ui/statuscolumn_spec.lua
+++ b/test/functional/ui/statuscolumn_spec.lua
@@ -520,4 +520,42 @@ describe('statuscolumn', function()
: |
]])
end)
+
+ it("has correct width when toggling '(relative)number'", function()
+ screen:try_resize(screen._width, 6)
+ command('call setline(1, repeat(["aaaaa"], 100))')
+ command('set relativenumber')
+ command([[set stc=%{!&nu&&!&rnu?'':&rnu?v:relnum?v:relnum:&nu?v:lnum:'0':v:lnum}]])
+ screen:expect([[
+ 1 aaaaa |
+ 8 ^aaaaa |
+ 1 aaaaa |
+ 2 aaaaa |
+ 3 aaaaa |
+ |
+ ]])
+ -- width correctly estimated with "w_nrwidth_line_count" when setting 'stc'
+ command([[set stc=%{!&nu&&!&rnu?'':&rnu?v:relnum?v:relnum:&nu?v:lnum:'0':v:lnum}]])
+ screen:expect_unchanged()
+ -- zero width when disabling 'number'
+ command('set norelativenumber nonumber')
+ screen:expect([[
+ aaaaa |
+ ^aaaaa |
+ aaaaa |
+ aaaaa |
+ aaaaa |
+ |
+ ]])
+ -- width correctly estimated with "w_nrwidth_line_count" when setting 'nu'
+ command('set number')
+ screen:expect([[
+ 7 aaaaa |
+ 8 ^aaaaa |
+ 9 aaaaa |
+ 10 aaaaa |
+ 11 aaaaa |
+ |
+ ]])
+ end)
end)