summaryrefslogtreecommitdiffstats
path: root/src/input.c
diff options
context:
space:
mode:
authorandmarti1424 <andmarti@gmail.com>2017-04-10 23:19:08 -0300
committerandmarti1424 <andmarti@gmail.com>2017-04-10 23:19:08 -0300
commit3f09ff48fd60662c58a9a367a7235e049bbe9df0 (patch)
tree2efccf1a4bc34d16ee443ca2ffaecab060d3ce29 /src/input.c
parent46ba5b07a7fffe78f486e838c9a79930baf5459e (diff)
work on feature of issue 168
Diffstat (limited to 'src/input.c')
-rw-r--r--src/input.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/src/input.c b/src/input.c
index 9e7902d..e0871f8 100644
--- a/src/input.c
+++ b/src/input.c
@@ -5,6 +5,7 @@
#include <wchar.h>
#include <wctype.h>
+#include "main.h"
#include "tui.h"
#include "maps.h"
#include "cmds.h"
@@ -21,7 +22,6 @@ int cmd_multiplier = 0; // Multiplier
int cmd_pending = 0; // Command pending
int shall_quit; // Break loop if ESC key is pressed
-
/*
* Reads stdin for a valid command.
* Details: Read characters from stdin to a input buffer.
@@ -129,13 +129,28 @@ void break_waitcmd_loop(struct block * buffer) {
} else if (curmode == VISUAL_MODE) {
exit_visualmode();
}
-
- chg_mode('.');
+ if (curmode == INSERT_MODE && lastmode == EDIT_MODE) {
+ if (inputline_pos && wcslen(inputline) >= inputline_pos) {
+ real_inputline_pos--;
+ int l = wcwidth(inputline[real_inputline_pos]);
+ inputline_pos -= l;
+ }
+ chg_mode(insert_edit_submode == '=' ? 'e' : 'E');
+ lastmode=NORMAL_MODE;
+ ui_show_header();
+ } else if (curmode == EDIT_MODE && lastmode == INSERT_MODE) {
+ chg_mode(insert_edit_submode);
+ lastmode=NORMAL_MODE;
+ ui_show_header();
+ } else {
+ chg_mode('.');
+ lastmode=NORMAL_MODE;
+ inputline[0] = L'\0'; // clean inputline
+ flush_buf(buffer);
+ ui_update(TRUE);
+ }
cmd_pending = 0; // No longer wait for command. Set flag.
cmd_multiplier = 0; // Reset the multiplier
- inputline[0] = L'\0'; // clean inputline
- flush_buf(buffer);
- ui_update(TRUE);
return;
}