Patch 9.0.0168
Problem:    Cursor positioned wrong with two virtual text properties close
            together. (Ben Jackson)
Solution:   Add the original size, not the computed one. (closes #10864)
Files:      src/charset.c, src/testdir/test_textprop.vim,
            src/testdir/dumps/Test_prop_inserts_text_1.dump,
            src/testdir/dumps/Test_prop_inserts_text_2.dump,
            src/testdir/dumps/Test_prop_inserts_text_3.dump,
            src/testdir/dumps/Test_prop_inserts_text_4.dump,
            src/testdir/dumps/Test_prop_inserts_text_5.dump,
            src/testdir/dumps/Test_prop_inserts_text_6.dump


*** ../vim-9.0.0167/src/charset.c       2022-08-06 21:03:32.922662885 +0100
--- src/charset.c       2022-08-08 10:50:42.332675748 +0100
***************
*** 1130,1135 ****
--- 1130,1136 ----
  # ifdef FEAT_PROP_POPUP
      if (cts->cts_has_prop_with_text && *line != NUL)
      {
+       int         normal_size = size;
        int         i;
        int         col = (int)(s - line);
        garray_T    *gap = &wp->w_buffer->b_textprop_text;
***************
*** 1141,1147 ****
            // Watch out for the text being deleted.  "cts_text_props" is a
            // copy, the text prop may actually have been removed from the line.
            if (tp->tp_id < 0
!                   && ((tp->tp_col - 1 >= col && tp->tp_col - 1 < col + size)
                       || (tp->tp_col == MAXCOL && (s[0] == NUL || s[1] == NUL)
                                                   && cts->cts_with_trailing))
                    && -tp->tp_id - 1 < gap->ga_len)
--- 1142,1149 ----
            // Watch out for the text being deleted.  "cts_text_props" is a
            // copy, the text prop may actually have been removed from the line.
            if (tp->tp_id < 0
!                   && ((tp->tp_col - 1 >= col
!                                        && tp->tp_col - 1 < col + normal_size)
                       || (tp->tp_col == MAXCOL && (s[0] == NUL || s[1] == NUL)
                                                   && cts->cts_with_trailing))
                    && -tp->tp_id - 1 < gap->ga_len)
***************
*** 1152,1158 ****
                {
                    int cells = vim_strsize(p);
  
-                   added = wp->w_width - (vcol + size) % wp->w_width;
                    if (tp->tp_col == MAXCOL)
                    {
                        int below = (tp->tp_flags & TP_FLAG_ALIGN_BELOW);
--- 1154,1159 ----
***************
*** 1163,1170 ****
--- 1164,1174 ----
                        // Keep in sync with where textprop_size_after_trunc()
                        // is called in win_line().
                        if (!wrap)
+                       {
+                           added = wp->w_width - (vcol + size) % wp->w_width;
                            cells = textprop_size_after_trunc(wp,
                                                     below, added, p, &n_used);
+                       }
                        // right-aligned does not really matter here, same as
                        // "after"
                        if (below)
*** ../vim-9.0.0167/src/testdir/test_textprop.vim       2022-08-07 
14:55:09.543290953 +0100
--- src/testdir/test_textprop.vim       2022-08-08 11:00:34.196477788 +0100
***************
*** 2317,2327 ****
        call prop_type_add('multibyte', #{highlight: 'Visual'})
        call prop_add(2, 4, #{type: 'multibyte', text: 'söme和平téxt'})
  
!       call setline(3, '')
!       call prop_add(3, 1, #{type: 'someprop', text: 'empty line'})
    END
    call writefile(lines, 'XscriptPropsWithText')
!   let buf = RunVimInTerminal('-S XscriptPropsWithText', #{rows: 6, cols: 60})
    call VerifyScreenDump(buf, 'Test_prop_inserts_text_1', {})
  
    call term_sendkeys(buf, ":set signcolumn=yes\<CR>")
--- 2317,2332 ----
        call prop_type_add('multibyte', #{highlight: 'Visual'})
        call prop_add(2, 4, #{type: 'multibyte', text: 'söme和平téxt'})
  
!       call setline(3, 'Foo foo = { 1, 2 };')
!       call prop_type_add( 'testprop', #{highlight: 'Comment'})
!       call prop_add(3, 13, #{type: 'testprop', text: '.x='})
!       call prop_add(3, 16, #{type: 'testprop', text: '.y='})
! 
!       call setline(4, '')
!       call prop_add(4, 1, #{type: 'someprop', text: 'empty line'})
    END
    call writefile(lines, 'XscriptPropsWithText')
!   let buf = RunVimInTerminal('-S XscriptPropsWithText', #{rows: 8, cols: 60})
    call VerifyScreenDump(buf, 'Test_prop_inserts_text_1', {})
  
    call term_sendkeys(buf, ":set signcolumn=yes\<CR>")
***************
*** 2330,2337 ****
    call term_sendkeys(buf, "2G$")
    call VerifyScreenDump(buf, 'Test_prop_inserts_text_3', {})
  
!   call term_sendkeys(buf, "3G")
    call VerifyScreenDump(buf, 'Test_prop_inserts_text_4', {})
  
    call StopVimInTerminal(buf)
    call delete('XscriptPropsWithText')
--- 2335,2347 ----
    call term_sendkeys(buf, "2G$")
    call VerifyScreenDump(buf, 'Test_prop_inserts_text_3', {})
  
!   call term_sendkeys(buf, "3Gf1")
    call VerifyScreenDump(buf, 'Test_prop_inserts_text_4', {})
+   call term_sendkeys(buf, "f2")
+   call VerifyScreenDump(buf, 'Test_prop_inserts_text_5', {})
+ 
+   call term_sendkeys(buf, "4G")
+   call VerifyScreenDump(buf, 'Test_prop_inserts_text_6', {})
  
    call StopVimInTerminal(buf)
    call delete('XscriptPropsWithText')
*** ../vim-9.0.0167/src/testdir/dumps/Test_prop_inserts_text_1.dump     
2022-08-05 13:06:51.619363752 +0100
--- src/testdir/dumps/Test_prop_inserts_text_1.dump     2022-08-08 
11:00:37.248476119 +0100
***************
*** 1,6 ****
--- 1,8 ----
  |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
  |p|r|e|s+0&#e0e0e08|ö|m|e|和*&|平|t+&|é|x|t|p+0&#ffffff0|o|s|t| @40
+ |F|o@1| |f|o@1| |=| |{| |.+0#0000e05&|x|=|1+0#0000000&|,| 
|.+0#0000e05&|y|=|2+0#0000000&| |}|;| @34
  |e+0#ffffff16#e000002|m|p|t|y| |l|i|n|e| +0#0000000#ffffff0@49
  |~+0#4040ff13&| @58
+ |~| @58
  | +0#0000000&@41|1|,|7|6|-|9|2| @6|A|l@1| 
*** ../vim-9.0.0167/src/testdir/dumps/Test_prop_inserts_text_2.dump     
2022-08-05 13:06:51.619363752 +0100
--- src/testdir/dumps/Test_prop_inserts_text_2.dump     2022-08-08 
11:00:38.312475538 +0100
***************
*** 1,6 ****
--- 1,8 ----
  | +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#0000e05#a8a8a8255@1|p+0#0000000#ffffff0|r|e|s+0&#e0e0e08|ö|m|e|和*&|平|t+&|é|x|t|p+0&#ffffff0|o|s|t|
 @38
+ | +0#0000e05#a8a8a8255@1|F+0#0000000#ffffff0|o@1| |f|o@1| |=| |{| 
|.+0#0000e05&|x|=|1+0#0000000&|,| |.+0#0000e05&|y|=|2+0#0000000&| |}|;| @32
  | +0#0000e05#a8a8a8255@1|e+0#ffffff16#e000002|m|p|t|y| |l|i|n|e| 
+0#0000000#ffffff0@47
  |~+0#4040ff13&| @58
+ |~| @58
  | +0#0000000&@41|1|,|7|6|-|9|2| @6|A|l@1| 
*** ../vim-9.0.0167/src/testdir/dumps/Test_prop_inserts_text_3.dump     
2022-08-05 13:06:51.619363752 +0100
--- src/testdir/dumps/Test_prop_inserts_text_3.dump     2022-08-08 
11:00:39.376474952 +0100
***************
*** 1,6 ****
--- 1,8 ----
  | +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#0000e05#a8a8a8255@1|p+0#0000000#ffffff0|r|e|s+0&#e0e0e08|ö|m|e|和*&|平|t+&|é|x|t|p+0&#ffffff0|o|s>t|
 @38
+ | +0#0000e05#a8a8a8255@1|F+0#0000000#ffffff0|o@1| |f|o@1| |=| |{| 
|.+0#0000e05&|x|=|1+0#0000000&|,| |.+0#0000e05&|y|=|2+0#0000000&| |}|;| @32
  | +0#0000e05#a8a8a8255@1|e+0#ffffff16#e000002|m|p|t|y| |l|i|n|e| 
+0#0000000#ffffff0@47
  |~+0#4040ff13&| @58
+ |~| @58
  | +0#0000000&@41|2|,|7|-|1|9| @7|A|l@1| 
*** ../vim-9.0.0167/src/testdir/dumps/Test_prop_inserts_text_4.dump     
2022-08-05 13:06:51.619363752 +0100
--- src/testdir/dumps/Test_prop_inserts_text_4.dump     2022-08-08 
11:00:40.436474370 +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#0000e05#a8a8a8255@1|p+0#0000000#ffffff0|r|e|s+0&#e0e0e08|ö|m|e|和*&|平|t+&|é|x|t|p+0&#ffffff0|o|s|t|
 @38
! | +0#0000e05#a8a8a8255@1>e+0#ffffff16#e000002|m|p|t|y| |l|i|n|e| 
+0#0000000#ffffff0@47
  |~+0#4040ff13&| @58
! | +0#0000000&@41|3|,|0|-|1| @8|A|l@1| 
--- 1,8 ----
  | +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#0000e05#a8a8a8255@1|p+0#0000000#ffffff0|r|e|s+0&#e0e0e08|ö|m|e|和*&|平|t+&|é|x|t|p+0&#ffffff0|o|s|t|
 @38
! | +0#0000e05#a8a8a8255@1|F+0#0000000#ffffff0|o@1| |f|o@1| |=| |{| 
|.+0#0000e05&|x|=>1+0#0000000&|,| |.+0#0000e05&|y|=|2+0#0000000&| |}|;| @32
! | +0#0000e05#a8a8a8255@1|e+0#ffffff16#e000002|m|p|t|y| |l|i|n|e| 
+0#0000000#ffffff0@47
  |~+0#4040ff13&| @58
! |~| @58
! | +0#0000000&@41|3|,|1|3|-|1|6| @6|A|l@1| 
*** ../vim-9.0.0167/src/testdir/dumps/Test_prop_inserts_text_5.dump     
2022-08-08 11:06:52.828244365 +0100
--- src/testdir/dumps/Test_prop_inserts_text_5.dump     2022-08-08 
11:00:41.592473735 +0100
***************
*** 0 ****
--- 1,8 ----
+ | +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#0000e05#a8a8a8255@1|p+0#0000000#ffffff0|r|e|s+0&#e0e0e08|ö|m|e|和*&|平|t+&|é|x|t|p+0&#ffffff0|o|s|t|
 @38
+ | +0#0000e05#a8a8a8255@1|F+0#0000000#ffffff0|o@1| |f|o@1| |=| |{| 
|.+0#0000e05&|x|=|1+0#0000000&|,| |.+0#0000e05&|y|=>2+0#0000000&| |}|;| @32
+ | +0#0000e05#a8a8a8255@1|e+0#ffffff16#e000002|m|p|t|y| |l|i|n|e| 
+0#0000000#ffffff0@47
+ |~+0#4040ff13&| @58
+ |~| @58
+ | +0#0000000&@41|3|,|1|6|-|2@1| @6|A|l@1| 
*** ../vim-9.0.0167/src/testdir/dumps/Test_prop_inserts_text_6.dump     
2022-08-08 11:06:52.832244360 +0100
--- src/testdir/dumps/Test_prop_inserts_text_6.dump     2022-08-08 
11:00:42.744473102 +0100
***************
*** 0 ****
--- 1,8 ----
+ | +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#0000e05#a8a8a8255@1|p+0#0000000#ffffff0|r|e|s+0&#e0e0e08|ö|m|e|和*&|平|t+&|é|x|t|p+0&#ffffff0|o|s|t|
 @38
+ | +0#0000e05#a8a8a8255@1|F+0#0000000#ffffff0|o@1| |f|o@1| |=| |{| 
|.+0#0000e05&|x|=|1+0#0000000&|,| |.+0#0000e05&|y|=|2+0#0000000&| |}|;| @32
+ | +0#0000e05#a8a8a8255@1>e+0#ffffff16#e000002|m|p|t|y| |l|i|n|e| 
+0#0000000#ffffff0@47
+ |~+0#4040ff13&| @58
+ |~| @58
+ | +0#0000000&@41|4|,|0|-|1| @8|A|l@1| 
*** ../vim-9.0.0167/src/version.c       2022-08-07 22:04:53.687700914 +0100
--- src/version.c       2022-08-08 11:06:31.400258698 +0100
***************
*** 737,738 ****
--- 737,740 ----
  {   /* Add new patch number below this line */
+ /**/
+     168,
  /**/

-- 
ARTHUR: This new learning amazes me, Sir Bedevere.  Explain again how sheep's
        bladders may be employed to prevent earthquakes.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            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/20220808100932.210B61C0EC3%40moolenaar.net.

Raspunde prin e-mail lui