changeset 13935:cc25795aeec6 v8.0.1838

patch 8.0.1838: cursor in wrong pos when switching to Terminal-Normal mode commit https://github.com/vim/vim/commit/620020eb1d937e1fd9068ee97d5ef70a99913361 Author: Bram Moolenaar <Bram@vim.org> Date: Sun May 13 19:06:12 2018 +0200 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.
author Christian Brabandt <cb@256bit.org>
date Sun, 13 May 2018 19:15:06 +0200
parents f9c70014d5e7
children 692a7c488651
files src/terminal.c src/version.c
diffstat 2 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -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;
@@ -2264,9 +2265,8 @@ theend:
 
     /* 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;
 }
--- a/src/version.c
+++ b/src/version.c
@@ -762,6 +762,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1838,
+/**/
     1837,
 /**/
     1836,