Mercurial > vim
comparison src/terminal.c @ 13900:f71ed35527eb v8.0.1821
patch 8.0.1821: cursor in terminal window moves when pressing CTRL-W
commit https://github.com/vim/vim/commit/2bc799579d06936968fa00e52b79ddd4eaca7678
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat May 12 20:36:24 2018 +0200
patch 8.0.1821: cursor in terminal window moves when pressing CTRL-W
Problem: Cursor in terminal window moves when pressing CTRL-W. (Dominique
Pelle)
Solution: Do not more the cursor or redraw when not in Terminal-Normal mode.
(closes #2904)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 12 May 2018 20:45:04 +0200 |
parents | 3969c9d3a859 |
children | 0ae89b121c58 |
comparison
equal
deleted
inserted
replaced
13899:a22bfa7581f2 | 13900:f71ed35527eb |
---|---|
1604 | 1604 |
1605 /* Obtain the current background color. */ | 1605 /* Obtain the current background color. */ |
1606 vterm_state_get_default_colors(vterm_obtain_state(term->tl_vterm), | 1606 vterm_state_get_default_colors(vterm_obtain_state(term->tl_vterm), |
1607 &term->tl_default_color.fg, &term->tl_default_color.bg); | 1607 &term->tl_default_color.fg, &term->tl_default_color.bg); |
1608 | 1608 |
1609 FOR_ALL_WINDOWS(wp) | 1609 if (term->tl_normal_mode) |
1610 { | 1610 FOR_ALL_WINDOWS(wp) |
1611 if (wp->w_buffer == term->tl_buffer) | 1611 { |
1612 { | 1612 if (wp->w_buffer == term->tl_buffer) |
1613 wp->w_cursor.lnum = term->tl_buffer->b_ml.ml_line_count; | |
1614 wp->w_cursor.col = 0; | |
1615 wp->w_valid = 0; | |
1616 if (wp->w_cursor.lnum >= wp->w_height) | |
1617 { | 1613 { |
1618 linenr_T min_topline = wp->w_cursor.lnum - wp->w_height + 1; | 1614 wp->w_cursor.lnum = term->tl_buffer->b_ml.ml_line_count; |
1619 | 1615 wp->w_cursor.col = 0; |
1620 if (wp->w_topline < min_topline) | 1616 wp->w_valid = 0; |
1621 wp->w_topline = min_topline; | 1617 if (wp->w_cursor.lnum >= wp->w_height) |
1618 { | |
1619 linenr_T min_topline = wp->w_cursor.lnum - wp->w_height + 1; | |
1620 | |
1621 if (wp->w_topline < min_topline) | |
1622 wp->w_topline = min_topline; | |
1623 } | |
1624 redraw_win_later(wp, NOT_VALID); | |
1622 } | 1625 } |
1623 redraw_win_later(wp, NOT_VALID); | 1626 } |
1624 } | |
1625 } | |
1626 } | 1627 } |
1627 | 1628 |
1628 #if defined(FEAT_TIMERS) || defined(PROTO) | 1629 #if defined(FEAT_TIMERS) || defined(PROTO) |
1629 /* | 1630 /* |
1630 * Check if any terminal timer expired. If so, copy text from the terminal to | 1631 * Check if any terminal timer expired. If so, copy text from the terminal to |
1686 static void | 1687 static void |
1687 term_enter_normal_mode(void) | 1688 term_enter_normal_mode(void) |
1688 { | 1689 { |
1689 term_T *term = curbuf->b_term; | 1690 term_T *term = curbuf->b_term; |
1690 | 1691 |
1692 set_terminal_mode(term, TRUE); | |
1693 | |
1691 /* Append the current terminal contents to the buffer. */ | 1694 /* Append the current terminal contents to the buffer. */ |
1692 move_terminal_to_buffer(term); | 1695 move_terminal_to_buffer(term); |
1693 | |
1694 set_terminal_mode(term, TRUE); | |
1695 | 1696 |
1696 /* Move the window cursor to the position of the cursor in the | 1697 /* Move the window cursor to the position of the cursor in the |
1697 * terminal. */ | 1698 * terminal. */ |
1698 curwin->w_cursor.lnum = term->tl_scrollback_scrolled | 1699 curwin->w_cursor.lnum = term->tl_scrollback_scrolled |
1699 + term->tl_cursor_pos.row + 1; | 1700 + term->tl_cursor_pos.row + 1; |