Patch 9.0.0200
Problem:    cursor in a wrong positoin if 'wrap' is off and using two right
            aligned text props in one line.
Solution:   Count an extra line for a right aligned text property after a
            below or right aligned text property. (issue #10909)
Files:      src/textprop.c, src/testdir/test_textprop.vim,
            src/testdir/dumps/Test_prop_with_text_after_nowrap_1.dump,
            src/testdir/dumps/Test_prop_with_text_after_nowrap_2.dump,
            src/testdir/dumps/Test_prop_with_text_after_nowrap_3.dump


*** ../vim-9.0.0199/src/textprop.c      2022-08-12 13:05:27.567326156 +0100
--- src/textprop.c      2022-08-13 19:32:49.956152148 +0100
***************
*** 590,595 ****
--- 590,597 ----
  
  /*
   * Return the number of text properties with "below" alignment in line "lnum".
+  * A "right" aligned property also goes below after a "below" or other "right"
+  * aligned property.
   */
      int
  prop_count_below(buf_T *buf, linenr_T lnum)
***************
*** 599,612 ****
      int               result = 0;
      textprop_T        prop;
      int               i;
  
      if (count == 0)
        return 0;
      for (i = 0; i < count; ++i)
      {
        mch_memmove(&prop, props + i * sizeof(prop), sizeof(prop));
!       if (prop.tp_col == MAXCOL && (prop.tp_flags & TP_FLAG_ALIGN_BELOW))
!           ++result;
      }
      return result;
  }
--- 601,625 ----
      int               result = 0;
      textprop_T        prop;
      int               i;
+     int               next_right_goes_below = FALSE;
  
      if (count == 0)
        return 0;
      for (i = 0; i < count; ++i)
      {
        mch_memmove(&prop, props + i * sizeof(prop), sizeof(prop));
!       if (prop.tp_col == MAXCOL)
!       {
!           if ((prop.tp_flags & TP_FLAG_ALIGN_BELOW)
!                   || (next_right_goes_below
!                                    && (prop.tp_flags & TP_FLAG_ALIGN_RIGHT)))
!           {
!               next_right_goes_below = TRUE;
!               ++result;
!           }
!           else if (prop.tp_flags & TP_FLAG_ALIGN_RIGHT)
!               next_right_goes_below = TRUE;
!       }
      }
      return result;
  }
*** ../vim-9.0.0199/src/testdir/test_textprop.vim       2022-08-13 
16:40:51.736717691 +0100
--- src/testdir/test_textprop.vim       2022-08-13 19:31:47.884246429 +0100
***************
*** 2743,2749 ****
  
    let lines =<< trim END
        set nowrap
!       call setline(1, ['one', 'two', 'three'])
        call prop_type_add('belowprop', #{highlight: 'ErrorMsg'})
        call prop_type_add('anotherprop', #{highlight: 'Search'})
        call prop_type_add('someprop', #{highlight: 'DiffChange'})
--- 2743,2749 ----
  
    let lines =<< trim END
        set nowrap
!       call setline(1, ['one', 'two', 'three', 'four'])
        call prop_type_add('belowprop', #{highlight: 'ErrorMsg'})
        call prop_type_add('anotherprop', #{highlight: 'Search'})
        call prop_type_add('someprop', #{highlight: 'DiffChange'})
***************
*** 2752,2766 ****
        call prop_add(2, 0, #{type: 'belowprop', text: 'One More Here', 
text_align: 'below'})
        call prop_add(1, 0, #{type: 'someprop', text: 'right here', text_align: 
'right'})
        call prop_add(1, 0, #{type: 'someprop', text: ' After the text', 
text_align: 'after'})
!       normal G$
    END
    call writefile(lines, 'XscriptPropsAfterNowrap')
!   let buf = RunVimInTerminal('-S XscriptPropsAfterNowrap', #{rows: 10, cols: 
60})
    call VerifyScreenDump(buf, 'Test_prop_with_text_after_nowrap_1', {})
  
    call term_sendkeys(buf, ":set signcolumn=yes foldcolumn=3\<CR>")
    call VerifyScreenDump(buf, 'Test_prop_with_text_after_nowrap_2', {})
  
    call StopVimInTerminal(buf)
    call delete('XscriptPropsAfterNowrap')
  endfunc
--- 2752,2772 ----
        call prop_add(2, 0, #{type: 'belowprop', text: 'One More Here', 
text_align: 'below'})
        call prop_add(1, 0, #{type: 'someprop', text: 'right here', text_align: 
'right'})
        call prop_add(1, 0, #{type: 'someprop', text: ' After the text', 
text_align: 'after'})
!       normal 3G$
! 
!       call prop_add(3, 0, #{type: 'anotherprop', text: 'right aligned', 
text_align: 'right'})
!       call prop_add(3, 0, #{type: 'anotherprop', text: 'also right aligned', 
text_align: 'right'})
    END
    call writefile(lines, 'XscriptPropsAfterNowrap')
!   let buf = RunVimInTerminal('-S XscriptPropsAfterNowrap', #{rows: 12, cols: 
60})
    call VerifyScreenDump(buf, 'Test_prop_with_text_after_nowrap_1', {})
  
    call term_sendkeys(buf, ":set signcolumn=yes foldcolumn=3\<CR>")
    call VerifyScreenDump(buf, 'Test_prop_with_text_after_nowrap_2', {})
  
+   call term_sendkeys(buf, "j")
+   call VerifyScreenDump(buf, 'Test_prop_with_text_after_nowrap_3', {})
+ 
    call StopVimInTerminal(buf)
    call delete('XscriptPropsAfterNowrap')
  endfunc
