Patch 9.0.0130

5 views
Skip to first unread message

Bram Moolenaar

unread,
Aug 1, 2022, 10:53:38 AM8/1/22
to vim...@googlegroups.com

Patch 9.0.0130
Problem: Cursor position wrong when inserting around virtual text.
Solution: Update the cursor position properly.
Files: src/edit.c, src/drawline.c, src/testdir/test_textprop.vim,
src/testdir/dumps/Test_prop_inserts_text_1.dump,
src/testdir/dumps/Test_prop_inserts_text_2.dump


*** ../vim-9.0.0129/src/edit.c 2022-07-31 18:34:28.238324299 +0100
--- src/edit.c 2022-08-01 15:25:25.158989020 +0100
***************
*** 288,295 ****
conceal_check_cursor_line(cursor_line_was_concealed);
#endif

! // need to position cursor again when on a TAB
! if (gchar_cursor() == TAB)
curwin->w_valid &= ~(VALID_WROW|VALID_WCOL|VALID_VIRTCOL);

/*
--- 288,300 ----
conceal_check_cursor_line(cursor_line_was_concealed);
#endif

! // Need to position cursor again when on a TAB and when on a char with
! // virtual text.
! if (gchar_cursor() == TAB
! #ifdef FEAT_PROP_POPUP
! || curbuf->b_has_textprop
! #endif
! )
curwin->w_valid &= ~(VALID_WROW|VALID_WCOL|VALID_VIRTCOL);

/*
*** ../vim-9.0.0129/src/drawline.c 2022-07-31 17:11:47.898558951 +0100
--- src/drawline.c 2022-08-01 15:39:18.784734642 +0100
***************
*** 1589,1601 ****
n_attr_skip = added;
}
}
-
- // If the cursor is on or after this position,
- // move it forward.
- if (wp == curwin
- && lnum == curwin->w_cursor.lnum
- && curwin->w_cursor.col >= vcol)
- curwin->w_cursor.col += n_extra;
}
// reset the ID in the copy to avoid it being used
// again
--- 1589,1594 ----
*** ../vim-9.0.0129/src/testdir/test_textprop.vim 2022-08-01 11:17:36.761985329 +0100
--- src/testdir/test_textprop.vim 2022-08-01 15:44:58.536117881 +0100
***************
*** 2256,2259 ****
--- 2256,2275 ----
bwipe!
endfunc

+ def Test_insert_text_before_virtual_text()
+ new foobar
+ setline(1, '12345678')
+ prop_type_add('test', {highlight: 'Search'})
+ prop_add(1, 5, {
+ type: 'test',
+ text: ' virtual text '
+ })
+ normal! f4axyz
+ normal! f5iXYZ
+ assert_equal('1234xyzXYZ5678', getline(1))
+
+ prop_type_delete('test')
+ bwipe!
+ enddef
+
" vim: shiftwidth=2 sts=2 expandtab
*** ../vim-9.0.0129/src/testdir/dumps/Test_prop_inserts_text_1.dump 2022-07-30 21:33:18.200195441 +0100
--- src/testdir/dumps/Test_prop_inserts_text_1.dump 2022-08-01 15:45:12.200094602 +0100
***************
*** 1,6 ****
|i+0&#ffffff0|n|s|e|r|t| |s|o|m|e| |t|e|x|t| |S+0#ffffff16#e000002|O|M|E| |h+0#0000000#ffffff0|e|r|e| |a|n|d| |o|t|h|e|r| |t|e|x|t| |O+0&#ffff4012|T|H|E|R| |t+0&#ffffff0|h|e|r|e| |a|n|d| |s|o
! |m|e| |m|o|r|e| |t|e|x|t| |a|f|t|e|r| |M+0&#5fd7ff255|O|R|E| |w+0&#ffffff0|r|a|p@1|i|n|g> @27
|~+0#4040ff13&| @58
|~| @58
|~| @58
! | +0#0000000&@41|1|,|7@1|-|9|3| @6|A|l@1|
--- 1,6 ----
|i+0&#ffffff0|n|s|e|r|t| |s|o|m|e| |t|e|x|t| |S+0#ffffff16#e000002|O|M|E| |h+0#0000000#ffffff0|e|r|e| |a|n|d| |o|t|h|e|r| |t|e|x|t| |O+0&#ffff4012|T|H|E|R| |t+0&#ffffff0|h|e|r|e| |a|n|d| |s|o
! |m|e| |m|o|r|e| |t|e|x|t| |a|f|t|e|r| |M+0&#5fd7ff255|O|R|E| |w+0&#ffffff0|r|a|p@1|i|n>g| @27
|~+0#4040ff13&| @58
|~| @58
|~| @58
! | +0#0000000&@41|1|,|7|6|-|9|2| @6|A|l@1|
*** ../vim-9.0.0129/src/testdir/dumps/Test_prop_inserts_text_2.dump 2022-07-30 21:33:18.200195441 +0100
--- src/testdir/dumps/Test_prop_inserts_text_2.dump 2022-08-01 15:45:13.356092636 +0100
***************
*** 1,6 ****
| +0#0000e05#a8a8a8255@1|i+0#0000000#ffffff0|n|s|e|r|t| |s|o|m|e| |t|e|x|t| |S+0#ffffff16#e000002|O|M|E| |h+0#0000000#ffffff0|e|r|e| |a|n|d| |o|t|h|e|r| |t|e|x|t| |O+0&#ffff4012|T|H|E|R| |t+0&#ffffff0|h|e|r|e| |a|n|d|
! | +0#0000e05#a8a8a8255@1|s+0#0000000#ffffff0|o|m|e| |m|o|r|e| |t|e|x|t| |a|f|t|e|r| |M+0&#5fd7ff255|O|R|E| |w+0&#ffffff0|r|a|p@1|i|n|g> @23
|~+0#4040ff13&| @58
|~| @58
|~| @58
! | +0#0000000&@41|1|,|7@1|-|9|3| @6|A|l@1|
--- 1,6 ----
| +0#0000e05#a8a8a8255@1|i+0#0000000#ffffff0|n|s|e|r|t| |s|o|m|e| |t|e|x|t| |S+0#ffffff16#e000002|O|M|E| |h+0#0000000#ffffff0|e|r|e| |a|n|d| |o|t|h|e|r| |t|e|x|t| |O+0&#ffff4012|T|H|E|R| |t+0&#ffffff0|h|e|r|e| |a|n|d|
! | +0#0000e05#a8a8a8255@1|s+0#0000000#ffffff0|o|m|e| |m|o|r|e| |t|e|x|t| |a|f|t|e|r| |M+0&#5fd7ff255|O|R|E| |w+0&#ffffff0|r|a|p@1|i|n>g| @23
|~+0#4040ff13&| @58
|~| @58
|~| @58
! | +0#0000000&@41|1|,|7|6|-|9|2| @6|A|l@1|
*** ../vim-9.0.0129/src/version.c 2022-08-01 14:00:27.365518220 +0100
--- src/version.c 2022-08-01 15:26:03.030841324 +0100
***************
*** 737,738 ****
--- 737,740 ----
{ /* Add new patch number below this line */
+ /**/
+ 130,
/**/

--
hundred-and-one symptoms of being an internet addict:
220. Your wife asks for sex and you tell her where to find you on IRC.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages