To: vim_dev@googlegroups.com Subject: Patch 8.2.3580 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3580 Problem: gj does not move properly with a wide character. Solution: Move one to the right. (Christian Brabandt, closes #8702) Files: src/normal.c, src/testdir/test_normal.vim *** ../vim-8.2.3579/src/normal.c 2021-10-22 18:55:40.818752232 +0100 --- src/normal.c 2021-11-04 13:27:47.397563387 +0000 *************** *** 2530,2536 **** int col_off1; // margin offset for first screen line int col_off2; // margin offset for wrapped screen line int width1; // text width for first screen line ! int width2; // test width for wrapped screen line oap->motion_type = MCHAR; oap->inclusive = (curwin->w_curswant == MAXCOL); --- 2530,2536 ---- int col_off1; // margin offset for first screen line int col_off2; // margin offset for wrapped screen line int width1; // text width for first screen line ! int width2; // text width for wrapped screen line oap->motion_type = MCHAR; oap->inclusive = (curwin->w_curswant == MAXCOL); *************** *** 2656,2661 **** --- 2656,2662 ---- if (curwin->w_cursor.col > 0 && curwin->w_p_wrap) { colnr_T virtcol; + int c; /* * Check for landing on a character that got split at the end of the *************** *** 2669,2674 **** --- 2670,2681 ---- virtcol -= vim_strsize(get_showbreak_value(curwin)); #endif + c = (*mb_ptr2char)(ml_get_cursor()); + if (dir == FORWARD && virtcol < curwin->w_curswant + && (curwin->w_curswant <= (colnr_T)width1) + && !vim_isprintc(c) && c > 255) + oneright(); + if (virtcol > curwin->w_curswant && (curwin->w_curswant < (colnr_T)width1 ? (curwin->w_curswant > (colnr_T)width1 / 2) *** ../vim-8.2.3579/src/testdir/test_normal.vim 2021-10-25 17:07:00.308768588 +0100 --- src/testdir/test_normal.vim 2021-11-04 13:25:15.171206795 +0000 *************** *** 3423,3426 **** --- 3423,3438 ---- bw! endfunc + func Test_normal_gj_on_extra_wide_char() + new | 25vsp + let text='1 foooooooo ar e ins‍zwe1 foooooooo ins‍zwei' . + \ ' i drei vier fünf sechs sieben acht un zehn elf zwöfl' . + \ ' dreizehn v ierzehn fünfzehn' + put =text + call cursor(2,1) + norm! gj + call assert_equal([0,2,25,0], getpos('.')) + bw! + endfunc + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-8.2.3579/src/version.c 2021-11-03 22:31:41.214956741 +0000 --- src/version.c 2021-11-04 13:26:38.388336582 +0000 *************** *** 759,760 **** --- 759,762 ---- { /* Add new patch number below this line */ + /**/ + 3580, /**/ -- GALAHAD: No, please. Please! I can defeat them! There's only a hundred. GIRLS: He will beat us easily. We haven't a chance. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// 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 ///