forked from aniani/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: #14183 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
5cac1a9bee
commit
94b7c3233e
@@ -1061,7 +1061,6 @@ find_wl_entry(win_T *win, linenr_T lnum)
|
||||
foldAdjustVisual(void)
|
||||
{
|
||||
pos_T *start, *end;
|
||||
char_u *ptr;
|
||||
|
||||
if (!VIsual_active || !hasAnyFolding(curwin))
|
||||
return;
|
||||
@@ -1082,8 +1081,7 @@ foldAdjustVisual(void)
|
||||
if (!hasFolding(end->lnum, NULL, &end->lnum))
|
||||
return;
|
||||
|
||||
ptr = ml_get(end->lnum);
|
||||
end->col = (colnr_T)STRLEN(ptr);
|
||||
end->col = ml_get_len(end->lnum);
|
||||
if (end->col > 0 && *p_sel == 'o')
|
||||
--end->col;
|
||||
// prevent cursor from moving on the trail byte
|
||||
@@ -1799,7 +1797,7 @@ foldAddMarker(linenr_T lnum, char_u *marker, int markerlen)
|
||||
|
||||
// Allocate a new line: old-line + 'cms'-start + marker + 'cms'-end
|
||||
line = ml_get(lnum);
|
||||
line_len = (int)STRLEN(line);
|
||||
line_len = ml_get_len(lnum);
|
||||
|
||||
if (u_save(lnum - 1, lnum + 1) != OK)
|
||||
return;
|
||||
@@ -1887,7 +1885,7 @@ foldDelMarker(linenr_T lnum, char_u *marker, int markerlen)
|
||||
if (u_save(lnum - 1, lnum + 1) == OK)
|
||||
{
|
||||
// Make new line: text-before-marker + text-after-marker
|
||||
newline = alloc(STRLEN(line) - len + 1);
|
||||
newline = alloc(ml_get_len(lnum) - len + 1);
|
||||
if (newline != NULL)
|
||||
{
|
||||
STRNCPY(newline, line, p - line);
|
||||
|
Reference in New Issue
Block a user