char_u *s;
int todo;
int ind_len; // measured in characters
- int line_len;
+ int line_len; // size of the line (including the NUL)
int doit = FALSE;
int ind_done = 0; // measured in spaces
#ifdef FEAT_VARTABS
todo = size;
ind_len = 0;
p = oldline = ml_get_curline();
+ line_len = ml_get_curline_len() + 1;
// Calculate the buffer size for the new indent, and check to see if it
// isn't already set
if (flags & SIN_INSERT)
p = oldline;
else
+ {
p = skipwhite(p);
- line_len = (int)STRLEN(p) + 1;
+ line_len -= (int)(p - oldline);
+ }
// If 'preserveindent' and 'expandtab' are both set keep the original
// characters and allocate accordingly. We will fill the rest with spaces
// MODE_VREPLACE state needs to know what the line was like before changing
if (State & VREPLACE_FLAG)
{
- orig_line = vim_strsave(ml_get_curline()); // Deal with NULL below
+ orig_line = vim_strnsave(ml_get_curline(), ml_get_curline_len()); // Deal with NULL below
orig_col = curwin->w_cursor.col;
}
return;
// Save new line
- new_line = vim_strsave(ml_get_curline());
+ new_line = vim_strnsave(ml_get_curline(), ml_get_curline_len());
if (new_line == NULL)
return;
for (lnum = eap->line1; !got_int && lnum <= eap->line2; ++lnum)
{
ptr = ml_get(lnum);
+ old_len = ml_get_len(lnum);
col = 0;
vcol = 0;
did_undo = FALSE;
// len is actual number of white characters used
len = num_spaces + num_tabs;
- old_len = (long)STRLEN(ptr);
new_len = old_len - col + start_col + len + 1;
if (new_len <= 0 || new_len >= MAXCOL)
{
first_line = lnum;
last_line = lnum;
ptr = new_line;
+ old_len = new_len - 1;
col = start_col + len;
}
}
while (*word != NUL)
{
- (void)copy_option_part(&word, buf, LSIZE, ",");
- len = (int)STRLEN(buf);
+ len = copy_option_part(&word, buf, LSIZE, ",");
if (STRNCMP(buf, p, len) == 0 && IS_WHITE_OR_NUL(p[len]))
return TRUE;
}