Skip to content

Commit 0e23e9c

Browse files
committed
patch 8.0.0819: cursor not positioned in terminal window
Problem: After changing current window the cursor position in the terminal window is not updated. Solution: Set w_wrow, w_wcol and w_valid.
1 parent 9787000 commit 0e23e9c

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

src/terminal.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -857,6 +857,14 @@ send_keys_to_term(term_T *term, int c, int typed)
857857
return OK;
858858
}
859859

860+
static void
861+
position_cursor(win_T *wp, VTermPos *pos)
862+
{
863+
wp->w_wrow = MIN(pos->row, MAX(0, wp->w_height - 1));
864+
wp->w_wcol = MIN(pos->col, MAX(0, wp->w_width - 1));
865+
wp->w_valid |= (VALID_WCOL|VALID_WROW);
866+
}
867+
860868
/*
861869
* Returns TRUE if the current window contains a terminal and we are sending
862870
* keys to the job.
@@ -887,6 +895,7 @@ terminal_loop(void)
887895

888896
if (*curwin->w_p_tk != NUL)
889897
termkey = string_to_key(curwin->w_p_tk, TRUE);
898+
position_cursor(curwin, &curbuf->b_term->tl_cursor_pos);
890899

891900
for (;;)
892901
{
@@ -971,13 +980,6 @@ term_job_ended(job_T *job)
971980
}
972981
}
973982

974-
static void
975-
position_cursor(win_T *wp, VTermPos *pos)
976-
{
977-
wp->w_wrow = MIN(pos->row, MAX(0, wp->w_height - 1));
978-
wp->w_wcol = MIN(pos->col, MAX(0, wp->w_width - 1));
979-
}
980-
981983
static void
982984
may_toggle_cursor(term_T *term)
983985
{

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,8 @@ static char *(features[]) =
769769

770770
static int included_patches[] =
771771
{ /* Add new patch number below this line */
772+
/**/
773+
819,
772774
/**/
773775
818,
774776
/**/

0 commit comments

Comments
 (0)