aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/edit.c
diff options
context:
space:
mode:
authorKunMing Xie <qqzz014@gmail.com>2018-03-12 02:22:58 +0800
committerJustin M. Keyes <justinkz@gmail.com>2018-03-11 19:22:58 +0100
commita2d1e9cc795c651864339a7197a748806f8af5eb (patch)
treec65dac4ee7131e01798735ab6716c3f115d356af /src/nvim/edit.c
parent91547823869cbd76bb3f24365919e94e8d72b528 (diff)
downloadrneovim-a2d1e9cc795c651864339a7197a748806f8af5eb.tar.gz
rneovim-a2d1e9cc795c651864339a7197a748806f8af5eb.tar.bz2
rneovim-a2d1e9cc795c651864339a7197a748806f8af5eb.zip
vim-patch:8.0.0262,8.0.0263 (#8123)
vim-patch:8.0.0262: Farsi support is barely tested Problem: Farsi support is barely tested. Solution: Add more tests for Farsi. Clean up the code. https://github.com/vim/vim/commit/ddf662a1c86ef0b4bd0c55c5f0aa192ebd6d9a5e vim-patch:8.0.0263: Farsi support is not tested enough Problem: Farsi support is not tested enough. Solution: Add more tests for Farsi. Clean up the code. https://github.com/vim/vim/commit/80627cf51fd4274320875193a43ce11cee58c96e
Diffstat (limited to 'src/nvim/edit.c')
-rw-r--r--src/nvim/edit.c39
1 files changed, 19 insertions, 20 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index 35bbe04ff0..cf4328fe0a 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -5241,28 +5241,27 @@ insertchar (
buf[0] = c;
i = 1;
- if (textwidth > 0)
+ if (textwidth > 0) {
virtcol = get_nolist_virtcol();
- /*
- * Stop the string when:
- * - no more chars available
- * - finding a special character (command key)
- * - buffer is full
- * - running into the 'textwidth' boundary
- * - need to check for abbreviation: A non-word char after a word-char
- */
- while ( (c = vpeekc()) != NUL
- && !ISSPECIAL(c)
- && (!has_mbyte || MB_BYTE2LEN_CHECK(c) == 1)
- && i < INPUT_BUFLEN
- && (textwidth == 0
- || (virtcol += byte2cells(buf[i - 1])) < (colnr_T)textwidth)
- && !(!no_abbr && !vim_iswordc(c) && vim_iswordc(buf[i - 1]))) {
+ }
+ // Stop the string when:
+ // - no more chars available
+ // - finding a special character (command key)
+ // - buffer is full
+ // - running into the 'textwidth' boundary
+ // - need to check for abbreviation: A non-word char after a word-char
+ while ((c = vpeekc()) != NUL
+ && !ISSPECIAL(c)
+ && (!has_mbyte || MB_BYTE2LEN_CHECK(c) == 1)
+ && i < INPUT_BUFLEN
+ && !(p_fkmap && KeyTyped) // Farsi mode mapping moves cursor
+ && (textwidth == 0
+ || (virtcol += byte2cells(buf[i - 1])) < (colnr_T)textwidth)
+ && !(!no_abbr && !vim_iswordc(c) && vim_iswordc(buf[i - 1]))) {
c = vgetc();
- if (p_hkmap && KeyTyped)
- c = hkmap(c); /* Hebrew mode mapping */
- if (p_fkmap && KeyTyped)
- c = fkmap(c); /* Farsi mode mapping */
+ if (p_hkmap && KeyTyped) {
+ c = hkmap(c); // Hebrew mode mapping
+ }
buf[i++] = c;
}