To: vim_dev@googlegroups.com Subject: Patch 8.2.3903 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3903 Problem: "gM" does not count tabs as expected. Solution: Use linetabsize() instead of mb_string2cells(). (closes #9409) Files: src/normal.c, src/testdir/test_normal.vim *** ../vim-8.2.3902/src/normal.c 2021-12-13 13:11:00.692262343 +0000 --- src/normal.c 2021-12-26 14:30:28.969244898 +0000 *************** *** 6122,6135 **** case 'M': { - char_u *ptr = ml_get_curline(); - oap->motion_type = MCHAR; oap->inclusive = FALSE; ! if (has_mbyte) ! i = mb_string2cells(ptr, (int)STRLEN(ptr)); ! else ! i = (int)STRLEN(ptr); if (cap->count0 > 0 && cap->count0 <= 100) coladvance((colnr_T)(i * cap->count0 / 100)); else --- 6122,6130 ---- case 'M': { oap->motion_type = MCHAR; oap->inclusive = FALSE; ! i = linetabsize(ml_get_curline()); if (cap->count0 > 0 && cap->count0 <= 100) coladvance((colnr_T)(i * cap->count0 / 100)); else *** ../vim-8.2.3902/src/testdir/test_normal.vim 2021-12-26 10:51:33.711079465 +0000 --- src/testdir/test_normal.vim 2021-12-26 14:38:38.680470721 +0000 *************** *** 2580,2586 **** --- 2580,2594 ---- call assert_equal(87, col('.')) call assert_equal('E', getreg(0)) + " Test for gM with Tab characters + call setline('.', "\ta\tb\tc\td\te\tf") + norm! gMyl + call assert_equal(6, col('.')) + call assert_equal("c", getreg(0)) + " Test for g Ctrl-G + call setline('.', lineC) + norm! 60gMyl set ff=unix let a=execute(":norm! g\") call assert_match('Col 87 of 144; Line 2 of 2; Word 1 of 1; Byte 88 of 146', a) *** ../vim-8.2.3902/src/version.c 2021-12-26 14:22:55.665931067 +0000 --- src/version.c 2021-12-26 14:31:28.881151409 +0000 *************** *** 751,752 **** --- 751,754 ---- { /* Add new patch number below this line */ + /**/ + 3903, /**/ -- hundred-and-one symptoms of being an internet addict: 113. You are asked about a bus schedule, you wonder if it is 16 or 32 bits. /// Bram Moolenaar -- Bram@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 ///