summaryrefslogtreecommitdiffstats
path: root/src/terminal.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/terminal.c')
-rw-r--r--src/terminal.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/terminal.c b/src/terminal.c
index 1a112f48b4..db1741703b 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -38,10 +38,9 @@
* in tl_scrollback are no longer used.
*
* TODO:
- * - patch to add tmap, jakalope (Jacob Askeland) #2073
+ * - test_terminal_no_cmd hangs (Christian)
* - Redirecting output does not work on MS-Windows, Test_terminal_redir_file()
* is disabled.
- * - test_terminal_no_cmd hangs (Christian)
* - implement term_setsize()
* - add test for giving error for invalid 'termsize' value.
* - support minimal size when 'termsize' is "rows*cols".
@@ -56,7 +55,9 @@
* mouse in the Terminal window for copy/paste.
* - when 'encoding' is not utf-8, or the job is using another encoding, setup
* conversions.
- * - In the GUI use a terminal emulator for :!cmd.
+ * - In the GUI use a terminal emulator for :!cmd. Make the height the same as
+ * the window and position it higher up when it gets filled, so it looks like
+ * the text scrolls up.
* - Copy text in the vterm to the Vim buffer once in a while, so that
* completion works.
* - add an optional limit for the scrollback size. When reaching it remove
@@ -1201,23 +1202,22 @@ term_enter_job_mode()
* Get a key from the user without mapping.
* Note: while waiting a terminal may be closed and freed if the channel is
* closed and ++close was used.
- * TODO: use terminal mode mappings.
+ * Uses terminal mode mappings.
*/
static int
term_vgetc()
{
int c;
+ int save_State = State;
- ++no_mapping;
- ++allow_keys;
+ State = TERMINAL;
got_int = FALSE;
#ifdef WIN3264
ctrl_break_was_pressed = FALSE;
#endif
c = vgetc();
got_int = FALSE;
- --no_mapping;
- --allow_keys;
+ State = save_State;
return c;
}
@@ -1406,7 +1406,7 @@ term_paste_register(int prev_c UNUSED)
* Return TRUE when the cursor of the terminal should be displayed.
*/
int
-use_terminal_cursor()
+terminal_is_active()
{
return in_terminal_loop != NULL;
}
@@ -1496,13 +1496,15 @@ term_use_loop(void)
/*
* Wait for input and send it to the job.
+ * When "blocking" is TRUE wait for a character to be typed. Otherwise return
+ * when there is no more typahead.
* Return when the start of a CTRL-W command is typed or anything else that
* should be handled as a Normal mode command.
* Returns OK if a typed character is to be handled in Normal mode, FAIL if
* the terminal was closed.
*/
int
-terminal_loop(void)
+terminal_loop(int blocking)
{
int c;
int termkey = 0;
@@ -1539,7 +1541,7 @@ terminal_loop(void)
}
#endif
- for (;;)
+ while (blocking || vpeekc() != NUL)
{
/* TODO: skip screen update when handling a sequence of keys. */
/* Repeat redrawing in case a message is received while redrawing. */
@@ -1561,7 +1563,7 @@ terminal_loop(void)
if (ctrl_break_was_pressed)
mch_signal_job(curbuf->b_term->tl_job, (char_u *)"kill");
#endif
-
+ /* Was either CTRL-W (termkey) or CTRL-\ pressed? */
if (c == (termkey == 0 ? Ctrl_W : termkey) || c == Ctrl_BSL)
{
int prev_c = c;