Skip to content

Commit 620020e

Browse files
committed
patch 8.0.1838: cursor in wrong pos when switching to Terminal-Normal mode
Problem: Cursor in wrong position when switching to Terminal-Normal mode. (Dominique Pelle) Solution: Move to the end of the line if coladvance() fails. Do not take a snapshot a second time.
1 parent 5e3423d commit 620020e

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/terminal.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1709,7 +1709,8 @@ term_enter_normal_mode(void)
17091709
curwin->w_cursor.lnum = term->tl_scrollback_scrolled
17101710
+ term->tl_cursor_pos.row + 1;
17111711
check_cursor();
1712-
coladvance(term->tl_cursor_pos.col);
1712+
if (coladvance(term->tl_cursor_pos.col) == FAIL)
1713+
coladvance(MAXCOL);
17131714

17141715
/* Display the same lines as in the terminal. */
17151716
curwin->w_topline = term->tl_scrollback_scrolled + 1;
@@ -2264,9 +2265,8 @@ terminal_loop(int blocking)
22642265

22652266
/* Move a snapshot of the screen contents to the buffer, so that completion
22662267
* works in other buffers. */
2267-
if (curbuf->b_term != NULL)
2268-
may_move_terminal_to_buffer(
2269-
curbuf->b_term, curbuf->b_term->tl_normal_mode);
2268+
if (curbuf->b_term != NULL && !curbuf->b_term->tl_normal_mode)
2269+
may_move_terminal_to_buffer(curbuf->b_term, FALSE);
22702270

22712271
return ret;
22722272
}

src/version.c

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

762762
static int included_patches[] =
763763
{ /* Add new patch number below this line */
764+
/**/
765+
1838,
764766
/**/
765767
1837,
766768
/**/

0 commit comments

Comments
 (0)