diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-01-10 08:46:42 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-10 08:46:42 +0800 |
commit | dc7edce650bc2abbcad2fdc12cb77561b36b35af (patch) | |
tree | c6c1320caf512b85b014d2b720e6406a90a126d6 /src/nvim/digraph.c | |
parent | 364b131f42509326c912c9b0fef5dfc94ed23b41 (diff) | |
download | rneovim-dc7edce650bc2abbcad2fdc12cb77561b36b35af.tar.gz rneovim-dc7edce650bc2abbcad2fdc12cb77561b36b35af.tar.bz2 rneovim-dc7edce650bc2abbcad2fdc12cb77561b36b35af.zip |
vim-patch:partial:9.0.1166: code is indented more than necessary (#21716)
Problem: Code is indented more than necessary.
Solution: Use an early return where it makes sense. (Yegappan Lakshmanan,
closes vim/vim#11792)
https://github.com/vim/vim/commit/1cfb14aa972ccf3235ac67f07b7db1175b7c5384
Partial port as some highlight.c changes depend on previous patches.
Cherry-pick fname_match() change from patch 8.2.4959.
Omit internal_func_check_arg_types(): only used for Vim9 script.
N/A patches for version.c:
vim-patch:9.0.1167: EditorConfig files do not have their own filetype
Problem: EditorConfig files do not have their own filetype.
Solution: Add the "editorconfig" filetype. (Gregory Anders, closes vim/vim#11779)
https://github.com/vim/vim/commit/d41262ed06564cef98a3800e2928e6e0db91abbf
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Diffstat (limited to 'src/nvim/digraph.c')
-rw-r--r-- | src/nvim/digraph.c | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/src/nvim/digraph.c b/src/nvim/digraph.c index dc85b39684..744520149f 100644 --- a/src/nvim/digraph.c +++ b/src/nvim/digraph.c @@ -1528,30 +1528,31 @@ int get_digraph(bool cmdline) no_mapping--; allow_keys--; - if (c != ESC) { - // ESC cancels CTRL-K - if (IS_SPECIAL(c)) { - // insert special key code - return c; - } + if (c == ESC) { // ESC cancels CTRL-K + return NUL; + } - if (cmdline) { - if ((char2cells(c) == 1) && c < 128 && (cmdline_star == 0)) { - putcmdline((char)c, true); - } - } else { - add_to_showcmd(c); - } - no_mapping++; - allow_keys++; - int cc = plain_vgetc(); - no_mapping--; - allow_keys--; - - if (cc != ESC) { - // ESC cancels CTRL-K - return digraph_get(c, cc, true); + if (IS_SPECIAL(c)) { + // insert special key code + return c; + } + + if (cmdline) { + if ((char2cells(c) == 1) && c < 128 && (cmdline_star == 0)) { + putcmdline((char)c, true); } + } else { + add_to_showcmd(c); + } + no_mapping++; + allow_keys++; + int cc = plain_vgetc(); + no_mapping--; + allow_keys--; + + if (cc != ESC) { + // ESC cancels CTRL-K + return digraph_get(c, cc, true); } return NUL; } |