aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/edit.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/edit.c')
-rw-r--r--src/nvim/edit.c54
1 files changed, 13 insertions, 41 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index 8bf5170ae7..c7f20783a9 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -56,9 +56,12 @@
#include "nvim/tag.h"
#include "nvim/term.h"
#include "nvim/ui.h"
+#include "nvim/mouse.h"
#include "nvim/undo.h"
#include "nvim/window.h"
#include "nvim/os/event.h"
+#include "nvim/os/input.h"
+#include "nvim/os/time.h"
/*
* definitions used for CTRL-X submode
@@ -388,9 +391,6 @@ edit (
*/
if (curbuf->b_p_iminsert == B_IMODE_LMAP)
State |= LANGMAP;
-#ifdef USE_IM_CONTROL
- im_set_active(curbuf->b_p_iminsert == B_IMODE_IM);
-#endif
setmouse();
clear_showcmd();
@@ -593,9 +593,17 @@ edit (
* Get a character for Insert mode. Ignore K_IGNORE.
*/
lastc = c; /* remember previous char for CTRL-D */
+ event_enable_deferred();
do {
c = safe_vgetc();
} while (c == K_IGNORE);
+ event_disable_deferred();
+
+ if (c == K_EVENT) {
+ c = lastc;
+ event_process();
+ continue;
+ }
/* Don't want K_CURSORHOLD for the second key, e.g., after CTRL-V. */
did_cursorhold = TRUE;
@@ -943,10 +951,6 @@ doESCkey:
did_cursorhold = TRUE;
break;
- case K_EVENT:
- event_process();
- break;
-
case K_HOME: /* <Home> */
case K_KHOME:
case K_S_HOME:
@@ -1757,7 +1761,7 @@ static int has_compl_option(int dict_opt)
vim_beep();
setcursor();
out_flush();
- ui_delay(2000L, false);
+ os_delay(2000L, false);
}
return FALSE;
}
@@ -2001,7 +2005,7 @@ ins_compl_add (
compl_T *match;
int dir = (cdir == 0 ? compl_direction : cdir);
- ui_breakcheck();
+ os_breakcheck();
if (got_int)
return FAIL;
if (len < 0)
@@ -6757,19 +6761,11 @@ static void ins_reg(void)
* message for it. Only call it explicitly. */
++no_u_sync;
if (regname == '=') {
-# ifdef USE_IM_CONTROL
- int im_on = im_get_status();
-# endif
/* Sync undo when evaluating the expression calls setline() or
* append(), so that it can be undone separately. */
u_sync_once = 2;
regname = get_expr_register();
-# ifdef USE_IM_CONTROL
- /* Restore the Input Method. */
- if (im_on)
- im_set_active(TRUE);
-# endif
}
if (regname == NUL || !valid_yank_reg(regname, FALSE)) {
vim_beep();
@@ -6866,24 +6862,8 @@ static void ins_ctrl_hat(void)
} else {
curbuf->b_p_iminsert = B_IMODE_LMAP;
State |= LANGMAP;
-#ifdef USE_IM_CONTROL
- im_set_active(FALSE);
-#endif
}
}
-#ifdef USE_IM_CONTROL
- else {
- /* There are no ":lmap" mappings, toggle IM */
- if (im_get_status()) {
- curbuf->b_p_iminsert = B_IMODE_NONE;
- im_set_active(FALSE);
- } else {
- curbuf->b_p_iminsert = B_IMODE_IM;
- State &= ~LANGMAP;
- im_set_active(TRUE);
- }
- }
-#endif
set_iminsert_global();
showmode();
/* Show/unshow value of 'keymap' in status lines. */
@@ -6983,14 +6963,6 @@ ins_esc (
}
}
-#ifdef USE_IM_CONTROL
- /* Disable IM to allow typing English directly for Normal mode commands.
- * When ":lmap" is enabled don't change 'iminsert' (IM can be enabled as
- * well). */
- if (!(State & LANGMAP))
- im_save_status(&curbuf->b_p_iminsert);
- im_set_active(FALSE);
-#endif
State = NORMAL;
/* need to position cursor again (e.g. when on a TAB ) */