mirror of
https://github.com/neovim/neovim.git
synced 2025-09-17 00:38:17 +00:00
refactor(style): switch-case formatting, "uncrustify:indent-off" #15669
* refactor: disable formatting for attribute in macro * fixup: disable/enable uncrustify with uncrustify:indent-off/on * fixup: stop indenting contents inside braces in case * fixup: remove case brace if no variable declaration
This commit is contained in:
150
src/nvim/ops.c
150
src/nvim/ops.c
@@ -2622,64 +2622,64 @@ static void op_yank_reg(oparg_T *oap, bool message, yankreg_T *reg, bool append)
|
||||
break;
|
||||
|
||||
case kMTCharWise: {
|
||||
colnr_T startcol = 0, endcol = MAXCOL;
|
||||
int is_oneChar = false;
|
||||
colnr_T cs, ce;
|
||||
p = ml_get(lnum);
|
||||
bd.startspaces = 0;
|
||||
bd.endspaces = 0;
|
||||
colnr_T startcol = 0, endcol = MAXCOL;
|
||||
int is_oneChar = false;
|
||||
colnr_T cs, ce;
|
||||
p = ml_get(lnum);
|
||||
bd.startspaces = 0;
|
||||
bd.endspaces = 0;
|
||||
|
||||
if (lnum == oap->start.lnum) {
|
||||
startcol = oap->start.col;
|
||||
if (virtual_op) {
|
||||
getvcol(curwin, &oap->start, &cs, NULL, &ce);
|
||||
if (ce != cs && oap->start.coladd > 0) {
|
||||
/* Part of a tab selected -- but don't
|
||||
* double-count it. */
|
||||
bd.startspaces = (ce - cs + 1)
|
||||
- oap->start.coladd;
|
||||
startcol++;
|
||||
}
|
||||
if (lnum == oap->start.lnum) {
|
||||
startcol = oap->start.col;
|
||||
if (virtual_op) {
|
||||
getvcol(curwin, &oap->start, &cs, NULL, &ce);
|
||||
if (ce != cs && oap->start.coladd > 0) {
|
||||
/* Part of a tab selected -- but don't
|
||||
* double-count it. */
|
||||
bd.startspaces = (ce - cs + 1)
|
||||
- oap->start.coladd;
|
||||
startcol++;
|
||||
}
|
||||
}
|
||||
|
||||
if (lnum == oap->end.lnum) {
|
||||
endcol = oap->end.col;
|
||||
if (virtual_op) {
|
||||
getvcol(curwin, &oap->end, &cs, NULL, &ce);
|
||||
if (p[endcol] == NUL || (cs + oap->end.coladd < ce
|
||||
// Don't add space for double-wide
|
||||
// char; endcol will be on last byte
|
||||
// of multi-byte char.
|
||||
&& utf_head_off(p, p + endcol) == 0)) {
|
||||
if (oap->start.lnum == oap->end.lnum
|
||||
&& oap->start.col == oap->end.col) {
|
||||
// Special case: inside a single char
|
||||
is_oneChar = true;
|
||||
bd.startspaces = oap->end.coladd
|
||||
- oap->start.coladd + oap->inclusive;
|
||||
endcol = startcol;
|
||||
} else {
|
||||
bd.endspaces = oap->end.coladd
|
||||
+ oap->inclusive;
|
||||
endcol -= oap->inclusive;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (endcol == MAXCOL) {
|
||||
endcol = (colnr_T)STRLEN(p);
|
||||
}
|
||||
if (startcol > endcol
|
||||
|| is_oneChar) {
|
||||
bd.textlen = 0;
|
||||
} else {
|
||||
bd.textlen = endcol - startcol + oap->inclusive;
|
||||
}
|
||||
bd.textstart = p + startcol;
|
||||
yank_copy_line(reg, &bd, y_idx, false);
|
||||
break;
|
||||
}
|
||||
|
||||
if (lnum == oap->end.lnum) {
|
||||
endcol = oap->end.col;
|
||||
if (virtual_op) {
|
||||
getvcol(curwin, &oap->end, &cs, NULL, &ce);
|
||||
if (p[endcol] == NUL || (cs + oap->end.coladd < ce
|
||||
// Don't add space for double-wide
|
||||
// char; endcol will be on last byte
|
||||
// of multi-byte char.
|
||||
&& utf_head_off(p, p + endcol) == 0)) {
|
||||
if (oap->start.lnum == oap->end.lnum
|
||||
&& oap->start.col == oap->end.col) {
|
||||
// Special case: inside a single char
|
||||
is_oneChar = true;
|
||||
bd.startspaces = oap->end.coladd
|
||||
- oap->start.coladd + oap->inclusive;
|
||||
endcol = startcol;
|
||||
} else {
|
||||
bd.endspaces = oap->end.coladd
|
||||
+ oap->inclusive;
|
||||
endcol -= oap->inclusive;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (endcol == MAXCOL) {
|
||||
endcol = (colnr_T)STRLEN(p);
|
||||
}
|
||||
if (startcol > endcol
|
||||
|| is_oneChar) {
|
||||
bd.textlen = 0;
|
||||
} else {
|
||||
bd.textlen = endcol - startcol + oap->inclusive;
|
||||
}
|
||||
bd.textstart = p + startcol;
|
||||
yank_copy_line(reg, &bd, y_idx, false);
|
||||
break;
|
||||
}
|
||||
// NOTREACHED
|
||||
case kMTUnknown:
|
||||
abort();
|
||||
@@ -5781,15 +5781,15 @@ void cursor_pos_info(dict_T *dict)
|
||||
len = MAXCOL;
|
||||
break;
|
||||
case 'v': {
|
||||
colnr_T start_col = (lnum == min_pos.lnum)
|
||||
colnr_T start_col = (lnum == min_pos.lnum)
|
||||
? min_pos.col : 0;
|
||||
colnr_T end_col = (lnum == max_pos.lnum)
|
||||
colnr_T end_col = (lnum == max_pos.lnum)
|
||||
? max_pos.col - start_col + 1 : MAXCOL;
|
||||
|
||||
s = ml_get(lnum) + start_col;
|
||||
len = end_col;
|
||||
}
|
||||
break;
|
||||
s = ml_get(lnum) + start_col;
|
||||
len = end_col;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (s != NULL) {
|
||||
byte_count_cursor += line_count_info(s, &word_count_cursor,
|
||||
@@ -6221,23 +6221,19 @@ static void set_clipboard(int name, yankreg_T *reg)
|
||||
|
||||
char regtype;
|
||||
switch (reg->y_type) {
|
||||
case kMTLineWise: {
|
||||
regtype = 'V';
|
||||
tv_list_append_string(lines, NULL, 0);
|
||||
break;
|
||||
}
|
||||
case kMTCharWise: {
|
||||
regtype = 'v';
|
||||
break;
|
||||
}
|
||||
case kMTBlockWise: {
|
||||
regtype = 'b';
|
||||
tv_list_append_string(lines, NULL, 0);
|
||||
break;
|
||||
}
|
||||
case kMTUnknown: {
|
||||
abort();
|
||||
}
|
||||
case kMTLineWise:
|
||||
regtype = 'V';
|
||||
tv_list_append_string(lines, NULL, 0);
|
||||
break;
|
||||
case kMTCharWise:
|
||||
regtype = 'v';
|
||||
break;
|
||||
case kMTBlockWise:
|
||||
regtype = 'b';
|
||||
tv_list_append_string(lines, NULL, 0);
|
||||
break;
|
||||
case kMTUnknown:
|
||||
abort();
|
||||
}
|
||||
|
||||
list_T *args = tv_list_alloc(3);
|
||||
|
Reference in New Issue
Block a user