diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-09-16 20:51:14 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-09-16 20:51:14 +0100 |
commit | e24b4aba1fbf782954897abdbfc084c4221428eb (patch) | |
tree | 96aed827f612301272d266430fe4afb827fbb483 /src/normal.c | |
parent | 8fa745e7be3a791ac25f93ef0227bbc48ade8a37 (diff) | |
download | vim-git-e24b4aba1fbf782954897abdbfc084c4221428eb.tar.gz |
patch 9.0.0482: "g0" moves to wrong location with virtual text "above"v9.0.0482
Problem: "g0" moves to wrong location with virtual text "above".
Solution: Compensate for the extra columns. (closes #11141) Also fix "g$"
Diffstat (limited to 'src/normal.c')
-rw-r--r-- | src/normal.c | 48 |
1 files changed, 29 insertions, 19 deletions
diff --git a/src/normal.c b/src/normal.c index 8351685d1..35f7610c3 100644 --- a/src/normal.c +++ b/src/normal.c @@ -5491,9 +5491,8 @@ nv_visual(cmdarg_T *cap) { if (resel_VIsual_line_count <= 1) { - validate_virtcol(); - curwin->w_curswant = curwin->w_virtcol - + resel_VIsual_vcol * cap->count0 - 1; + update_curswant_force(); + curwin->w_curswant += resel_VIsual_vcol * cap->count0 - 1; } else curwin->w_curswant = resel_VIsual_vcol; @@ -5506,9 +5505,8 @@ nv_visual(cmdarg_T *cap) } else if (VIsual_mode == Ctrl_V) { - validate_virtcol(); - curwin->w_curswant = curwin->w_virtcol - + resel_VIsual_vcol * cap->count0 - 1; + update_curswant_force(); + curwin->w_curswant += + resel_VIsual_vcol * cap->count0 - 1; coladvance(curwin->w_curswant); } else @@ -5735,13 +5733,19 @@ nv_g_home_m_cmd(cmdarg_T *cap) cap->oap->inclusive = FALSE; if (curwin->w_p_wrap && curwin->w_width != 0) { - int width1 = curwin->w_width - curwin_col_off(); - int width2 = width1 + curwin_col_off2(); + int width1 = curwin->w_width - curwin_col_off(); + int width2 = width1 + curwin_col_off2(); + int virtcol; validate_virtcol(); + virtcol = curwin->w_virtcol +#ifdef FEAT_PROP_POPUP + - curwin->w_virtcol_first_char +#endif + ; i = 0; - if (curwin->w_virtcol >= (colnr_T)width1 && width2 > 0) - i = (curwin->w_virtcol - width1) / width2 * width2 + width1; + if (virtcol >= (colnr_T)width1 && width2 > 0) + i = (virtcol - width1) / width2 * width2 + width1; } else i = curwin->w_leftcol; @@ -5815,24 +5819,32 @@ nv_g_dollar_cmd(cmdarg_T *cap) { int width1 = curwin->w_width - col_off; int width2 = width1 + curwin_col_off2(); + int virtcol; validate_virtcol(); + virtcol = curwin->w_virtcol +#ifdef FEAT_PROP_POPUP + - curwin->w_virtcol_first_char +#endif + ; i = width1 - 1; - if (curwin->w_virtcol >= (colnr_T)width1) - i += ((curwin->w_virtcol - width1) / width2 + 1) + if (virtcol >= (colnr_T)width1) + i += ((virtcol - width1) / width2 + 1) * width2; coladvance((colnr_T)i); // Make sure we stick in this column. - validate_virtcol(); - curwin->w_curswant = curwin->w_virtcol; - curwin->w_set_curswant = FALSE; + update_curswant_force(); if (curwin->w_cursor.col > 0 && curwin->w_p_wrap) { // Check for landing on a character that got split at // the end of the line. We do not want to advance to // the next screen line. - if (curwin->w_virtcol > (colnr_T)i) + if (curwin->w_virtcol +#ifdef FEAT_PROP_POPUP + - curwin->w_virtcol_first_char +#endif + > (colnr_T)i) --curwin->w_cursor.col; } } @@ -5860,9 +5872,7 @@ nv_g_dollar_cmd(cmdarg_T *cap) } // Make sure we stick in this column. - validate_virtcol(); - curwin->w_curswant = curwin->w_virtcol; - curwin->w_set_curswant = FALSE; + update_curswant_force(); } } |