mirror of
https://github.com/neovim/neovim.git
synced 2025-10-05 09:26:30 +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:
@@ -1342,7 +1342,7 @@ size_t spell_move_to(win_T *wp, int dir, bool allwords, bool curline, hlf_T *att
|
||||
while (!got_int) {
|
||||
char *line = ml_get_buf(wp->w_buffer, lnum);
|
||||
|
||||
len = strlen(line);
|
||||
len = (size_t)ml_get_buf_len(wp->w_buffer, lnum);
|
||||
if (buflen < len + MAXWLEN + 2) {
|
||||
xfree(buf);
|
||||
buflen = len + MAXWLEN + 2;
|
||||
@@ -2682,7 +2682,7 @@ void ex_spellrepall(exarg_T *eap)
|
||||
char *line = get_cursor_line_ptr();
|
||||
if (addlen <= 0
|
||||
|| strncmp(line + curwin->w_cursor.col, repl_to, repl_to_len) != 0) {
|
||||
char *p = xmalloc(strlen(line) + (size_t)addlen + 1);
|
||||
char *p = xmalloc((size_t)get_cursor_line_len() + (size_t)addlen + 1);
|
||||
memmove(p, line, (size_t)curwin->w_cursor.col);
|
||||
STRCPY(p + curwin->w_cursor.col, repl_to);
|
||||
STRCAT(p, line + curwin->w_cursor.col + repl_from_len);
|
||||
|
Reference in New Issue
Block a user