From 689f6a9b18963efe73995c0418eb77aa63cf6a8b Mon Sep 17 00:00:00 2001 From: Christian Zangl Date: Wed, 11 Jan 2023 15:14:01 +0100 Subject: add input_edit_mode setting This will always go from input to edit mode when pressing ESC. --- src/conf.c | 1 + src/doc | 3 +++ src/gram.y | 8 ++++++++ src/input.c | 5 ++++- 4 files changed, 16 insertions(+), 1 deletion(-) 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]); -- cgit v1.2.3 From 25254962d0926e638b7cd360ce329814db5c7d59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s?= Date: Thu, 1 Jun 2023 18:43:41 -0300 Subject: Updated doc --- src/doc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc b/src/doc index ab5ba21..fc885ed 100755 --- a/src/doc +++ b/src/doc @@ -1356,7 +1356,7 @@ Commands for handling cell content: 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. + 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 -- cgit v1.2.3