comparison src/terminal.c @ 11888:4db6c74df788 v8.0.0824

patch 8.0.0824: in Terminal mode the cursor and screen gets redrawn commit https://github.com/vim/vim/commit/392d1bfa5e14b9534af322003723ebd57cedcc64 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Jul 31 21:18:58 2017 +0200 patch 8.0.0824: in Terminal mode the cursor and screen gets redrawn Problem: In Terminal mode the cursor and screen gets redrawn when the job produces output. Solution: Check for tl_terminal_mode. (partly by Yasuhiro Matsumoto, closes #1904)
author Christian Brabandt <cb@256bit.org>
date Mon, 31 Jul 2017 21:30:05 +0200
parents 7928d62d29ee
children 35d7459251fd
comparison
equal deleted inserted replaced
11887:030a9cde3116 11888:4db6c74df788
34 * 34 *
35 * When the job ends the text is put in a buffer. Redrawing then happens from 35 * When the job ends the text is put in a buffer. Redrawing then happens from
36 * that buffer, attributes come from the scrollback buffer tl_scrollback. 36 * that buffer, attributes come from the scrollback buffer tl_scrollback.
37 * 37 *
38 * TODO: 38 * TODO:
39 * - Use "." for current line instead of optional.
40 * - make row and cols one-based instead of zero-based in term_ functions.
41 * - Add StatusLineTerm highlighting
39 * - in bash mouse clicks are inserting characters. 42 * - in bash mouse clicks are inserting characters.
40 * - mouse scroll: when over other window, scroll that window. 43 * - mouse scroll: when over other window, scroll that window.
41 * - For the scrollback buffer store lines in the buffer, only attributes in 44 * - For the scrollback buffer store lines in the buffer, only attributes in
42 * tl_scrollback. 45 * tl_scrollback.
43 * - When the job ends: 46 * - When the job ends:
349 } 352 }
350 353
351 static void 354 static void
352 update_cursor(term_T *term, int redraw) 355 update_cursor(term_T *term, int redraw)
353 { 356 {
357 if (term->tl_terminal_mode)
358 return;
354 setcursor(); 359 setcursor();
355 if (redraw && term->tl_buffer == curbuf) 360 if (redraw && term->tl_buffer == curbuf)
356 { 361 {
357 if (term->tl_cursor_visible) 362 if (term->tl_cursor_visible)
358 cursor_on(); 363 cursor_on();
380 return; 385 return;
381 } 386 }
382 ch_logn(channel, "writing %d bytes to terminal", (int)len); 387 ch_logn(channel, "writing %d bytes to terminal", (int)len);
383 term_write_job_output(term, msg, len); 388 term_write_job_output(term, msg, len);
384 389
385 /* TODO: only update once in a while. */ 390 if (!term->tl_terminal_mode)
386 update_screen(0); 391 {
387 update_cursor(term, TRUE); 392 /* TODO: only update once in a while. */
393 update_screen(0);
394 update_cursor(term, TRUE);
395 }
388 } 396 }
389 397
390 /* 398 /*
391 * Send a mouse position and click to the vterm 399 * Send a mouse position and click to the vterm
392 */ 400 */
1079 FOR_ALL_WINDOWS(wp) 1087 FOR_ALL_WINDOWS(wp)
1080 { 1088 {
1081 if (wp->w_buffer == term->tl_buffer) 1089 if (wp->w_buffer == term->tl_buffer)
1082 position_cursor(wp, &pos); 1090 position_cursor(wp, &pos);
1083 } 1091 }
1084 if (term->tl_buffer == curbuf) 1092 if (term->tl_buffer == curbuf && !term->tl_terminal_mode)
1085 { 1093 {
1086 may_toggle_cursor(term); 1094 may_toggle_cursor(term);
1087 update_cursor(term, term->tl_cursor_visible); 1095 update_cursor(term, term->tl_cursor_visible);
1088 } 1096 }
1089 1097
2007 { 2015 {
2008 send_keys_to_term(term, PTR2CHAR(msg), FALSE); 2016 send_keys_to_term(term, PTR2CHAR(msg), FALSE);
2009 msg += MB_PTR2LEN(msg); 2017 msg += MB_PTR2LEN(msg);
2010 } 2018 }
2011 2019
2012 /* TODO: only update once in a while. */ 2020 if (!term->tl_terminal_mode)
2013 update_screen(0); 2021 {
2014 if (buf == curbuf) 2022 /* TODO: only update once in a while. */
2015 update_cursor(term, TRUE); 2023 update_screen(0);
2024 if (buf == curbuf)
2025 update_cursor(term, TRUE);
2026 }
2016 } 2027 }
2017 2028
2018 /* 2029 /*
2019 * "term_start(command, options)" function 2030 * "term_start(command, options)" function
2020 */ 2031 */