*** ../vim-9.0.0199/src/testdir/dumps/Test_prop_with_text_after_nowrap_1.dump   
2022-08-06 17:38:47.120785704 +0100
--- src/testdir/dumps/Test_prop_with_text_after_nowrap_1.dump   2022-08-13 
19:28:39.228558282 +0100
***************
*** 3,9 ****
  |t|w|o| @56
  |a+0&#ffff4012|n|o|t|h|e|r| +0&#ffffff0@52
  |O+0#ffffff16#e000002|n|e| |M|o|r|e| |H|e|r|e| +0#0000000#ffffff0@46
! |t|h|r|e>e| @54
  |~+0#4040ff13&| @58
  |~| @58
  |~| @58
--- 3,11 ----
  |t|w|o| @56
  |a+0&#ffff4012|n|o|t|h|e|r| +0&#ffffff0@52
  |O+0#ffffff16#e000002|n|e| |M|o|r|e| |H|e|r|e| +0#0000000#ffffff0@46
! |t|h|r|e>e| @41|r+0&#ffff4012|i|g|h|t| |a|l|i|g|n|e|d
! | +0&#ffffff0@41|a+0&#ffff4012|l|s|o| |r|i|g|h|t| |a|l|i|g|n|e|d
! |f+0&#ffffff0|o|u|r| @55
  |~+0#4040ff13&| @58
  |~| @58
  |~| @58
*** ../vim-9.0.0199/src/testdir/dumps/Test_prop_with_text_after_nowrap_2.dump   
2022-08-06 17:38:47.120785704 +0100
--- src/testdir/dumps/Test_prop_with_text_after_nowrap_2.dump   2022-08-13 
19:28:40.380556243 +0100
***************
*** 3,9 ****
  | +0#0000e05#a8a8a8255@4|t+0#0000000#ffffff0|w|o| @51
  | +0#0000e05#a8a8a8255@4|a+0#0000000#ffff4012|n|o|t|h|e|r| +0&#ffffff0@47
  | +0#0000e05#a8a8a8255@4|O+0#ffffff16#e000002|n|e| |M|o|r|e| |H|e|r|e| 
+0#0000000#ffffff0@41
! | +0#0000e05#a8a8a8255@4|t+0#0000000#ffffff0|h|r|e>e| @49
  |~+0#4040ff13&| @58
  |~| @58
  |~| @58
--- 3,11 ----
  | +0#0000e05#a8a8a8255@4|t+0#0000000#ffffff0|w|o| @51
  | +0#0000e05#a8a8a8255@4|a+0#0000000#ffff4012|n|o|t|h|e|r| +0&#ffffff0@47
  | +0#0000e05#a8a8a8255@4|O+0#ffffff16#e000002|n|e| |M|o|r|e| |H|e|r|e| 
+0#0000000#ffffff0@41
! | +0#0000e05#a8a8a8255@4|t+0#0000000#ffffff0|h|r|e>e| 
@36|r+0&#ffff4012|i|g|h|t| |a|l|i|g|n|e|d
! | +0#0000e05#a8a8a8255@4| +0#0000000#ffffff0@36|a+0&#ffff4012|l|s|o| 
|r|i|g|h|t| |a|l|i|g|n|e|d
! | +0#0000e05#a8a8a8255@4|f+0#0000000#ffffff0|o|u|r| @50
  |~+0#4040ff13&| @58
  |~| @58
  |~| @58
*** ../vim-9.0.0199/src/testdir/dumps/Test_prop_with_text_after_nowrap_3.dump   
2022-08-13 19:33:35.280085441 +0100
--- src/testdir/dumps/Test_prop_with_text_after_nowrap_3.dump   2022-08-13 
19:31:53.412237888 +0100
***************
*** 0 ****
--- 1,12 ----
+ | +0#0000e05#a8a8a8255@4|o+0#0000000#ffffff0|n|e| +0&#ffd7ff255|A|f|t|e|r| 
|t|h|e| |t|e|x|t| +0&#ffffff0@26|r+0&#ffd7ff255|i|g|h|t| |h|e|r|e
+ | +0#0000e05#a8a8a8255@4| +0#ffffff16#e000002|B|e|l|o|w| |t|h|e| |l|i|n|e| | 
+0#0000000#ffffff0@38
+ | +0#0000e05#a8a8a8255@4|t+0#0000000#ffffff0|w|o| @51
+ | +0#0000e05#a8a8a8255@4|a+0#0000000#ffff4012|n|o|t|h|e|r| +0&#ffffff0@47
+ | +0#0000e05#a8a8a8255@4|O+0#ffffff16#e000002|n|e| |M|o|r|e| |H|e|r|e| 
+0#0000000#ffffff0@41
+ | +0#0000e05#a8a8a8255@4|t+0#0000000#ffffff0|h|r|e@1| 
@36|r+0&#ffff4012|i|g|h|t| |a|l|i|g|n|e|d
+ | +0#0000e05#a8a8a8255@4| +0#0000000#ffffff0@36|a+0&#ffff4012|l|s|o| 
|r|i|g|h|t| |a|l|i|g|n|e|d
+ | +0#0000e05#a8a8a8255@4|f+0#0000000#ffffff0|o|u>r| @50
+ |~+0#4040ff13&| @58
+ |~| @58
+ |~| @58
+ | +0#0000000&@41|4|,|4| @10|A|l@1| 
*** ../vim-9.0.0199/src/version.c       2022-08-13 16:40:51.736717691 +0100
--- src/version.c       2022-08-13 18:18:18.448627406 +0100
***************
*** 737,738 ****
--- 737,740 ----
  {   /* Add new patch number below this line */
+ /**/
+     200,
  /**/

-- 
Not too long ago, cut and paste was done with scissors and glue...

 /// 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/20220813183554.8976C1C091A%40moolenaar.net.

Raspunde prin e-mail lui