diff options
author | zeertzjq <zeertzjq@outlook.com> | 2021-12-08 08:11:27 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2021-12-08 08:11:27 +0800 |
commit | 2784a5d3d28004f95dfd4e31a825722440437fe1 (patch) | |
tree | 653ab96b55a1f177ed3f439fe09c28d62b8050f9 /src | |
parent | be768be6b7ee896277971593e9287a86bc41efb2 (diff) | |
download | rneovim-2784a5d3d28004f95dfd4e31a825722440437fe1.tar.gz rneovim-2784a5d3d28004f95dfd4e31a825722440437fe1.tar.bz2 rneovim-2784a5d3d28004f95dfd4e31a825722440437fe1.zip |
fix(terminal): use coladvance() to calculate buffer cursor position
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/cursor.c | 1 | ||||
-rw-r--r-- | src/nvim/terminal.c | 5 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/nvim/cursor.c b/src/nvim/cursor.c index e334fd166e..4e1d7f9d78 100644 --- a/src/nvim/cursor.c +++ b/src/nvim/cursor.c @@ -108,6 +108,7 @@ static int coladvance2(pos_T *pos, bool addspaces, bool finetune, colnr_T wcol_a int head = 0; one_more = (State & INSERT) + || (State & TERM_FOCUS) || restart_edit != NUL || (VIsual_active && *p_sel != 'o') || ((ve_flags & VE_ONEMORE) && wcol < MAXCOL); diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c index 83ade74db1..afebda4948 100644 --- a/src/nvim/terminal.c +++ b/src/nvim/terminal.c @@ -46,6 +46,7 @@ #include "nvim/ascii.h" #include "nvim/buffer.h" #include "nvim/change.h" +#include "nvim/cursor.h" #include "nvim/edit.h" #include "nvim/event/loop.h" #include "nvim/event/time.h" @@ -464,9 +465,7 @@ static void terminal_check_cursor(void) row_to_linenr(term, term->cursor.row)); // Nudge cursor when returning to normal-mode. int off = is_focused(term) ? 0 : (curwin->w_p_rl ? 1 : -1); - curwin->w_cursor.col = MAX(0, term->cursor.col + win_col_off(curwin) + off); - curwin->w_cursor.coladd = 0; - mb_check_adjust_col(curwin); + coladvance(MAX(0, term->cursor.col + off)); } // Function executed before each iteration of terminal mode. |