diff src/normal.c @ 26094:f53f365078dd v8.2.3580

patch 8.2.3580: gj does not move properly with a wide character Commit: https://github.com/vim/vim/commit/aaec1d4fb12efb82b87ad322e95994de77b1a833 Author: Christian Brabandt <cb@256bit.org> Date: Thu Nov 4 13:28:29 2021 +0000 patch 8.2.3580: gj does not move properly with a wide character Problem: gj does not move properly with a wide character. Solution: Move one to the right. (Christian Brabandt, closes https://github.com/vim/vim/issues/8702)
author Bram Moolenaar <Bram@vim.org>
date Thu, 04 Nov 2021 14:30:03 +0100
parents 6b39ab99e367
children 5317b0ae4893
line wrap: on
line diff
--- a/src/normal.c
+++ b/src/normal.c
@@ -2530,7 +2530,7 @@ nv_screengo(oparg_T *oap, int dir, long 
     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
+    int		width2;		// text width for wrapped screen line
 
     oap->motion_type = MCHAR;
     oap->inclusive = (curwin->w_curswant == MAXCOL);
@@ -2656,6 +2656,7 @@ nv_screengo(oparg_T *oap, int dir, long 
     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,6 +2670,12 @@ nv_screengo(oparg_T *oap, int dir, long 
 	    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)