Skip to content

Commit 04e87b7

Browse files
committed
patch 8.0.0290: cursor positioning wrong if wide character wraps
Problem: If a wide character doesn't fit at the end of the screen line, and the line doesn't fit on the screen, then the cursor position may be wrong. (anliting) Solution: Don't skip over wide character. (Christian Brabandt, closes #1408)
1 parent 21d7c9b commit 04e87b7

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/screen.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2903,7 +2903,7 @@ win_line(
29032903
int endrow,
29042904
int nochange UNUSED) /* not updating for changed text */
29052905
{
2906-
int col; /* visual column on screen */
2906+
int col = 0; /* visual column on screen */
29072907
unsigned off; /* offset in ScreenLines/ScreenAttrs */
29082908
int c = 0; /* init for GCC */
29092909
long vcol = 0; /* virtual column (for tabs) */
@@ -3429,7 +3429,11 @@ win_line(
34293429
#else
34303430
--ptr;
34313431
#endif
3432-
n_skip = v - vcol;
3432+
#ifdef FEAT_MBYTE
3433+
/* character fits on the screen, don't need to skip it */
3434+
if ((*mb_ptr2cells)(ptr) >= c && col == 0)
3435+
#endif
3436+
n_skip = v - vcol;
34333437
}
34343438

34353439
/*

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
290,
767769
/**/
768770
289,
769771
/**/

0 commit comments

Comments
 (0)