3838 * in tl_scrollback are no longer used.
3939 *
4040 * TODO:
41+ * - Termdebug: issue #2154 might be avoided by adding -quiet to gdb?
42+ * patch by Christian, 2017 Oct 23.
4143 * - in GUI vertical split causes problems. Cursor is flickering. (Hirohito
4244 * Higashi, 2017 Sep 19)
4345 * - double click in Window toolbar starts Visual mode (but not always?).
5153 * Also: #2223
5254 * - implement term_setsize()
5355 * - Termdebug does not work when Vim build with mzscheme. gdb hangs.
54- * - Termdebug: issue #2154 might be avoided by adding -quiet to gdb?
55- * patch by Christian, 2017 Oct 23.
5656 * - MS-Windows GUI: WinBar has tearoff item
5757 * - MS-Windows GUI: still need to type a key after shell exits? #1924
5858 * - What to store in a session file? Shell at the prompt would be OK to
@@ -1540,6 +1540,9 @@ terminal_loop(int blocking)
15401540 int c ;
15411541 int termkey = 0 ;
15421542 int ret ;
1543+ #ifdef UNIX
1544+ int tty_fd = curbuf -> b_term -> tl_job -> jv_channel -> ch_part [get_tty_part (curbuf -> b_term )].ch_fd ;
1545+ #endif
15431546
15441547 /* Remember the terminal we are sending keys to. However, the terminal
15451548 * might be closed while waiting for a character, e.g. typing "exit" in a
@@ -1552,35 +1555,35 @@ terminal_loop(int blocking)
15521555 position_cursor (curwin , & curbuf -> b_term -> tl_cursor_pos );
15531556 may_set_cursor_props (curbuf -> b_term );
15541557
1555- #ifdef UNIX
1558+ while ( blocking || vpeekc () != NUL )
15561559 {
1557- int part = get_tty_part (curbuf -> b_term );
1558- int fd = curbuf -> b_term -> tl_job -> jv_channel -> ch_part [part ].ch_fd ;
1560+ /* TODO: skip screen update when handling a sequence of keys. */
1561+ /* Repeat redrawing in case a message is received while redrawing. */
1562+ while (must_redraw != 0 )
1563+ if (update_screen (0 ) == FAIL )
1564+ break ;
1565+ update_cursor (curbuf -> b_term , FALSE);
15591566
1560- if (isatty (fd ))
1567+ #ifdef UNIX
1568+ /*
1569+ * The shell or another program may change the tty settings. Getting
1570+ * them for every typed character is a bit of overhead, but it's needed
1571+ * for the first CR typed, e.g. when Vim starts in a shell.
1572+ */
1573+ if (isatty (tty_fd ))
15611574 {
15621575 ttyinfo_T info ;
15631576
15641577 /* Get the current backspace and enter characters of the pty. */
1565- if (get_tty_info (fd , & info ) == OK )
1578+ if (get_tty_info (tty_fd , & info ) == OK )
15661579 {
15671580 term_backspace_char = info .backspace ;
15681581 term_enter_char = info .enter ;
15691582 term_nl_does_cr = info .nl_does_cr ;
15701583 }
15711584 }
1572- }
15731585#endif
15741586
1575- while (blocking || vpeekc () != NUL )
1576- {
1577- /* TODO: skip screen update when handling a sequence of keys. */
1578- /* Repeat redrawing in case a message is received while redrawing. */
1579- while (must_redraw != 0 )
1580- if (update_screen (0 ) == FAIL )
1581- break ;
1582- update_cursor (curbuf -> b_term , FALSE);
1583-
15841587 c = term_vgetc ();
15851588 if (!term_use_loop ())
15861589 /* job finished while waiting for a character */
0 commit comments