40
40
* TODO:
41
41
* - Win32: Make terminal used for :!cmd in the GUI work better. Allow for
42
42
* redirection. Probably in call to channel_set_pipes().
43
+ * - Win32: Redirecting output does not work, Test_terminal_redir_file()
44
+ * is disabled.
43
45
* - Copy text in the vterm to the Vim buffer once in a while, so that
44
46
* completion works.
47
+ * - When starting terminal window with shell in terminal, then using :gui to
48
+ * switch to GUI, shell stops working. Scrollback seems wrong, command
49
+ * running in shell is still running.
45
50
* - in GUI vertical split causes problems. Cursor is flickering. (Hirohito
46
51
* Higashi, 2017 Sep 19)
47
52
* - after resizing windows overlap. (Boris Staletic, #2164)
48
- * - Redirecting output does not work on MS-Windows, Test_terminal_redir_file()
49
- * is disabled.
50
53
* - cursor blinks in terminal on widows with a timer. (xtal8, #2142)
51
54
* - Termdebug does not work when Vim build with mzscheme. gdb hangs.
52
- * - MS-Windows GUI: WinBar has tearoff item
53
- * - MS-Windows GUI: still need to type a key after shell exits? #1924
54
55
* - After executing a shell command the status line isn't redraw.
55
56
* - add test for giving error for invalid 'termsize' value.
56
57
* - support minimal size when 'termsize' is "rows*cols".
59
60
* - Redrawing is slow with Athena and Motif. Also other GUI? (Ramel Eshed)
60
61
* - For the GUI fill termios with default values, perhaps like pangoterm:
61
62
* http://bazaar.launchpad.net/~leonerd/pangoterm/trunk/view/head:/main.c#L134
62
- * - when 'encoding' is not utf-8, or the job is using another encoding, setup
63
+ * - When 'encoding' is not utf-8, or the job is using another encoding, setup
63
64
* conversions.
64
65
*/
65
66
@@ -1223,17 +1224,32 @@ term_convert_key(term_T *term, int c, char *buf)
1223
1224
1224
1225
/*
1225
1226
* Return TRUE if the job for "term" is still running.
1227
+ * If "check_job_status" is TRUE update the job status.
1226
1228
*/
1227
- int
1228
- term_job_running (term_T * term )
1229
+ static int
1230
+ term_job_running_check (term_T * term , int check_job_status )
1229
1231
{
1230
1232
/* Also consider the job finished when the channel is closed, to avoid a
1231
1233
* race condition when updating the title. */
1232
- return term != NULL
1234
+ if ( term != NULL
1233
1235
&& term -> tl_job != NULL
1234
- && channel_is_open (term -> tl_job -> jv_channel )
1235
- && (term -> tl_job -> jv_status == JOB_STARTED
1236
+ && channel_is_open (term -> tl_job -> jv_channel ))
1237
+ {
1238
+ if (check_job_status )
1239
+ job_status (term -> tl_job );
1240
+ return (term -> tl_job -> jv_status == JOB_STARTED
1236
1241
|| term -> tl_job -> jv_channel -> ch_keep_open );
1242
+ }
1243
+ return FALSE;
1244
+ }
1245
+
1246
+ /*
1247
+ * Return TRUE if the job for "term" is still running.
1248
+ */
1249
+ int
1250
+ term_job_running (term_T * term )
1251
+ {
1252
+ return term_job_running_check (term , FALSE);
1237
1253
}
1238
1254
1239
1255
/*
@@ -1891,6 +1907,32 @@ prepare_restore_cursor_props(void)
1891
1907
may_output_cursor_props ();
1892
1908
}
1893
1909
1910
+ /*
1911
+ * Returns TRUE if the current window contains a terminal and we are sending
1912
+ * keys to the job.
1913
+ * If "check_job_status" is TRUE update the job status.
1914
+ */
1915
+ static int
1916
+ term_use_loop_check (int check_job_status )
1917
+ {
1918
+ term_T * term = curbuf -> b_term ;
1919
+
1920
+ return term != NULL
1921
+ && !term -> tl_normal_mode
1922
+ && term -> tl_vterm != NULL
1923
+ && term_job_running_check (term , check_job_status );
1924
+ }
1925
+
1926
+ /*
1927
+ * Returns TRUE if the current window contains a terminal and we are sending
1928
+ * keys to the job.
1929
+ */
1930
+ int
1931
+ term_use_loop (void )
1932
+ {
1933
+ return term_use_loop_check (FALSE);
1934
+ }
1935
+
1894
1936
/*
1895
1937
* Called when entering a window with the mouse. If this is a terminal window
1896
1938
* we may want to change state.
@@ -1902,7 +1944,7 @@ term_win_entered()
1902
1944
1903
1945
if (term != NULL )
1904
1946
{
1905
- if (term_use_loop ( ))
1947
+ if (term_use_loop_check (TRUE ))
1906
1948
{
1907
1949
reset_VIsual_and_resel ();
1908
1950
if (State & INSERT )
@@ -1914,21 +1956,6 @@ term_win_entered()
1914
1956
}
1915
1957
}
1916
1958
1917
- /*
1918
- * Returns TRUE if the current window contains a terminal and we are sending
1919
- * keys to the job.
1920
- */
1921
- int
1922
- term_use_loop (void )
1923
- {
1924
- term_T * term = curbuf -> b_term ;
1925
-
1926
- return term != NULL
1927
- && !term -> tl_normal_mode
1928
- && term -> tl_vterm != NULL
1929
- && term_job_running (term );
1930
- }
1931
-
1932
1959
/*
1933
1960
* Wait for input and send it to the job.
1934
1961
* When "blocking" is TRUE wait for a character to be typed. Otherwise return
@@ -1976,7 +2003,7 @@ terminal_loop(int blocking)
1976
2003
restore_cursor = TRUE;
1977
2004
1978
2005
c = term_vgetc ();
1979
- if (!term_use_loop ( ))
2006
+ if (!term_use_loop_check (TRUE ))
1980
2007
{
1981
2008
/* Job finished while waiting for a character. Push back the
1982
2009
* received character. */
@@ -2027,7 +2054,7 @@ terminal_loop(int blocking)
2027
2054
#ifdef FEAT_CMDL_INFO
2028
2055
clear_showcmd ();
2029
2056
#endif
2030
- if (!term_use_loop ( ))
2057
+ if (!term_use_loop_check (TRUE ))
2031
2058
/* job finished while waiting for a character */
2032
2059
break ;
2033
2060
0 commit comments