Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
26093:3284f1db4475 | 26094:f53f365078dd |
---|---|
2528 int atend = FALSE; | 2528 int atend = FALSE; |
2529 int n; | 2529 int n; |
2530 int col_off1; // margin offset for first screen line | 2530 int col_off1; // margin offset for first screen line |
2531 int col_off2; // margin offset for wrapped screen line | 2531 int col_off2; // margin offset for wrapped screen line |
2532 int width1; // text width for first screen line | 2532 int width1; // text width for first screen line |
2533 int width2; // test width for wrapped screen line | 2533 int width2; // text width for wrapped screen line |
2534 | 2534 |
2535 oap->motion_type = MCHAR; | 2535 oap->motion_type = MCHAR; |
2536 oap->inclusive = (curwin->w_curswant == MAXCOL); | 2536 oap->inclusive = (curwin->w_curswant == MAXCOL); |
2537 | 2537 |
2538 col_off1 = curwin_col_off(); | 2538 col_off1 = curwin_col_off(); |
2654 coladvance(curwin->w_curswant); | 2654 coladvance(curwin->w_curswant); |
2655 | 2655 |
2656 if (curwin->w_cursor.col > 0 && curwin->w_p_wrap) | 2656 if (curwin->w_cursor.col > 0 && curwin->w_p_wrap) |
2657 { | 2657 { |
2658 colnr_T virtcol; | 2658 colnr_T virtcol; |
2659 int c; | |
2659 | 2660 |
2660 /* | 2661 /* |
2661 * Check for landing on a character that got split at the end of the | 2662 * Check for landing on a character that got split at the end of the |
2662 * last line. We want to advance a screenline, not end up in the same | 2663 * last line. We want to advance a screenline, not end up in the same |
2663 * screenline or move two screenlines. | 2664 * screenline or move two screenlines. |
2666 virtcol = curwin->w_virtcol; | 2667 virtcol = curwin->w_virtcol; |
2667 #if defined(FEAT_LINEBREAK) | 2668 #if defined(FEAT_LINEBREAK) |
2668 if (virtcol > (colnr_T)width1 && *get_showbreak_value(curwin) != NUL) | 2669 if (virtcol > (colnr_T)width1 && *get_showbreak_value(curwin) != NUL) |
2669 virtcol -= vim_strsize(get_showbreak_value(curwin)); | 2670 virtcol -= vim_strsize(get_showbreak_value(curwin)); |
2670 #endif | 2671 #endif |
2672 | |
2673 c = (*mb_ptr2char)(ml_get_cursor()); | |
2674 if (dir == FORWARD && virtcol < curwin->w_curswant | |
2675 && (curwin->w_curswant <= (colnr_T)width1) | |
2676 && !vim_isprintc(c) && c > 255) | |
2677 oneright(); | |
2671 | 2678 |
2672 if (virtcol > curwin->w_curswant | 2679 if (virtcol > curwin->w_curswant |
2673 && (curwin->w_curswant < (colnr_T)width1 | 2680 && (curwin->w_curswant < (colnr_T)width1 |
2674 ? (curwin->w_curswant > (colnr_T)width1 / 2) | 2681 ? (curwin->w_curswant > (colnr_T)width1 / 2) |
2675 : ((curwin->w_curswant - width1) % width2 | 2682 : ((curwin->w_curswant - width1) % width2 |