Skip to content

Commit 1c84493

Browse files
committed
patch 8.0.0771: cursor in terminal window not always updated in GUI
Problem: Cursor in a terminal window not always updated in the GUI. Solution: Call gui_update_cursor(). (Yasuhiro Matsumoto, closes #1868)
1 parent 86067eb commit 1c84493

2 files changed

Lines changed: 20 additions & 11 deletions

File tree

src/terminal.c

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
* while, if the terminal window is visible, the screen contents is drawn.
3434
*
3535
* TODO:
36-
* - do not store terminal buffer in viminfo
36+
* - include functions from #1871
37+
* - do not store terminal buffer in viminfo. Or prefix term:// ?
3738
* - Add a scrollback buffer (contains lines to scroll off the top).
3839
* Can use the buf_T lines, store attributes somewhere else?
3940
* - When the job ends:
@@ -314,6 +315,18 @@ term_write_job_output(term_T *term, char_u *msg, size_t len)
314315
vterm_screen_flush_damage(vterm_obtain_screen(vterm));
315316
}
316317

318+
static void
319+
update_cursor()
320+
{
321+
/* TODO: this should not always be needed */
322+
setcursor();
323+
out_flush();
324+
#ifdef FEAT_GUI
325+
if (gui.in_use)
326+
gui_update_cursor(FALSE, FALSE);
327+
#endif
328+
}
329+
317330
/*
318331
* Invoked when "msg" output from a job was received. Write it to the terminal
319332
* of "buffer".
@@ -329,8 +342,7 @@ write_to_term(buf_T *buffer, char_u *msg, channel_T *channel)
329342

330343
/* TODO: only update once in a while. */
331344
update_screen(0);
332-
setcursor();
333-
out_flush();
345+
update_cursor();
334346
}
335347

336348
/*
@@ -461,8 +473,7 @@ terminal_loop(void)
461473
{
462474
/* TODO: skip screen update when handling a sequence of keys. */
463475
update_screen(0);
464-
setcursor();
465-
out_flush();
476+
update_cursor();
466477
++no_mapping;
467478
++allow_keys;
468479
got_int = FALSE;
@@ -550,8 +561,7 @@ term_job_ended(job_T *job)
550561
if (did_one)
551562
{
552563
redraw_statuslines();
553-
setcursor();
554-
out_flush();
564+
update_cursor();
555565
}
556566
if (curbuf->b_term != NULL && curbuf->b_term->tl_job == job)
557567
maketitle();
@@ -616,10 +626,7 @@ handle_movecursor(
616626
}
617627

618628
if (is_current)
619-
{
620-
setcursor();
621-
out_flush();
622-
}
629+
update_cursor();
623630

624631
return 1;
625632
}

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+
771,
772774
/**/
773775
770,
774776
/**/

0 commit comments

Comments
 (0)