diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-01-15 06:32:35 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2023-01-15 07:59:45 +0800 |
commit | 89f45dc155d24e797c144b32de109b64368f20ea (patch) | |
tree | 9c152a7df56e1f3b1eeb771f9424d50233c9d20e /src/nvim/spellsuggest.c | |
parent | fe17cd50fbff5ebed44b6b0d46f3dc933696c1da (diff) | |
download | rneovim-89f45dc155d24e797c144b32de109b64368f20ea.tar.gz rneovim-89f45dc155d24e797c144b32de109b64368f20ea.tar.bz2 rneovim-89f45dc155d24e797c144b32de109b64368f20ea.zip |
vim-patch:8.2.4563: "z=" in Visual mode may go beyond the end of the line
Problem: "z=" in Visual mode may go beyond the end of the line.
Solution: Adjust "badlen".
https://github.com/vim/vim/commit/5c68617d395f9d7b824f68475b24ce3e38d653a3
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'src/nvim/spellsuggest.c')
-rw-r--r-- | src/nvim/spellsuggest.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/nvim/spellsuggest.c b/src/nvim/spellsuggest.c index aef26ef288..9db7efb03b 100644 --- a/src/nvim/spellsuggest.c +++ b/src/nvim/spellsuggest.c @@ -483,6 +483,11 @@ void spell_suggest(int count) } badlen++; end_visual_mode(); + // make sure we don't include the NUL at the end of the line + line = get_cursor_line_ptr(); + if (badlen > (int)strlen(line) - (int)curwin->w_cursor.col) { + badlen = (int)strlen(line) - (int)curwin->w_cursor.col; + } // Find the start of the badly spelled word. } else if (spell_move_to(curwin, FORWARD, true, true, NULL) == 0 || curwin->w_cursor.col > prev_cursor.col) { |