mirror of
https://github.com/neovim/neovim.git
synced 2025-10-05 01:16:31 +00:00
vim-patch:9.1.0172: More code can use ml_get_buf_len() instead of STRLEN()
Problem: More code can use ml_get_buf_len() instead of STRLEN().
Solution: Change more STRLEN() calls to ml_get_buf_len(). Also do not
set ml_line_textlen in ml_replace_len() if "has_props" is set,
because "len_arg" also includes the size of text properties in
that case. (zeertzjq)
closes: vim/vim#14183
94b7c3233e
This commit is contained in:
@@ -480,9 +480,8 @@ void spell_suggest(int count)
|
||||
badlen++;
|
||||
end_visual_mode();
|
||||
// make sure we don't include the NUL at the end of the line
|
||||
char *line = get_cursor_line_ptr();
|
||||
if (badlen > (int)strlen(line) - (int)curwin->w_cursor.col) {
|
||||
badlen = (int)strlen(line) - (int)curwin->w_cursor.col;
|
||||
if (badlen > get_cursor_line_len() - curwin->w_cursor.col) {
|
||||
badlen = get_cursor_line_len() - curwin->w_cursor.col;
|
||||
}
|
||||
// Find the start of the badly spelled word.
|
||||
} else if (spell_move_to(curwin, FORWARD, true, true, NULL) == 0
|
||||
@@ -514,7 +513,7 @@ void spell_suggest(int count)
|
||||
int need_cap = check_need_cap(curwin, curwin->w_cursor.lnum, curwin->w_cursor.col);
|
||||
|
||||
// Make a copy of current line since autocommands may free the line.
|
||||
char *line = xstrdup(get_cursor_line_ptr());
|
||||
char *line = xstrnsave(get_cursor_line_ptr(), (size_t)get_cursor_line_len());
|
||||
spell_suggest_timeout = 5000;
|
||||
|
||||
// Get the list of suggestions. Limit to 'lines' - 2 or the number in
|
||||
|
Reference in New Issue
Block a user