Problem: When virtualedit is set to all, the cursor is supposed to be
permitted to reside anywhere, including on the virtual space
beyond the end of the buffer's text. Switching modes triggered
a routine that "fixed" a cursor that was past the end of the
line by shifting it back to the last actual character in the
line and compensating with a virtual column offset. While
visually identical, this re-encoding changed the underlying
byte index, causing position-reporting functions to return
inconsistent values after a mode change.
Solution: Skip this coordinate adjustment when virtual editing is fully
enabled. By treating the line terminator as a valid, stable
position, the cursor’s internal representation remains
unchanged when entering or exiting Visual mode, ensuring
consistent coordinate reporting. Add a regression test to
check this functionality.
(McAuley Penney)
fixes: vim/vim#16276closes: vim/vim#19009491f0fa457
Co-authored-by: McAuley Penney <jacobmpenney@gmail.com>
Problem: tests: test_virtualedit.vim leaves swapfiles behind
Solution: Close open buffers using :bw! instead of :close!
a8a0ee5004
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: Code style is not check in test scripts.
Solution: Add basic code style check for test files.
94722c5107
Use Test_test_files() from latest Vim.
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: cursor() and getregion() don't handle v:maxcol well.
Solution: Add special handling for v:maxcol like setpos() does.
(zeertzjq)
closes: vim/vim#146982ffdae7948
Problem: using "C" and 've=all' set, doesn't include composing chars
when changing a line, keeps the composing chars for whatever
is typed afterwards.
Solution: Use mb_head_off() and mb_ptr2len() instead of mb_tail_off().
(zeertzjq)
closes: vim/vim#14083048761bcd4
Problem: missing test for mouse click + 'virtedit'
Solution: Add test for clicking after eol with 'virtualedit' and wrapped
line
closes: vim/vim#1315746a0582ffa
Problem: Wrong curswant when clicking on empty line or with vsplits.
Solution: Don't check for ScreenCols[] before the start of the window
and handle empty line properly.
closes: vim/vim#1313203cd697d63
Problem: Wrong cursor position when clicking after concealed text
with 'virtualedit'.
Solution: Store virtual columns in ScreenCols[] instead of text
columns, and always use coladvance() when clicking.
This also fixes incorrect curswant when clicking on a TAB, so now
Test_normal_click_on_ctrl_char() asserts the same results as the ones
before patch 9.0.0048.
closes: vim/vim#12808e500ae8e29
Remove the mouse_adjust_click() function.
There is a difference in behavior with the old mouse_adjust_click()
approach: when clicking on the character immediately after concealed
text that is completely hidden, cursor is put on the clicked character
rather than at the start of the concealed text. The new behavior is
better, but it causes unnecessary scrolling in a functional test (which
is an existing issue unrelated to these patches), so adjust the test.
Now fully merged:
vim-patch:9.0.0177: cursor position wrong with 'virtualedit' and mouse click