summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Zangl <laktak@cdak.net>2023-01-11 15:14:01 +0100
committerChristian Zangl <laktak@cdak.net>2023-01-11 15:14:01 +0100
commit689f6a9b18963efe73995c0418eb77aa63cf6a8b (patch)
tree3c44f2d6a32fc8627093711884a93dd2833d92dc
parent391d2d61c7e32f184effc08eeab7c4125bddf9ac (diff)
add input_edit_mode setting
This will always go from input to edit mode when pressing ESC.
-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 046ef8e..2497fd4 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 070c30a..ab5ba21 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 input to edit mode when pressing ESC.
+
'underline_grid' [default off]
Underline cells to make a nicer grid
diff --git a/src/gram.y b/src/gram.y
index 606181c..e913454 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
@@ -1561,6 +1562,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]);