summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrés <andmarti@gmail.com>2023-06-01 18:43:51 -0300
committerAndrés <andmarti@gmail.com>2023-06-01 18:43:51 -0300
commit91e08e397502d2da20169e0bb4a2c41aa9c38fba (patch)
treea1fc07bb21c15eff1b4148d1568eac30e5b3da80
parentb1ba526d0be4b4ceff13b4d89ebfcaba954d26a3 (diff)
parent25254962d0926e638b7cd360ce329814db5c7d59 (diff)
Merge branch 'pr-626' into dev
-rw-r--r--src/conf.c1
-rwxr-xr-xsrc/doc3
-rwxr-xr-xsrc/gram.y8
-rw-r--r--src/input.c5
4 files changed, 16 insertions, 1 deletions
diff --git a/src/conf.c b/src/conf.c
index 74a83b0..6a0ea39 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -79,6 +79,7 @@ const char default_config[] =
"version=0\n"
"help=0\n"
"input_bar_bottom=0\n"
+ "input_edit_mode=0\n"
"underline_grid=0\n"
#ifdef AUTOBACKUP
diff --git a/src/doc b/src/doc
index b37342e..d10f501 100755
--- a/src/doc
+++ b/src/doc
@@ -1355,6 +1355,9 @@ Commands for handling cell content:
'input_bar_bottom' [default off]
Place the input bar at the bottom of the screen.
+ 'input_edit_mode' [default off]
+ Always go from INSERT_MODE to EDIT_MODE when pressing ESC in the former.
+
'underline_grid' [default off]
Underline cells to make a nicer grid
diff --git a/src/gram.y b/src/gram.y
index fec3876..a79e495 100755
--- a/src/gram.y
+++ b/src/gram.y
@@ -273,6 +273,7 @@ token S_YANKCOL
%token K_INPUT_BAR_BOTTOM
%token K_IGNORE_HIDDEN
%token K_NOIGNORE_HIDDEN
+%token K_INPUT_EDIT_MODE
%token K_UNDERLINE_GRID
%token K_TRUNCATE
%token K_NOTRUNCATE
@@ -1565,6 +1566,13 @@ setitem :
ui_mv_bottom_bar();
}
+ | K_INPUT_EDIT_MODE '=' NUMBER { if ($3 == 0) parse_str(user_conf_d, "input_edit_mode=0", TRUE);
+ else parse_str(user_conf_d, "input_edit_mode=1", TRUE);
+ ui_mv_bottom_bar(); }
+ | K_INPUT_EDIT_MODE { parse_str(user_conf_d, "input_edit_mode=1", TRUE);
+ ui_mv_bottom_bar();
+ }
+
| K_UNDERLINE_GRID '=' NUMBER { if ($3 == 0) parse_str(user_conf_d, "underline_grid=0", TRUE);
else parse_str(user_conf_d, "underline_grid=1", TRUE); }
| K_UNDERLINE_GRID { parse_str(user_conf_d, "underline_grid=1", TRUE);
diff --git a/src/input.c b/src/input.c
index 7df6b16..46f2451 100644
--- a/src/input.c
+++ b/src/input.c
@@ -238,7 +238,10 @@ void break_waitcmd_loop(struct block * buffer) {
} else if (curmode == VISUAL_MODE) {
exit_visualmode();
}
- if (curmode == INSERT_MODE && lastmode == EDIT_MODE) {
+ if (
+ curmode == INSERT_MODE &&
+ ( lastmode == EDIT_MODE || get_conf_int("input_edit_mode") )
+ ) {
if (inputline_pos && wcslen(inputline) >= inputline_pos) {
real_inputline_pos--;
int l = wcwidth(inputline[real_inputline_pos]);