diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2021-07-25 19:35:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-25 19:35:23 +0200 |
commit | 192adfe99f33778a85e11fbfdceb37f347a3d235 (patch) | |
tree | 529e922ff73a8907df3538ac25f0efb685348f6b /src/nvim/getchar.c | |
parent | f15c74550252a553eaecb3f55af60d7f7ae27540 (diff) | |
parent | 8ce092941862a18a6591f62f398ed9e8bd9202be (diff) | |
download | rneovim-192adfe99f33778a85e11fbfdceb37f347a3d235.tar.gz rneovim-192adfe99f33778a85e11fbfdceb37f347a3d235.tar.bz2 rneovim-192adfe99f33778a85e11fbfdceb37f347a3d235.zip |
Merge pull request #14311 from matveyt/nomode_ce
refactor(state): Remove EXMODE_NORMAL
Diffstat (limited to 'src/nvim/getchar.c')
-rw-r--r-- | src/nvim/getchar.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index 538ebf7978..b0d06b7a30 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -2230,20 +2230,22 @@ static int vgetorpeek(bool advance) timedout = true; continue; } - /* When 'insertmode' is set, ESC just beeps in Insert - * mode. Use CTRL-L to make edit() return. - * For the command line only CTRL-C always breaks it. - * For the cmdline window: Alternate between ESC and - * CTRL-C: ESC for most situations and CTRL-C to close the - * cmdline window. */ - if (p_im && (State & INSERT)) + // When 'insertmode' is set, ESC just beeps in Insert + // mode. Use CTRL-L to make edit() return. + // In Ex-mode \n is compatible with original Vim behaviour. + // For the command line only CTRL-C always breaks it. + // For the cmdline window: Alternate between ESC and + // CTRL-C: ESC for most situations and CTRL-C to close the + // cmdline window. + if (p_im && (State & INSERT)) { c = Ctrl_L; - else if ((State & CMDLINE) - || (cmdwin_type > 0 && tc == ESC) - ) + } else if (exmode_active) { + c = '\n'; + } else if ((State & CMDLINE) || (cmdwin_type > 0 && tc == ESC)) { c = Ctrl_C; - else + } else { c = ESC; + } tc = c; break; } |