diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2025-06-08 11:09:30 -0500 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-06-08 15:35:07 -0500 |
| commit | 59ce465f6d51f1d3b8ae18a3346264006e99aab5 (patch) | |
| tree | ebabd52d1adece59d9521b040ca844f13b0190d9 /util_test.lua | |
| parent | cef8b428cff4cfb3fa07f30eab644cba1540b4b2 (diff) | |
| download | vis-lspc-59ce465f6d51f1d3b8ae18a3346264006e99aab5.tar.gz vis-lspc-59ce465f6d51f1d3b8ae18a3346264006e99aab5.zip | |
fix the line number detection with tabs
If a line includes tabs add the visually added space for each tab stop
to the line length in order to detect a wrapped line.
Diffstat (limited to 'util_test.lua')
| -rwxr-xr-x | util_test.lua | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/util_test.lua b/util_test.lua index fd6570d..a0f4218 100755 --- a/util_test.lua +++ b/util_test.lua @@ -15,4 +15,19 @@ function test_dirname() -- luacheck: ignore 111 lunatest.assert_equal('/', util.dirname('/')) end +function test_visual_chars_in_line() -- luacheck: ignore 111 + local win = {options = {tabwidth = 4}} -- win mock + local s = '\tfo' -- visual chars == 6 + lunatest.assert_equal(util.visual_chars_in_line(win, s, #s), 6) + + s = 'f\tfo' -- visual chars == 6 + lunatest.assert_equal(util.visual_chars_in_line(win, s, #s), 6) + + s = 'fo\tfo' -- visual chars == 6 + lunatest.assert_equal(util.visual_chars_in_line(win, s, #s), 6) + + s = 'foo\tfo' -- visual chars == 6 + lunatest.assert_equal(util.visual_chars_in_line(win, s, #s), 6) +end + lunatest.run() |
