patch 9.0.1802: Multiline regex with Visual selection fails with virtual text

Commit: 
https://github.com/vim/vim/commit/e3daa06be1a3ba7ced0735582467d092275e591c
Author: zeertzjq <zeert...@outlook.com>
Date:   Sun Aug 27 19:11:46 2023 +0200

    patch 9.0.1802: Multiline regex with Visual selection fails with virtual 
text
    
    Problem:  Multiline regex with Visual selection fails when Visual
              selection contains virtual text after last char.
    Solution: Only include virtual text after last char when getting full
              line length.
    
    closes: #12908
    
    Signed-off-by: Christian Brabandt <c...@256bit.org>
    Co-authored-by: zeertzjq <zeert...@outlook.com>

diff --git a/src/charset.c b/src/charset.c
index 7901479d4..1c7f7d791 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -809,7 +809,7 @@ win_linetabsize_cts(chartabsize_T *cts, colnr_T len)
        cts->cts_vcol += win_lbr_chartabsize(cts, NULL);
 #ifdef FEAT_PROP_POPUP
     // check for a virtual text at the end of a line or on an empty line
-    if (cts->cts_has_prop_with_text && *cts->cts_ptr == NUL)
+    if (len == MAXCOL && cts->cts_has_prop_with_text && *cts->cts_ptr == NUL)
     {
        (void)win_lbr_chartabsize(cts, NULL);
        cts->cts_vcol += cts->cts_cur_text_width;
@@ -1196,8 +1196,7 @@ win_lbr_chartabsize(
                       || (tp->tp_col == MAXCOL
                           && ((tp->tp_flags & TP_FLAG_ALIGN_ABOVE)
                                ? col == 0
-                               : s[0] == NUL
-                                                 && cts->cts_with_trailing)))
+                               : s[0] == NUL && cts->cts_with_trailing)))
                    && -tp->tp_id - 1 < gap->ga_len)
            {
                char_u *p = ((char_u **)gap->ga_data)[-tp->tp_id - 1];
diff --git a/src/testdir/dumps/Test_prop_with_text_empty_line_6.dump 
b/src/testdir/dumps/Test_prop_with_text_empty_line_6.dump
new file mode 100644
index 000000000..1bc9903bc
--- /dev/null
+++ b/src/testdir/dumps/Test_prop_with_text_empty_line_6.dump
@@ -0,0 +1,8 @@
+|X+0&#ffff4012@59
+|a+0&#e0e0e08@1>a+0&#ffffff0| @56
+|X+0&#ffff4012@59
+@1| +0&#ffffff0@58
+|b+0&#e0e0e08@2|b+0&#ffffff0@2| @53
+|~+0#4040ff13&| @58
+|~| @58
+|-+2#0000000&@1| |V|I|S|U|A|L| |B|L|O|C|K| |-@1| +0&&@13|3|x|3| @6|2|,|3| 
@10|A|l@1| 
diff --git a/src/testdir/dumps/Test_prop_with_text_empty_line_7.dump 
b/src/testdir/dumps/Test_prop_with_text_empty_line_7.dump
new file mode 100644
index 000000000..929453307
--- /dev/null
+++ b/src/testdir/dumps/Test_prop_with_text_empty_line_7.dump
@@ -0,0 +1,8 @@
+|X+0&#ffff4012@59
+>a+0&#ffffff0@2| @56
+|X+0&#ffff4012@59
+@1| +0&#ffffff0@58
+|b@5| @53
+|~+0#4040ff13&| @58
+|~| @58
+|s+0#e000002&|e|a|r|c|h| |h|i|t| |B|O|T|.@2|t|i|n|u|i|n|g| |a|t| |T|O|P| 
+0#0000000&@10|2|,|1| @10|A|l@1| 
diff --git a/src/testdir/dumps/Test_prop_with_text_empty_line_8.dump 
b/src/testdir/dumps/Test_prop_with_text_empty_line_8.dump
new file mode 100644
index 000000000..155b65d79
--- /dev/null
+++ b/src/testdir/dumps/Test_prop_with_text_empty_line_8.dump
@@ -0,0 +1,8 @@
+|X+0&#ffff4012@59
+|a+0&#ffffff0@2| @56
+|c>X+0&#ffff4012@58
+@2| +0&#ffffff0@57
+|b@5| @53
+|~+0#4040ff13&| @58
+|~| @58
+|-+2#0000000&@1| |I|N|S|E|R|T| |-@1| +0&&@29|3|,|2| @10|A|l@1| 
diff --git a/src/testdir/dumps/Test_prop_with_text_empty_line_9.dump 
b/src/testdir/dumps/Test_prop_with_text_empty_line_9.dump
new file mode 100644
index 000000000..64290423d
--- /dev/null
+++ b/src/testdir/dumps/Test_prop_with_text_empty_line_9.dump
@@ -0,0 +1,8 @@
+|X+0&#ffff4012@59
+>a+0&#ffffff0@2| @56
+|c|X+0&#ffff4012@58
+@2| +0&#ffffff0@57
+|b@5| @53
+|~+0#4040ff13&| @58
+|~| @58
+|s+0#e000002&|e|a|r|c|h| |h|i|t| |B|O|T|.@2|t|i|n|u|i|n|g| |a|t| |T|O|P| 
+0#0000000&@10|2|,|1| @10|A|l@1| 
diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim
index f258c19f4..209b804e8 100644
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -3235,6 +3235,14 @@ func Test_props_with_text_empty_line()
   call VerifyScreenDump(buf, 'Test_prop_with_text_empty_line_4', {})
   call term_sendkeys(buf, "j")
   call VerifyScreenDump(buf, 'Test_prop_with_text_empty_line_5', {})
+  call term_sendkeys(buf, "0\<C-V>2l2k")
+  call VerifyScreenDump(buf, 'Test_prop_with_text_empty_line_6', {})
+  call term_sendkeys(buf, "\<Esc>/aaa\n\%V\<CR>")
+  call VerifyScreenDump(buf, 'Test_prop_with_text_empty_line_7', {})
+  call term_sendkeys(buf, "3ggic")
+  call VerifyScreenDump(buf, 'Test_prop_with_text_empty_line_8', {})
+  call term_sendkeys(buf, "\<Esc>/aaa\nc\%V\<CR>")
+  call VerifyScreenDump(buf, 'Test_prop_with_text_empty_line_9', {})
 
   call StopVimInTerminal(buf)
 endfunc
diff --git a/src/version.c b/src/version.c
index 431ac38cb..39afebd66 100644
--- a/src/version.c
+++ b/src/version.c
@@ -699,6 +699,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1802,
 /**/
     1801,
 /**/

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1qaJLx-003Oqs-Te%40256bit.org.

Raspunde prin e-mail lui