aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/normal.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-07-05 18:48:26 +0800
committerGitHub <noreply@github.com>2022-07-05 18:48:26 +0800
commit2536bde6c9ef5f0a94c0d3789a18a14de6a0a666 (patch)
treea6318dfe0cd8a43ca6c4b6e57d4c68454285e77f /src/nvim/normal.c
parentd0835617facc98daf79318e26d41669bb2ce1a6b (diff)
parent785422ad54b6ce97cdec994862725b2846775e88 (diff)
downloadrneovim-2536bde6c9ef5f0a94c0d3789a18a14de6a0a666.tar.gz
rneovim-2536bde6c9ef5f0a94c0d3789a18a14de6a0a666.tar.bz2
rneovim-2536bde6c9ef5f0a94c0d3789a18a14de6a0a666.zip
Merge pull request #19232 from zeertzjq/vim-8.2.2904
vim-patch:8.2.{2904,3644.3980,3990}: three Normal mode fixes
Diffstat (limited to 'src/nvim/normal.c')
-rw-r--r--src/nvim/normal.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index c7f7b569e7..ed624c0c9f 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -2494,21 +2494,30 @@ static void prep_redo_cmd(cmdarg_T *cap)
/// Note that only the last argument can be a multi-byte char.
void prep_redo(int regname, long num, int cmd1, int cmd2, int cmd3, int cmd4, int cmd5)
{
+ prep_redo_num2(regname, num, cmd1, cmd2, 0L, cmd3, cmd4, cmd5);
+}
+
+/// Prepare for redo of any command with extra count after "cmd2".
+void prep_redo_num2(int regname, long num1, int cmd1, int cmd2, long num2, int cmd3, int cmd4,
+ int cmd5)
+{
ResetRedobuff();
if (regname != 0) { // yank from specified buffer
AppendCharToRedobuff('"');
AppendCharToRedobuff(regname);
}
- if (num) {
- AppendNumberToRedobuff(num);
+ if (num1 != 0) {
+ AppendNumberToRedobuff(num1);
}
-
if (cmd1 != NUL) {
AppendCharToRedobuff(cmd1);
}
if (cmd2 != NUL) {
AppendCharToRedobuff(cmd2);
}
+ if (num2 != 0) {
+ AppendNumberToRedobuff(num2);
+ }
if (cmd3 != NUL) {
AppendCharToRedobuff(cmd3);
}
@@ -6157,6 +6166,16 @@ static void nv_g_cmd(cmdarg_T *cap)
i = curwin->w_leftcol + curwin->w_width_inner - col_off - 1;
coladvance((colnr_T)i);
+ // if the character doesn't fit move one back
+ if (curwin->w_cursor.col > 0 && utf_ptr2cells((const char *)get_cursor_pos_ptr()) > 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;