Skip to content

Commit 392d1bf

Browse files
committed
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)
1 parent c9456ce commit 392d1bf

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

src/terminal.c

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@
3636
* that buffer, attributes come from the scrollback buffer tl_scrollback.
3737
*
3838
* 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
3942
* - in bash mouse clicks are inserting characters.
4043
* - mouse scroll: when over other window, scroll that window.
4144
* - 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)
351354
static void
352355
update_cursor(term_T *term, int redraw)
353356
{
357+
if (term->tl_terminal_mode)
358+
return;
354359
setcursor();
355360
if (redraw && term->tl_buffer == curbuf)
356361
{
@@ -382,9 +387,12 @@ write_to_term(buf_T *buffer, char_u *msg, channel_T *channel)
382387
ch_logn(channel, "writing %d bytes to terminal", (int)len);
383388
term_write_job_output(term, msg, len);
384389

385-
/* TODO: only update once in a while. */
386-
update_screen(0);
387-
update_cursor(term, TRUE);
390+
if (!term->tl_terminal_mode)
391+
{
392+
/* TODO: only update once in a while. */
393+
update_screen(0);
394+
update_cursor(term, TRUE);
395+
}
388396
}
389397

390398
/*
@@ -1081,7 +1089,7 @@ handle_movecursor(
10811089
if (wp->w_buffer == term->tl_buffer)
10821090
position_cursor(wp, &pos);
10831091
}
1084-
if (term->tl_buffer == curbuf)
1092+
if (term->tl_buffer == curbuf && !term->tl_terminal_mode)
10851093
{
10861094
may_toggle_cursor(term);
10871095
update_cursor(term, term->tl_cursor_visible);
@@ -2009,10 +2017,13 @@ f_term_sendkeys(typval_T *argvars, typval_T *rettv)
20092017
msg += MB_PTR2LEN(msg);
20102018
}
20112019

2012-
/* TODO: only update once in a while. */
2013-
update_screen(0);
2014-
if (buf == curbuf)
2015-
update_cursor(term, TRUE);
2020+
if (!term->tl_terminal_mode)
2021+
{
2022+
/* TODO: only update once in a while. */
2023+
update_screen(0);
2024+
if (buf == curbuf)
2025+
update_cursor(term, TRUE);
2026+
}
20162027
}
20172028

20182029
/*

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,8 @@ static char *(features[]) =
769769

770770
static int included_patches[] =
771771
{ /* Add new patch number below this line */
772+
/**/
773+
824,
772774
/**/
773775
823,
774776
/**/

0 commit comments

Comments
 (0)