This commit is contained in:
Jan Edmund Lazo 2018-08-23 04:13:29 -04:00
parent 27fbffeb4f
commit 6c8851be4e
5 changed files with 40 additions and 36 deletions

View File

@ -6919,7 +6919,7 @@ bool in_cinkeys(int keytyped, int when, bool line_is_empty)
p = look + STRLEN(look);
if ((try_match || try_match_word)
&& curwin->w_cursor.col >= (colnr_T)(p - look)) {
int match = FALSE;
bool match = false;
if (keytyped == KEY_COMPLETE) {
char_u *s;
@ -6944,28 +6944,30 @@ bool in_cinkeys(int keytyped, int when, bool line_is_empty)
&& (icase
? mb_strnicmp(s, look, (size_t)(p - look))
: STRNCMP(s, look, p - look)) == 0)
match = TRUE;
} else
/* TODO: multi-byte */
if (keytyped == (int)p[-1] || (icase && keytyped < 256
&& TOLOWER_LOC(keytyped) ==
TOLOWER_LOC((int)p[-1]))) {
line = get_cursor_pos_ptr();
assert(p >= look && (uintmax_t)(p - look) <= SIZE_MAX);
if ((curwin->w_cursor.col == (colnr_T)(p - look)
|| !vim_iswordc(line[-(p - look) - 1]))
&& (icase
? mb_strnicmp(line - (p - look), look, (size_t)(p - look))
: STRNCMP(line - (p - look), look, p - look))
== 0)
match = TRUE;
match = true;
} else {
// TODO(@brammool): multi-byte
if (keytyped == (int)p[-1]
|| (icase && keytyped < 256
&& TOLOWER_LOC(keytyped) == TOLOWER_LOC((int)p[-1]))) {
line = get_cursor_pos_ptr();
assert(p >= look && (uintmax_t)(p - look) <= SIZE_MAX);
if ((curwin->w_cursor.col == (colnr_T)(p - look)
|| !vim_iswordc(line[-(p - look) - 1]))
&& (icase
? mb_strnicmp(line - (p - look), look, (size_t)(p - look))
: STRNCMP(line - (p - look), look, p - look)) == 0) {
match = true;
}
}
}
if (match && try_match_word && !try_match) {
/* "0=word": Check if there are only blanks before the
* word. */
if (getwhitecols(line) !=
(int)(curwin->w_cursor.col - (p - look)))
match = FALSE;
(int)(curwin->w_cursor.col - (p - look))) {
match = false;
}
}
if (match) {
return true;

View File

@ -1409,8 +1409,9 @@ static pos_T *find_start_brace(void)
&& (pos = ind_find_start_CORS(NULL)) == NULL) { // XXX
break;
}
if (pos != NULL)
if (pos != NULL) {
curwin->w_cursor.lnum = pos->lnum;
}
}
curwin->w_cursor = cursor_save;
return trypos;
@ -2066,7 +2067,7 @@ int get_c_indent(void)
}
curwin->w_cursor.lnum = lnum;
/* Skip a comment or raw string. XXX */
// Skip a comment or raw string. XXX
if ((trypos = ind_find_start_CORS(NULL)) != NULL) {
lnum = trypos->lnum + 1;
continue;
@ -2588,10 +2589,9 @@ int get_c_indent(void)
break;
}
/*
* If we're in a comment or raw string now, skip to the start
* of it.
*/ /* XXX */
// If we're in a comment or raw string now, skip to the start
// of it.
// XXX
if ((trypos = ind_find_start_CORS(&raw_string_start)) != NULL) {
curwin->w_cursor.lnum = trypos->lnum + 1;
curwin->w_cursor.col = 0;
@ -3359,10 +3359,9 @@ term_again:
l = get_cursor_line_ptr();
/*
* If we're in a comment or raw string now, skip to the start
* of it.
*/ /* XXX */
// If we're in a comment or raw string now, skip to the start
// of it.
// XXX
if ((trypos = ind_find_start_CORS(NULL)) != NULL) {
curwin->w_cursor.lnum = trypos->lnum + 1;
curwin->w_cursor.col = 0;

View File

@ -2049,8 +2049,9 @@ void op_insert(oparg_T *oap, long count1)
ind_pre = (colnr_T)getwhitecols_curline();
firstline = ml_get(oap->start.lnum) + bd.textcol;
if (oap->op_type == OP_APPEND)
if (oap->op_type == OP_APPEND) {
firstline += bd.textlen;
}
pre_textlen = (long)STRLEN(firstline);
}
@ -4132,8 +4133,8 @@ format_lines (
if (next_leader_len > 0) {
(void)del_bytes(next_leader_len, false, false);
mark_col_adjust(curwin->w_cursor.lnum, (colnr_T)0, 0L,
(long)-next_leader_len);
} else if (second_indent > 0) { /* the "leader" for FO_Q_SECOND */
(long)-next_leader_len);
} else if (second_indent > 0) { // the "leader" for FO_Q_SECOND
int indent = (int)getwhitecols_curline();
if (indent > 0) {

View File

@ -2460,9 +2460,10 @@ win_line (
ptr = line;
if (has_spell) {
/* For checking first word with a capital skip white space. */
if (cap_col == 0)
// For checking first word with a capital skip white space.
if (cap_col == 0) {
cap_col = (int)getwhitecols(line);
}
/* To be able to spell-check over line boundaries copy the end of the
* current line into nextline[]. Above the start of the next line was

View File

@ -1398,13 +1398,14 @@ spell_move_to (
capcol = 0;
// For checking first word with a capital skip white space.
if (capcol == 0)
if (capcol == 0) {
capcol = (int)getwhitecols(line);
else if (curline && wp == curwin) {
} else if (curline && wp == curwin) {
// For spellbadword(): check if first word needs a capital.
col = (int)getwhitecols(line);
if (check_need_cap(lnum, col))
if (check_need_cap(lnum, col)) {
capcol = col;
}
// Need to get the line again, may have looked at the previous
// one.