aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/sign_spec.lua
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2023-11-22 19:58:17 +0100
committerbfredl <bjorn.linse@gmail.com>2023-12-22 10:54:28 +0100
commit66ac327db27c8097cfa6c1f136dca96151b074f4 (patch)
tree97ea2b8e6589683ca10dc50c31193cef298e83c6 /test/functional/ui/sign_spec.lua
parent720a3518e3d2eee745bee1d856c92e7c1d84549f (diff)
downloadrneovim-66ac327db27c8097cfa6c1f136dca96151b074f4.tar.gz
rneovim-66ac327db27c8097cfa6c1f136dca96151b074f4.tar.bz2
rneovim-66ac327db27c8097cfa6c1f136dca96151b074f4.zip
refactor(drawline): remove LineDrawState and wlv->saved_n_extra
We do not need an enum to keep track of what place in win_line() we currently are at. We already have a variable which keeps track where in the code we currently are (and thus what part of the line we are currently rendering), it is called the _program counter_. When we need non-linear or self-referential control-flow anyway for a laugh, we have a mechanism for that, it is called _function calls_. Do not "save" and "restore" the wlv->n_extra state every time the columns are to be drawn. This sort of thing needs to go away. Instead of setting the n_extra variables and then going to the outer while loop, the text in the columns can be rendered by just simply putting the text into the cells of the screen line, right away. Even in nvim this can be tricky sometimes, luckily we can use function calls to abstract this logic, which means that this handy data structure called the _call stack_ is handling saving away state temporarily, and restoring it back when we need it again. Lastly, but not least, as we now have direct control how signs are rendered, these can be stored as schar_T[2] and be directly put on screen as such.
Diffstat (limited to 'test/functional/ui/sign_spec.lua')
-rw-r--r--test/functional/ui/sign_spec.lua10
1 files changed, 5 insertions, 5 deletions
diff --git a/test/functional/ui/sign_spec.lua b/test/functional/ui/sign_spec.lua
index d47c4ae230..57b11240dc 100644
--- a/test/functional/ui/sign_spec.lua
+++ b/test/functional/ui/sign_spec.lua
@@ -389,8 +389,8 @@ describe('Signs', function()
feed('gg100aa<Esc>')
screen:expect([[
{1: >> }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- aa^a |
+ {8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {8: }aa^a |
{8: 2 }b |
{6: 3 }c |
{6: 4 } |
@@ -404,10 +404,10 @@ describe('Signs', function()
feed('<C-Y>')
-- number column on virtual lines should be empty
screen:expect([[
- VIRT LINES |
+ {6: }VIRT LINES |
{1: >> }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- aa^a |
+ {8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {8: }aa^a |
{8: 2 }b |
{6: 3 }c |
{6: 4 } |