comparison src/terminal.c @ 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 bfca3dbdbf9e
children 300aab3275c0
comparison
equal deleted inserted replaced
13934:f9c70014d5e7 13935:cc25795aeec6
1707 /* Move the window cursor to the position of the cursor in the 1707 /* Move the window cursor to the position of the cursor in the
1708 * terminal. */ 1708 * terminal. */
1709 curwin->w_cursor.lnum = term->tl_scrollback_scrolled 1709 curwin->w_cursor.lnum = term->tl_scrollback_scrolled
1710 + term->tl_cursor_pos.row + 1; 1710 + term->tl_cursor_pos.row + 1;
1711 check_cursor(); 1711 check_cursor();
1712 coladvance(term->tl_cursor_pos.col); 1712 if (coladvance(term->tl_cursor_pos.col) == FAIL)
1713 coladvance(MAXCOL);
1713 1714
1714 /* Display the same lines as in the terminal. */ 1715 /* Display the same lines as in the terminal. */
1715 curwin->w_topline = term->tl_scrollback_scrolled + 1; 1716 curwin->w_topline = term->tl_scrollback_scrolled + 1;
1716 } 1717 }
1717 1718
2262 if (restore_cursor) 2263 if (restore_cursor)
2263 prepare_restore_cursor_props(); 2264 prepare_restore_cursor_props();
2264 2265
2265 /* Move a snapshot of the screen contents to the buffer, so that completion 2266 /* Move a snapshot of the screen contents to the buffer, so that completion
2266 * works in other buffers. */ 2267 * works in other buffers. */
2267 if (curbuf->b_term != NULL) 2268 if (curbuf->b_term != NULL && !curbuf->b_term->tl_normal_mode)
2268 may_move_terminal_to_buffer( 2269 may_move_terminal_to_buffer(curbuf->b_term, FALSE);
2269 curbuf->b_term, curbuf->b_term->tl_normal_mode);
2270 2270
2271 return ret; 2271 return ret;
2272 } 2272 }
2273 2273
2274 /* 2274 /*