To: vim_dev@googlegroups.com Subject: Patch 8.0.1821 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1821 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) Files: src/terminal.c *** ../vim-8.0.1820/src/terminal.c 2018-05-12 16:55:10.539668906 +0200 --- src/terminal.c 2018-05-12 20:32:13.163767395 +0200 *************** *** 1606,1628 **** vterm_state_get_default_colors(vterm_obtain_state(term->tl_vterm), &term->tl_default_color.fg, &term->tl_default_color.bg); ! FOR_ALL_WINDOWS(wp) ! { ! if (wp->w_buffer == term->tl_buffer) { ! wp->w_cursor.lnum = term->tl_buffer->b_ml.ml_line_count; ! wp->w_cursor.col = 0; ! wp->w_valid = 0; ! if (wp->w_cursor.lnum >= wp->w_height) { ! linenr_T min_topline = wp->w_cursor.lnum - wp->w_height + 1; ! ! if (wp->w_topline < min_topline) ! wp->w_topline = min_topline; } - redraw_win_later(wp, NOT_VALID); } - } } #if defined(FEAT_TIMERS) || defined(PROTO) --- 1606,1629 ---- vterm_state_get_default_colors(vterm_obtain_state(term->tl_vterm), &term->tl_default_color.fg, &term->tl_default_color.bg); ! if (term->tl_normal_mode) ! FOR_ALL_WINDOWS(wp) { ! if (wp->w_buffer == term->tl_buffer) { ! wp->w_cursor.lnum = term->tl_buffer->b_ml.ml_line_count; ! wp->w_cursor.col = 0; ! wp->w_valid = 0; ! if (wp->w_cursor.lnum >= wp->w_height) ! { ! linenr_T min_topline = wp->w_cursor.lnum - wp->w_height + 1; ! ! if (wp->w_topline < min_topline) ! wp->w_topline = min_topline; ! } ! redraw_win_later(wp, NOT_VALID); } } } #if defined(FEAT_TIMERS) || defined(PROTO) *************** *** 1688,1698 **** { term_T *term = curbuf->b_term; /* Append the current terminal contents to the buffer. */ move_terminal_to_buffer(term); - set_terminal_mode(term, TRUE); - /* Move the window cursor to the position of the cursor in the * terminal. */ curwin->w_cursor.lnum = term->tl_scrollback_scrolled --- 1689,1699 ---- { term_T *term = curbuf->b_term; + set_terminal_mode(term, TRUE); + /* Append the current terminal contents to the buffer. */ move_terminal_to_buffer(term); /* Move the window cursor to the position of the cursor in the * terminal. */ curwin->w_cursor.lnum = term->tl_scrollback_scrolled *** ../vim-8.0.1820/src/version.c 2018-05-12 17:42:38.737075919 +0200 --- src/version.c 2018-05-12 20:35:31.878332166 +0200 *************** *** 763,764 **** --- 763,766 ---- { /* Add new patch number below this line */ + /**/ + 1821, /**/ -- Lose weight, NEVER Diet again with The "Invisible Weight Loss Patch" (spam e-mail) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///