diff options
author | Sirisak Lueangsaksri <spywhere@me.com> | 2021-01-20 23:37:09 +0700 |
---|---|---|
committer | Sirisak Lueangsaksri <spywhere@me.com> | 2021-01-20 23:57:21 +0700 |
commit | 83ea08ddf30d6a2f5e4e8108fd546aa94aa0af94 (patch) | |
tree | 62608d1890e55782e019deee7902784448471aa8 /test/functional/ui/sign_spec.lua | |
parent | 52675915a737c22270af23c152bb1f115b157685 (diff) | |
download | rneovim-83ea08ddf30d6a2f5e4e8108fd546aa94aa0af94.tar.gz rneovim-83ea08ddf30d6a2f5e4e8108fd546aa94aa0af94.tar.bz2 rneovim-83ea08ddf30d6a2f5e4e8108fd546aa94aa0af94.zip |
opt: add tests (#13783)
Diffstat (limited to 'test/functional/ui/sign_spec.lua')
-rw-r--r-- | test/functional/ui/sign_spec.lua | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/test/functional/ui/sign_spec.lua b/test/functional/ui/sign_spec.lua index d1b8de5e4e..1937102782 100644 --- a/test/functional/ui/sign_spec.lua +++ b/test/functional/ui/sign_spec.lua @@ -266,6 +266,111 @@ describe('Signs', function() ]]} end) + it('auto-resize sign column with minimum size (#13783)', function() + feed('ia<cr>b<cr>c<cr><esc>') + command('set number') + -- sign column should always accommodate at the minimum size + command('set signcolumn=auto:1-3') + screen:expect([[ + {2: }{6: 1 }a | + {2: }{6: 2 }b | + {2: }{6: 3 }c | + {2: }{6: 4 }^ | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + | + ]]) + -- should support up to 8 signs at minimum + command('set signcolumn=auto:8-9') + screen:expect([[ + {2: }{6: 1 }a | + {2: }{6: 2 }b | + {2: }{6: 3 }c | + {2: }{6: 4 }^ | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + | + ]]) + -- should keep the same sign size when signs are not exceeding + -- the minimum + command('set signcolumn=auto:2-5') + command('sign define pietSearch text=>> texthl=Search') + command('sign place 1 line=1 name=pietSearch buffer=1') + screen:expect([[ + {1:>>}{2: }{6: 1 }a | + {2: }{6: 2 }b | + {2: }{6: 3 }c | + {2: }{6: 4 }^ | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + | + ]]) + -- should resize itself when signs are exceeding minimum but + -- not over the maximum + command('sign place 2 line=1 name=pietSearch buffer=1') + command('sign place 3 line=1 name=pietSearch buffer=1') + command('sign place 4 line=1 name=pietSearch buffer=1') + screen:expect([[ + {1:>>>>>>>>}{6: 1 }a | + {2: }{6: 2 }b | + {2: }{6: 3 }c | + {2: }{6:^ 4 } | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + | + ]]) + -- should keep the column at maximum size when signs are + -- exceeding the maximum + command('sign place 5 line=1 name=pietSearch buffer=1') + command('sign place 6 line=1 name=pietSearch buffer=1') + command('sign place 7 line=1 name=pietSearch buffer=1') + command('sign place 8 line=1 name=pietSearch buffer=1') + screen:expect([[ + {1:>>>>>>>>>>}{6: 1 }a | + {2: }{6: 2 }b | + {2: }{6: 3 }c | + {2: ^ }{6: 4 } | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + | + ]]) + end) + it('ignores signs with no icon and text when calculting the signcolumn width', function() feed('ia<cr>b<cr>c<cr><esc>') command('set number') |