summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/evalfunc.c19
-rw-r--r--src/testdir/test_timers.vim19
-rw-r--r--src/ui.c15
-rw-r--r--src/version.c2
4 files changed, 40 insertions, 15 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 626af7c50..2692de61f 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -393,6 +393,7 @@ static void f_tagfiles(typval_T *argvars, typval_T *rettv);
static void f_tempname(typval_T *argvars, typval_T *rettv);
static void f_test_alloc_fail(typval_T *argvars, typval_T *rettv);
static void f_test_autochdir(typval_T *argvars, typval_T *rettv);
+static void f_test_feedinput(typval_T *argvars, typval_T *rettv);
static void f_test_override(typval_T *argvars, typval_T *rettv);
static void f_test_garbagecollect_now(typval_T *argvars, typval_T *rettv);
static void f_test_ignore_error(typval_T *argvars, typval_T *rettv);
@@ -851,6 +852,7 @@ static struct fst
#endif
{"test_alloc_fail", 3, 3, f_test_alloc_fail},
{"test_autochdir", 0, 0, f_test_autochdir},
+ {"test_feedinput", 1, 1, f_test_feedinput},
{"test_garbagecollect_now", 0, 0, f_test_garbagecollect_now},
{"test_ignore_error", 1, 1, f_test_ignore_error},
#ifdef FEAT_JOB_CHANNEL
@@ -12518,6 +12520,23 @@ f_test_autochdir(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
}
/*
+ * "test_feedinput()"
+ */
+ static void
+f_test_feedinput(typval_T *argvars, typval_T *rettv UNUSED)
+{
+#ifdef USE_INPUT_BUF
+ char_u *val = get_tv_string_chk(&argvars[0]);
+
+ if (val != NULL)
+ {
+ trash_input_buf();
+ add_to_input_buf_csi(val, (int)STRLEN(val));
+ }
+#endif
+}
+
+/*
* "test_disable({name}, {val})" function
*/
static void
diff --git a/src/testdir/test_timers.vim b/src/testdir/test_timers.vim
index d30325b7b..0c6bb8338 100644
--- a/src/testdir/test_timers.vim
+++ b/src/testdir/test_timers.vim
@@ -206,5 +206,24 @@ func Test_timer_errors()
call assert_equal(3, g:call_count)
endfunc
+func FeedAndPeek(timer)
+ call test_feedinput('a')
+ call getchar(1)
+endfunc
+
+func Interrupt(timer)
+ call test_feedinput("\<C-C>")
+endfunc
+
+func Test_peek_and_get_char()
+ if !has('unix') && !has('gui_running')
+ return
+ endif
+ call timer_start(0, 'FeedAndPeek')
+ let intr = timer_start(100, 'Interrupt')
+ let c = getchar()
+ call assert_equal(char2nr('a'), c)
+ call timer_stop(intr)
+endfunc
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/ui.c b/src/ui.c
index ddae37266..d8deb6a8d 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -1651,11 +1651,6 @@ set_input_buf(char_u *p)
}
}
-#if defined(FEAT_GUI) \
- || defined(FEAT_MOUSE_GPM) || defined(FEAT_SYSMOUSE) \
- || defined(FEAT_XCLIPBOARD) || defined(VMS) \
- || defined(FEAT_CLIENTSERVER) \
- || defined(PROTO)
/*
* Add the given bytes to the input buffer
* Special keys start with CSI. A real CSI must have been translated to
@@ -1676,15 +1671,7 @@ add_to_input_buf(char_u *s, int len)
while (len--)
inbuf[inbufcount++] = *s++;
}
-#endif
-#if ((defined(FEAT_XIM) || defined(FEAT_DND)) && defined(FEAT_GUI_GTK)) \
- || defined(FEAT_GUI_MSWIN) \
- || defined(FEAT_GUI_MAC) \
- || (defined(FEAT_MBYTE) && defined(FEAT_MBYTE_IME)) \
- || (defined(FEAT_GUI) && (!defined(USE_ON_FLY_SCROLL) \
- || defined(FEAT_MENU))) \
- || defined(PROTO)
/*
* Add "str[len]" to the input buffer while escaping CSI bytes.
*/
@@ -1706,7 +1693,6 @@ add_to_input_buf_csi(char_u *str, int len)
}
}
}
-#endif
#if defined(FEAT_HANGULIN) || defined(PROTO)
void
@@ -1744,7 +1730,6 @@ trash_input_buf(void)
/*
* Read as much data from the input buffer as possible up to maxlen, and store
* it in buf.
- * Note: this function used to be Read() in unix.c
*/
int
read_from_input_buf(char_u *buf, long maxlen)
diff --git a/src/version.c b/src/version.c
index 2034504cc..ce53bb815 100644
--- a/src/version.c
+++ b/src/version.c
@@ -770,6 +770,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1048,
+/**/
1047,
/**/
1046,