diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-05-13 19:06:12 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-05-13 19:06:12 +0200 |
commit | 620020eb1d937e1fd9068ee97d5ef70a99913361 (patch) | |
tree | 3b8f0868e31cd1afb484995756e9bb6de0f7b4cf /src/terminal.c | |
parent | 5e3423d192bfa502c6704f731fa2ec6821f9a2f0 (diff) | |
download | vim-git-620020eb1d937e1fd9068ee97d5ef70a99913361.tar.gz |
patch 8.0.1838: cursor in wrong pos when switching to Terminal-Normal modev8.0.1838
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.
Diffstat (limited to 'src/terminal.c')
-rw-r--r-- | src/terminal.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/terminal.c b/src/terminal.c index e670161fb..282f98102 100644 --- 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; } |