Mercurial > vim
diff src/normal.c @ 24731:a6a4224902f5 v8.2.2904
patch 8.2.2904: "g$" causes scroll if half a double width char is visible
Commit: https://github.com/vim/vim/commit/74ede80aeb272ac81d41a256057c4f250372dd00
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat May 29 19:18:01 2021 +0200
patch 8.2.2904: "g$" causes scroll if half a double width char is visible
Problem: "g$" causes scroll if half a double width char is visible.
Solution: Advance to the last fully visible character. (closes https://github.com/vim/vim/issues/8254)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 29 May 2021 19:30:03 +0200 |
parents | b7f58be68c02 |
children | 1ce39e257f1b |
line wrap: on
line diff
--- a/src/normal.c +++ b/src/normal.c @@ -6144,6 +6144,17 @@ nv_g_cmd(cmdarg_T *cap) i = curwin->w_leftcol + curwin->w_width - col_off - 1; coladvance((colnr_T)i); + // if the character doesn't fit move one back + if (curwin->w_cursor.col > 0 + && (*mb_ptr2cells)(ml_get_cursor()) > 1) + { + colnr_T vcol; + + getvvcol(curwin, &curwin->w_cursor, NULL, NULL, &vcol); + if (vcol >= curwin->w_leftcol + curwin->w_width - col_off) + --curwin->w_cursor.col; + } + // Make sure we stick in this column. validate_virtcol(); curwin->w_curswant = curwin->w_virtcol;