The removes the previous restriction that nvim_buf_set_extmark()
could not be used to highlight arbitrary multi-line regions
The problem can be summarized as follows: let's assume an extmark with a
hl_group is placed covering the region (5,0) to (50,0) Now, consider
what happens if nvim needs to redraw a window covering the lines 20-30.
It needs to be able to ask the marktree what extmarks cover this region,
even if they don't begin or end here.
Therefore the marktree needs to be augmented with the information covers
a point, not just what marks begin or end there. To do this, we augment
each node with a field "intersect" which is a set the ids of the
marks which overlap this node, but only if it is not part of the set of
any parent. This ensures the number of nodes that need to be explicitly
marked grows only logarithmically with the total number of explicitly
nodes (and thus the number of of overlapping marks).
Thus we can quickly iterate all marks which overlaps any query position
by looking up what leaf node contains that position. Then we only need
to consider all "start" marks within that leaf node, and the "intersect"
set of that node and all its parents.
Now, and the major source of complexity is that the tree restructuring
operations (to ensure that each node has T-1 <= size <= 2*T-1) also need
to update these sets. If a full inner node is split in two, one of the
new parents might start to completely overlap some ranges and its ids
will need to be moved from its children's sets to its own set.
Similarly, if two undersized nodes gets joined into one, it might no
longer completely overlap some ranges, and now the children which do
needs to have the have the ids in its set instead. And then there are
the pivots! Yes the pivot operations when a child gets moved from one
parent to another.
Problem: use-after-free in do_ecmd
Solution: Verify oldwin pointer after reset_VIsual()
e1dc9a6275
N/A patches for version.c:
vim-patch:9.0.1841: style: trailing whitespace in ex_cmds.c
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: wrong cursor position with 'showbreak' and lcs-eol
Solution: Add size of 'showbreak' before when 'listchars' "eol" is used.
Also fix wrong cursor position with wrapping virtual text on
empty line and 'showbreak'.
closes: vim/vim#128911193951beb
Problem: Cursor is adjusted in window that did not change in size by
'splitkeep'.
Solution: Only check that cursor position is valid in a window that
has changed in size.
closes: vim/vim#1250916af913eee
Co-authored-by: Luuk van Baal <luukvbaal@gmail.com>
Problem: Visual highlight not working with cursor at end of screen line
and 'showbreak'.
Solution: Only update "vcol_prev" when drawing buffer text.
closes: vim/vim#128658fc6a1dae0
Problem: incsearch test not sufficient (after 9.0.1691)
Solution: add an additional test
73b8209266
Co-authored-by: Christ van Willegen <cvwillegen@gmail.com>
Problem: Regression test doesn't fail when fix is reverted.
Solution: Add "n" to 'cpoptions' instead of using :winsize. (closesvim/vim#12587,
issue vim/vim#12528)
e429893741
Problem: Divide by zero when scrolling with 'smoothscroll' set.
Solution: Avoid using a negative width. (closesvim/vim#12540, closesvim/vim#12528)
8154e642aa
Co-authored-by: fullwaywang <fullwaywang@tencent.com>
Problem: Error message is cleared when removing mode message.
Solution: Also reset flags when the message is further down.
da51ad51bf
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Message is cleared when removing mode message (Gary Johnson).
Solution: Do not clear the command line after displaying a message.
800cdbb7ca
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Tests failing because there is no error for float to string
conversion.
Solution: Change the check for failure to check for correct result. Make
some conversions strict in Vim9 script.
3cfa5b16b0
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Visual area not shown when using 'showbreak' and start of line is
not visible. (Jaehwang Jung)
Solution: Adjust "fromcol" for the space taken by 'showbreak'.
(closesvim/vim#12514)
f578ca2c8f
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: "skipcol" not reset when using multi-byte characters.
Solution: Compare with w_virtcol instead of w_cursor.col. (closesvim/vim#12457)
15d4747ffd
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Display is wrong when 'smoothscroll' is set and scrolling multiple
lines.
Solution: Redraw with UPD_NOT_VALID when "skipcol" is or was set.
(closesvim/vim#12490, closesvim/vim#12468)
d9a92dc70b
Problem: Stray character is visible if 'smoothscroll' marker is displayed
on top of a double-wide character.
Solution: When overwriting a double-width character with the 'smoothscroll'
marker clear the second half. (closesvim/vim#12469)
ecb87dd7d3
Problem: Cursor ends up below the window after a put.
Solution: Mark w_crow and w_botline invalid when changing the cursor line.
(closesvim/vim#12465)
8509014add
Co-authored-by: Bram Moolenaar <Bram@vim.org>
`nvim_(get|set)_option_value` pick the current buffer / window by default for buffer-local/window-local (but not global-local) options. So specifying `buf = 0` or `win = 0` in opts is unnecessary for those options. This PR removes those to reduce code clutter.
Problem: With 'smoothscroll' cursor may move below botline.
Solution: Call redraw_later() if needed, Compute cursor row with adjusted
condition. (Luuk van Baal, closesvim/vim#12415)
d49f646bf5
Problem: Display moves up and down with 'incsearch' and 'smoothscroll'.
Solution: Do not check if w_skipcol changed. (Luuk van Baal, closesvim/vim#12410,
closesvim/vim#12409)
0222c2d103
Problem: Display wrong when moving cursor to above the top line and
'smoothscroll' is set.
Solution: Call adjust_skipcol() in more places and make it work better.
(Luuk van Baal, closesvim/vim#12395)
798fa76dbf
Problem: Display errors when making topline shorter and 'smoothscroll' is
set.
Solution: Reset w_skipcol when the topline becomes shorter than its current
value. (Luuk van Baal, closesvim/vim#12367)
5d01f86d99
Problem: Line not fully displayed if it doesn't fit in the screen.
Solution: Do not reset s_skipcol if not needed. (Luuk van Baal,
closesvim/vim#12376)
6c018680be
Problem: Cursor moves to wrong line when 'foldmethod' is "diff". (Rick
Howe)
Solution: Adjust logic for scrolling. (Luuk van Baal, closesvim/vim#12364,
closesvim/vim#12218)
aa6ba308a1
Problem: 'smoothscroll' does not always work properly.
Solution: Do not reset w_skipcol after it was intentionally set. (Luuk van
Baal, closesvim/vim#12360, closesvim/vim#12199, closesvim/vim#12323)
3ce8c38915
Problem: Search stats not always visible when searching backwards.
Solution: Do not display the top/bot message on top of the search stats.
(Christian Brabandt, closesvim/vim#12322, closesvim/vim#12222)
34a6a3617b
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: Text scrolls unnecessarily when splitting and 'splitkeep' is not
"cursor".
Solution: Avoid resetting w_skipcol. (Luuk van Baal, closesvim/vim#12334)
b926bf47d6
Problem: Inserting lines when scrolling with 'smoothscroll' set.
Solution: Adjust line height computation for w_skipcol. (Luuk van Baal,
closesvim/vim#12350)
c8502f9b88
Problem: Vim9: builtin function arguments not checked at compile time.
Solution: Add more type checks. (Yegappan Lakshmanan, closesvim/vim#8539)
5b73992d8f
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Problem: Concealed characters do not work correctly.
Solution: Subtract boguscols instead of adding them. (closesvim/vim#11273)
7500866182
Code change is N/A as Nvim has a draw_col variable instead.
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: No test for deleting the end of a long wrapped line.
Solution: Add a test to check the right text is displayed. (Luuk van Baal,
closesvim/vim#12318)
5b10a14098
Co-authored-by: Luuk van Baal <luukvbaal@gmail.com>
Problem: Divide by zero with 'smoothscroll' set and a narrow window.
Solution: Bail out when the window is too narrow.
870219c58c
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Cursor positioning and display problems with 'smoothscroll' and
using "zt", "zb" or "zz".
Solution: Adjust computations and conditions. (Yee Cheng Chin,
closesvim/vim#11764)
db4d88c2ad
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: With 'smoothscroll' skipcol may be reset unnecessarily.
Solution: Check the line does actually fit in the window.
b21b8e9ed0
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: With 'smoothscroll' cursor may end up in wrong position.
Solution: Correct the computation of screen lines. (Yee Cheng Chin,
closesvim/vim#11502)
361895d2a1
Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
Problem: Cursor moves too far with 'smoothscroll'.
Solution: Only move as far as really needed. (Yee Cheng Chin, closesvim/vim#11504)
81ba26e9de
Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
Problem: With 'smoothscroll' cursor is one screen line too far down. (Ernie
Rael)
Solution: Add a test that currently has the wrong result so that a fix can
be made. (issue vim/vim#11436)
75ac25b496
Co-authored-by: Bram Moolenaar <Bram@vim.org>