diff options
author | Christian Zangl <laktak@cdak.net> | 2023-01-11 15:14:01 +0100 |
---|---|---|
committer | Christian Zangl <laktak@cdak.net> | 2023-01-11 15:14:01 +0100 |
commit | 689f6a9b18963efe73995c0418eb77aa63cf6a8b (patch) | |
tree | 3c44f2d6a32fc8627093711884a93dd2833d92dc | |
parent | 391d2d61c7e32f184effc08eeab7c4125bddf9ac (diff) |
add input_edit_mode setting
This will always go from input to edit mode when pressing ESC.
-rw-r--r-- | src/conf.c | 1 | ||||
-rwxr-xr-x | src/doc | 3 | ||||
-rwxr-xr-x | src/gram.y | 8 | ||||
-rw-r--r-- | src/input.c | 5 |
4 files changed, 16 insertions, 1 deletions
@@ -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 @@ -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 @@ -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]); |