0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

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)
This commit is contained in:
Bram Moolenaar
2017-07-31 21:18:58 +02:00
parent c9456cec0c
commit 392d1bfa5e
2 changed files with 21 additions and 8 deletions

View File

@@ -36,6 +36,9 @@
* that buffer, attributes come from the scrollback buffer tl_scrollback. * that buffer, attributes come from the scrollback buffer tl_scrollback.
* *
* TODO: * TODO:
* - Use "." for current line instead of optional.
* - make row and cols one-based instead of zero-based in term_ functions.
* - Add StatusLineTerm highlighting
* - in bash mouse clicks are inserting characters. * - in bash mouse clicks are inserting characters.
* - mouse scroll: when over other window, scroll that window. * - mouse scroll: when over other window, scroll that window.
* - For the scrollback buffer store lines in the buffer, only attributes in * - For the scrollback buffer store lines in the buffer, only attributes in
@@ -351,6 +354,8 @@ term_write_job_output(term_T *term, char_u *msg, size_t len)
static void static void
update_cursor(term_T *term, int redraw) update_cursor(term_T *term, int redraw)
{ {
if (term->tl_terminal_mode)
return;
setcursor(); setcursor();
if (redraw && term->tl_buffer == curbuf) if (redraw && term->tl_buffer == curbuf)
{ {
@@ -382,9 +387,12 @@ write_to_term(buf_T *buffer, char_u *msg, channel_T *channel)
ch_logn(channel, "writing %d bytes to terminal", (int)len); ch_logn(channel, "writing %d bytes to terminal", (int)len);
term_write_job_output(term, msg, len); term_write_job_output(term, msg, len);
/* TODO: only update once in a while. */ if (!term->tl_terminal_mode)
update_screen(0); {
update_cursor(term, TRUE); /* TODO: only update once in a while. */
update_screen(0);
update_cursor(term, TRUE);
}
} }
/* /*
@@ -1081,7 +1089,7 @@ handle_movecursor(
if (wp->w_buffer == term->tl_buffer) if (wp->w_buffer == term->tl_buffer)
position_cursor(wp, &pos); position_cursor(wp, &pos);
} }
if (term->tl_buffer == curbuf) if (term->tl_buffer == curbuf && !term->tl_terminal_mode)
{ {
may_toggle_cursor(term); may_toggle_cursor(term);
update_cursor(term, term->tl_cursor_visible); update_cursor(term, term->tl_cursor_visible);
@@ -2009,10 +2017,13 @@ f_term_sendkeys(typval_T *argvars, typval_T *rettv)
msg += MB_PTR2LEN(msg); msg += MB_PTR2LEN(msg);
} }
/* TODO: only update once in a while. */ if (!term->tl_terminal_mode)
update_screen(0); {
if (buf == curbuf) /* TODO: only update once in a while. */
update_cursor(term, TRUE); update_screen(0);
if (buf == curbuf)
update_cursor(term, TRUE);
}
} }
/* /*

View File

@@ -769,6 +769,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
824,
/**/ /**/
823, 823,
/**/ /**/