Patch 8.2.4660
Problem:    Cursorcolumn is sometimes not correct.
Solution:   Recompute the cursor column when entering Insert mode and the
            cursor is on a character wider than a screen cell.
Files:      src/edit.c, src/testdir/test_highlight.vim,
            src/testdir/dumps/Test_cursorcolumn_insert_on_tab_1.dump,
            src/testdir/dumps/Test_cursorcolumn_insert_on_tab_2.dump


*** ../vim-8.2.4659/src/edit.c  2022-03-27 19:26:29.330889018 +0100
--- src/edit.c  2022-04-01 12:02:21.147733603 +0100
***************
*** 293,303 ****
      conceal_check_cursor_line(cursor_line_was_concealed);
  #endif
  
!     /*
!      * Need to recompute the cursor position, it might move when the cursor is
!      * on a TAB or special character.
!      */
!     curs_columns(TRUE);
  
      /*
       * Enable langmap or IME, indicated by 'iminsert'.
--- 293,306 ----
      conceal_check_cursor_line(cursor_line_was_concealed);
  #endif
  
!     // Need to recompute the cursor position, it might move when the cursor
!     // is on a TAB or special character.
!     // ptr2cells() treats a TAB character as double-width.
!     if (ptr2cells(ml_get_cursor()) > 1)
!     {
!       curwin->w_valid &= ~VALID_VIRTCOL;
!       curs_columns(TRUE);
!     }
  
      /*
       * Enable langmap or IME, indicated by 'iminsert'.
*** ../vim-8.2.4659/src/testdir/test_highlight.vim      2022-03-27 
19:26:29.334889006 +0100
--- src/testdir/test_highlight.vim      2022-04-01 11:56:13.107951714 +0100
***************
*** 592,597 ****
--- 592,619 ----
    call delete('Xtest_cursorline_with_visualmode')
  endfunc
  
+ func Test_cursorcolumn_insert_on_tab()
+   CheckScreendump
+ 
+   let lines =<< trim END
+     call setline(1, ['123456789', "a\tb"])
+     set cursorcolumn
+     call cursor(2, 2)
+   END
+   call writefile(lines, 'Xcuc_insert_on_tab')
+ 
+   let buf = RunVimInTerminal('-S Xcuc_insert_on_tab', #{rows: 8})
+   call TermWait(buf)
+   call VerifyScreenDump(buf, 'Test_cursorcolumn_insert_on_tab_1', {})
+ 
+   call term_sendkeys(buf, 'i')
+   call TermWait(buf)
+   call VerifyScreenDump(buf, 'Test_cursorcolumn_insert_on_tab_2', {})
+ 
+   call StopVimInTerminal(buf)
+   call delete('Xcuc_insert_on_tab')
+ endfunc
+ 
  func Test_cursorcolumn_callback()
    CheckScreendump
    CheckFeature timers
*** ../vim-8.2.4659/src/testdir/dumps/Test_cursorcolumn_insert_on_tab_1.dump    
2022-04-01 12:04:11.967653113 +0100
--- src/testdir/dumps/Test_cursorcolumn_insert_on_tab_1.dump    2022-04-01 
11:56:13.107951714 +0100
***************
*** 0 ****
--- 1,8 ----
+ |1+0&#ffffff0|2|3|4|5|6|7|8+0&#e0e0e08|9+0&#ffffff0| @65
+ |a| @5> |b| @65
+ |~+0#4040ff13&| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ | +0#0000000&@56|2|,|2|-|8| @8|A|l@1| 
*** ../vim-8.2.4659/src/testdir/dumps/Test_cursorcolumn_insert_on_tab_2.dump    
2022-04-01 12:04:11.971653108 +0100
--- src/testdir/dumps/Test_cursorcolumn_insert_on_tab_2.dump    2022-04-01 
11:56:13.107951714 +0100
***************
*** 0 ****
--- 1,8 ----
+ |1+0&#ffffff0|2+0&#e0e0e08|3+0&#ffffff0|4|5|6|7|8|9| @65
+ |a> @6|b| @65
+ |~+0#4040ff13&| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |-+2#0000000&@1| |I|N|S|E|R|T| |-@1| +0&&@44|2|,|2| @10|A|l@1| 
*** ../vim-8.2.4659/src/version.c       2022-03-31 21:40:28.893186402 +0100
--- src/version.c       2022-04-01 12:00:13.827818969 +0100
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     4660,
  /**/

-- 
ARTHUR: Charge!
   [They all charge with swords drawn towards the RABBIT.  A tremendous twenty
   second fight with Peckinpahish shots and borrowing heavily also on the
   Kung Fu and karate-type films ensues, in which some four KNIGHTS are
   comprehensively killed.]
ARTHUR: Run away!  Run away!
                 "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/20220401110713.91CEB1C0036%40moolenaar.net.

Raspunde prin e-mail lui