Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
brammool committed May 13, 2018
1 parent 5e3423d commit 620020e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/terminal.c
Expand Up @@ -1709,7 +1709,8 @@ term_enter_normal_mode(void)
curwin->w_cursor.lnum = term->tl_scrollback_scrolled
+ term->tl_cursor_pos.row + 1;
check_cursor();
coladvance(term->tl_cursor_pos.col);
if (coladvance(term->tl_cursor_pos.col) == FAIL)
coladvance(MAXCOL);

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

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

return ret;
}
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -761,6 +761,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1838,
/**/
1837,
/**/
Expand Down

0 comments on commit 620020e

Please sign in to comment.