mirror of
https://github.com/neovim/neovim.git
synced 2025-09-30 23:18:33 +00:00
Merge pull request #16418 from zeertzjq/terminal-coladvance
fix(terminal): use coladvance() to calculate buffer cursor position
This commit is contained in:
@@ -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);
|
||||
|
@@ -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.
|
||||
|
Reference in New Issue
Block a user