mirror of
https://github.com/neovim/neovim.git
synced 2025-12-15 19:05:40 +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:
@@ -773,9 +773,9 @@ static int qf_get_next_buf_line(qfstate_T *state)
|
||||
return QF_END_OF_INPUT;
|
||||
}
|
||||
char *p_buf = ml_get_buf(state->buf, state->buflnum);
|
||||
size_t len = (size_t)ml_get_buf_len(state->buf, state->buflnum);
|
||||
state->buflnum += 1;
|
||||
|
||||
size_t len = strlen(p_buf);
|
||||
if (len > IOSIZE - 2) {
|
||||
state->linebuf = qf_grow_linebuf(state, len);
|
||||
} else {
|
||||
@@ -5356,12 +5356,13 @@ static bool vgr_match_buflines(qf_list_T *qfl, char *fname, buf_T *buf, char *sp
|
||||
break;
|
||||
}
|
||||
col = regmatch->endpos[0].col + (col == regmatch->endpos[0].col);
|
||||
if (col > (colnr_T)strlen(ml_get_buf(buf, lnum))) {
|
||||
if (col > ml_get_buf_len(buf, lnum)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
char *const str = ml_get_buf(buf, lnum);
|
||||
const int line_len = ml_get_buf_len(buf, lnum);
|
||||
int score;
|
||||
uint32_t matches[MAX_FUZZY_MATCHES];
|
||||
const size_t sz = sizeof(matches) / sizeof(matches[0]);
|
||||
@@ -5400,7 +5401,7 @@ static bool vgr_match_buflines(qf_list_T *qfl, char *fname, buf_T *buf, char *sp
|
||||
break;
|
||||
}
|
||||
col = (colnr_T)matches[pat_len - 1] + col + 1;
|
||||
if (col > (colnr_T)strlen(str)) {
|
||||
if (col > line_len) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user