comparison src/terminal.c @ 11778:e8005055f845 v8.0.0771

patch 8.0.0771: cursor in terminal window not always updated in GUI commit https://github.com/vim/vim/commit/1c84493bbeda1d58b70e9b2b7723ce92fb2a49d4 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Jul 24 23:36:41 2017 +0200 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 https://github.com/vim/vim/issues/1868)
author Christian Brabandt <cb@256bit.org>
date Mon, 24 Jul 2017 23:45:03 +0200
parents edf1a2a247fa
children 98154b91e43a
comparison
equal deleted inserted replaced
11777:22c7384b8a9e 11778:e8005055f845
31 * terminal emulator invokes callbacks when its screen content changes. The 31 * terminal emulator invokes callbacks when its screen content changes. The
32 * line range is stored in tl_dirty_row_start and tl_dirty_row_end. Once in a 32 * line range is stored in tl_dirty_row_start and tl_dirty_row_end. Once in a
33 * while, if the terminal window is visible, the screen contents is drawn. 33 * while, if the terminal window is visible, the screen contents is drawn.
34 * 34 *
35 * TODO: 35 * 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:// ?
37 * - Add a scrollback buffer (contains lines to scroll off the top). 38 * - Add a scrollback buffer (contains lines to scroll off the top).
38 * Can use the buf_T lines, store attributes somewhere else? 39 * Can use the buf_T lines, store attributes somewhere else?
39 * - When the job ends: 40 * - When the job ends:
40 * - Write "-- JOB ENDED --" in the terminal. 41 * - Write "-- JOB ENDED --" in the terminal.
41 * - Put the terminal contents in the scrollback buffer. 42 * - Put the terminal contents in the scrollback buffer.
312 313
313 /* this invokes the damage callbacks */ 314 /* this invokes the damage callbacks */
314 vterm_screen_flush_damage(vterm_obtain_screen(vterm)); 315 vterm_screen_flush_damage(vterm_obtain_screen(vterm));
315 } 316 }
316 317
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
317 /* 330 /*
318 * Invoked when "msg" output from a job was received. Write it to the terminal 331 * Invoked when "msg" output from a job was received. Write it to the terminal
319 * of "buffer". 332 * of "buffer".
320 */ 333 */
321 void 334 void
327 ch_logn(channel, "writing %d bytes to terminal", (int)len); 340 ch_logn(channel, "writing %d bytes to terminal", (int)len);
328 term_write_job_output(term, msg, len); 341 term_write_job_output(term, msg, len);
329 342
330 /* TODO: only update once in a while. */ 343 /* TODO: only update once in a while. */
331 update_screen(0); 344 update_screen(0);
332 setcursor(); 345 update_cursor();
333 out_flush();
334 } 346 }
335 347
336 /* 348 /*
337 * Convert typed key "c" into bytes to send to the job. 349 * Convert typed key "c" into bytes to send to the job.
338 * Return the number of bytes in "buf". 350 * Return the number of bytes in "buf".
459 471
460 for (;;) 472 for (;;)
461 { 473 {
462 /* TODO: skip screen update when handling a sequence of keys. */ 474 /* TODO: skip screen update when handling a sequence of keys. */
463 update_screen(0); 475 update_screen(0);
464 setcursor(); 476 update_cursor();
465 out_flush();
466 ++no_mapping; 477 ++no_mapping;
467 ++allow_keys; 478 ++allow_keys;
468 got_int = FALSE; 479 got_int = FALSE;
469 c = vgetc(); 480 c = vgetc();
470 --no_mapping; 481 --no_mapping;
548 did_one = TRUE; 559 did_one = TRUE;
549 } 560 }
550 if (did_one) 561 if (did_one)
551 { 562 {
552 redraw_statuslines(); 563 redraw_statuslines();
553 setcursor(); 564 update_cursor();
554 out_flush();
555 } 565 }
556 if (curbuf->b_term != NULL && curbuf->b_term->tl_job == job) 566 if (curbuf->b_term != NULL && curbuf->b_term->tl_job == job)
557 maketitle(); 567 maketitle();
558 } 568 }
559 569
614 is_current = TRUE; 624 is_current = TRUE;
615 } 625 }
616 } 626 }
617 627
618 if (is_current) 628 if (is_current)
619 { 629 update_cursor();
620 setcursor();
621 out_flush();
622 }
623 630
624 return 1; 631 return 1;
625 } 632 }
626 633
627 static int 634 static int