Patch 8.1.1552
Problem: Cursor position is wrong after sign column appears or disappears.
(Yegappan Lakshmanan)
Solution: Call changed_line_abv_curs() instead of changed_cline_bef_curs().
Files: src/sign.c, src/testdir/test_signs.vim,
src/testdir/dumps/Test_sign_cursor_01.dump,
src/testdir/dumps/Test_sign_cursor_02.dump
*** ../vim-8.1.1551/src/sign.c 2019-06-07 21:37:10.409300183 +0200
--- src/sign.c 2019-06-16 13:50:08.878226058 +0200
***************
*** 231,237 ****
if (buf->b_signlist == NULL)
{
redraw_buf_later(buf, NOT_VALID);
! changed_cline_bef_curs();
}
// first sign in signlist
--- 231,237 ----
if (buf->b_signlist == NULL)
{
redraw_buf_later(buf, NOT_VALID);
! changed_line_abv_curs();
}
// first sign in signlist
***************
*** 531,537 ****
if (buf->b_signlist == NULL)
{
redraw_buf_later(buf, NOT_VALID);
! changed_cline_bef_curs();
}
return lnum;
--- 531,537 ----
if (buf->b_signlist == NULL)
{
redraw_buf_later(buf, NOT_VALID);
! changed_line_abv_curs();
}
return lnum;
***************
*** 651,657 ****
if (buf->b_signlist != NULL && curwin != NULL)
{
redraw_buf_later(buf, NOT_VALID);
! changed_cline_bef_curs();
}
lastp = &buf->b_signlist;
--- 651,657 ----
if (buf->b_signlist != NULL && curwin != NULL)
{
redraw_buf_later(buf, NOT_VALID);
! changed_line_abv_curs();
}
lastp = &buf->b_signlist;
*** ../vim-8.1.1551/src/testdir/test_signs.vim 2019-06-15 17:57:43.976724009
+0200
--- src/testdir/test_signs.vim 2019-06-16 13:45:24.635366347 +0200
***************
*** 3,8 ****
--- 3,10 ----
source check.vim
CheckFeature signs
+ source screendump.vim
+
func Test_sign()
new
call setline(1, ['a', 'b', 'c', 'd'])
***************
*** 1706,1708 ****
--- 1708,1738 ----
sign undefine sign1
enew! | only!
endfunc
+
+ " Test for correct cursor position after the sign column appears or
disappears.
+ func Test_sign_cursor_position()
+ if !CanRunVimInTerminal()
+ throw 'Skipped: cannot make screendumps'
+ endif
+
+ let lines =<< trim END
+ call setline(1, [repeat('x', 75), 'mmmm', 'yyyy'])
+ call cursor(2,1)
+ sign define s1 texthl=Search text==>
+ redraw
+ sign place 10 line=2 name=s1
+ END
+ call writefile(lines, 'XtestSigncolumn')
+ let buf = RunVimInTerminal('-S XtestSigncolumn', {'rows': 6})
+ call VerifyScreenDump(buf, 'Test_sign_cursor_01', {})
+
+ " update cursor position calculation
+ call term_sendkeys(buf, "lh")
+ call term_sendkeys(buf, ":sign unplace 10\<CR>")
+ call VerifyScreenDump(buf, 'Test_sign_cursor_02', {})
+
+
+ " clean up
+ call StopVimInTerminal(buf)
+ call delete('XtestSigncolumn')
+ endfunc
*** ../vim-8.1.1551/src/testdir/dumps/Test_sign_cursor_01.dump 2019-06-16
13:54:45.137111687 +0200
--- src/testdir/dumps/Test_sign_cursor_01.dump 2019-06-16 13:41:18.160346368
+0200
***************
*** 0 ****
--- 1,6 ----
+ | +0#0000e05#a8a8a8255@1|x+0#0000000#ffffff0@72
+ | +0#0000e05#a8a8a8255@1|x+0#0000000#ffffff0@1| @70
+ |=+0&#ffff4012|>>m+0&#ffffff0@3| @68
+ | +0#0000e05#a8a8a8255@1|y+0#0000000#ffffff0@3| @68
+ |~+0#4040ff13&| @73
+ | +0#0000000&@56|2|,|1| @10|A|l@1|
*** ../vim-8.1.1551/src/testdir/dumps/Test_sign_cursor_02.dump 2019-06-16
13:54:45.141111671 +0200
--- src/testdir/dumps/Test_sign_cursor_02.dump 2019-06-16 13:45:31.963337065
+0200
***************
*** 0 ****
--- 1,6 ----
+ |x+0&#ffffff0@74
+ >m@3| @70
+ |y@3| @70
+ |~+0#4040ff13&| @73
+ |~| @73
+ |:+0#0000000&|s|i|g|n| |u|n|p|l|a|c|e| |1|0| @40|2|,|1| @10|A|l@1|
*** ../vim-8.1.1551/src/version.c 2019-06-15 23:10:27.446296855 +0200
--- src/version.c 2019-06-16 13:33:55.426129183 +0200
***************
*** 779,780 ****
--- 779,782 ----
{ /* Add new patch number below this line */
+ /**/
+ 1552,
/**/
--
hundred-and-one symptoms of being an internet addict:
196. Your computer costs more than your car.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/201906161155.x5GBtsBQ031784%40masaka.moolenaar.net.
For more options, visit https://groups.google.com/d/optout.