mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
refactor: follow style guide
This commit is contained in:
parent
84f6216130
commit
ab2aad509d
@ -1316,9 +1316,3 @@ struct window_S {
|
|||||||
// Size of the w_statuscol_click_defs array
|
// Size of the w_statuscol_click_defs array
|
||||||
size_t w_statuscol_click_defs_size;
|
size_t w_statuscol_click_defs_size;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Macros defined in Vim, but not in Neovim
|
|
||||||
// uncrustify:off
|
|
||||||
#define CHANGEDTICK(buf) \
|
|
||||||
(=== Include buffer.h & use buf_(get|set|inc) _changedtick ===)
|
|
||||||
// uncrustify:on
|
|
||||||
|
@ -105,7 +105,6 @@ static int get_function_args(char **argp, char endchar, garray_T *newargs, int *
|
|||||||
bool mustend = false;
|
bool mustend = false;
|
||||||
char *arg = *argp;
|
char *arg = *argp;
|
||||||
char *p = arg;
|
char *p = arg;
|
||||||
uint8_t c;
|
|
||||||
|
|
||||||
if (newargs != NULL) {
|
if (newargs != NULL) {
|
||||||
ga_init(newargs, (int)sizeof(char *), 3);
|
ga_init(newargs, (int)sizeof(char *), 3);
|
||||||
@ -142,7 +141,7 @@ static int get_function_args(char **argp, char endchar, garray_T *newargs, int *
|
|||||||
}
|
}
|
||||||
if (newargs != NULL) {
|
if (newargs != NULL) {
|
||||||
ga_grow(newargs, 1);
|
ga_grow(newargs, 1);
|
||||||
c = (uint8_t)(*p);
|
uint8_t c = (uint8_t)(*p);
|
||||||
*p = NUL;
|
*p = NUL;
|
||||||
arg = xstrdup(arg);
|
arg = xstrdup(arg);
|
||||||
|
|
||||||
@ -173,7 +172,7 @@ static int get_function_args(char **argp, char endchar, garray_T *newargs, int *
|
|||||||
while (p > expr && ascii_iswhite(p[-1])) {
|
while (p > expr && ascii_iswhite(p[-1])) {
|
||||||
p--;
|
p--;
|
||||||
}
|
}
|
||||||
c = (uint8_t)(*p);
|
uint8_t c = (uint8_t)(*p);
|
||||||
*p = NUL;
|
*p = NUL;
|
||||||
expr = xstrdup(expr);
|
expr = xstrdup(expr);
|
||||||
((char **)(default_args->ga_data))[default_args->ga_len] = expr;
|
((char **)(default_args->ga_data))[default_args->ga_len] = expr;
|
||||||
@ -325,7 +324,6 @@ int get_lambda_tv(char **arg, typval_T *rettv, evalarg_T *evalarg)
|
|||||||
|
|
||||||
if (evaluate) {
|
if (evaluate) {
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
char *p;
|
|
||||||
garray_T newlines;
|
garray_T newlines;
|
||||||
|
|
||||||
char *name = get_lambda_name();
|
char *name = get_lambda_name();
|
||||||
@ -338,7 +336,7 @@ int get_lambda_tv(char **arg, typval_T *rettv, evalarg_T *evalarg)
|
|||||||
|
|
||||||
// Add "return " before the expression.
|
// Add "return " before the expression.
|
||||||
size_t len = (size_t)(7 + end - start + 1);
|
size_t len = (size_t)(7 + end - start + 1);
|
||||||
p = xmalloc(len);
|
char *p = xmalloc(len);
|
||||||
((char **)(newlines.ga_data))[newlines.ga_len++] = p;
|
((char **)(newlines.ga_data))[newlines.ga_len++] = p;
|
||||||
STRCPY(p, "return ");
|
STRCPY(p, "return ");
|
||||||
xstrlcpy(p + 7, start, (size_t)(end - start) + 1);
|
xstrlcpy(p + 7, start, (size_t)(end - start) + 1);
|
||||||
@ -918,7 +916,6 @@ void call_user_func(ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rett
|
|||||||
FUNC_ATTR_NONNULL_ARG(1, 3, 4)
|
FUNC_ATTR_NONNULL_ARG(1, 3, 4)
|
||||||
{
|
{
|
||||||
bool using_sandbox = false;
|
bool using_sandbox = false;
|
||||||
int save_did_emsg;
|
|
||||||
static int depth = 0;
|
static int depth = 0;
|
||||||
dictitem_T *v;
|
dictitem_T *v;
|
||||||
int fixvar_idx = 0; // index in fc_fixvar[]
|
int fixvar_idx = 0; // index in fc_fixvar[]
|
||||||
@ -1167,7 +1164,7 @@ void call_user_func(ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rett
|
|||||||
|
|
||||||
const sctx_T save_current_sctx = current_sctx;
|
const sctx_T save_current_sctx = current_sctx;
|
||||||
current_sctx = fp->uf_script_ctx;
|
current_sctx = fp->uf_script_ctx;
|
||||||
save_did_emsg = did_emsg;
|
int save_did_emsg = did_emsg;
|
||||||
did_emsg = false;
|
did_emsg = false;
|
||||||
|
|
||||||
if (default_arg_err && (fp->uf_flags & FC_ABORT)) {
|
if (default_arg_err && (fp->uf_flags & FC_ABORT)) {
|
||||||
|
@ -221,10 +221,6 @@ int get_number(int colon, int *mouse_used)
|
|||||||
/// the line number.
|
/// the line number.
|
||||||
int prompt_for_number(int *mouse_used)
|
int prompt_for_number(int *mouse_used)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
int save_cmdline_row;
|
|
||||||
int save_State;
|
|
||||||
|
|
||||||
// When using ":silent" assume that <CR> was entered.
|
// When using ":silent" assume that <CR> was entered.
|
||||||
if (mouse_used != NULL) {
|
if (mouse_used != NULL) {
|
||||||
msg_puts(_("Type number and <Enter> or click with the mouse "
|
msg_puts(_("Type number and <Enter> or click with the mouse "
|
||||||
@ -235,14 +231,14 @@ int prompt_for_number(int *mouse_used)
|
|||||||
|
|
||||||
// Set the state such that text can be selected/copied/pasted and we still
|
// Set the state such that text can be selected/copied/pasted and we still
|
||||||
// get mouse events.
|
// get mouse events.
|
||||||
save_cmdline_row = cmdline_row;
|
int save_cmdline_row = cmdline_row;
|
||||||
cmdline_row = 0;
|
cmdline_row = 0;
|
||||||
save_State = State;
|
int save_State = State;
|
||||||
State = MODE_ASKMORE; // prevents a screen update when using a timer
|
State = MODE_ASKMORE; // prevents a screen update when using a timer
|
||||||
// May show different mouse shape.
|
// May show different mouse shape.
|
||||||
setmouse();
|
setmouse();
|
||||||
|
|
||||||
i = get_number(true, mouse_used);
|
int i = get_number(true, mouse_used);
|
||||||
if (KeyTyped) {
|
if (KeyTyped) {
|
||||||
// don't call wait_return() now
|
// don't call wait_return() now
|
||||||
if (msg_row > 0) {
|
if (msg_row > 0) {
|
||||||
|
@ -875,9 +875,7 @@ char *replace_termcodes(const char *const from, const size_t from_len, char **co
|
|||||||
const char *const cpo_val)
|
const char *const cpo_val)
|
||||||
FUNC_ATTR_NONNULL_ARG(1, 3, 7)
|
FUNC_ATTR_NONNULL_ARG(1, 3, 7)
|
||||||
{
|
{
|
||||||
char key;
|
|
||||||
size_t dlen = 0;
|
size_t dlen = 0;
|
||||||
const char *src;
|
|
||||||
const char *const end = from + from_len - 1;
|
const char *const end = from + from_len - 1;
|
||||||
|
|
||||||
// backslash is a special character
|
// backslash is a special character
|
||||||
@ -891,7 +889,7 @@ char *replace_termcodes(const char *const from, const size_t from_len, char **co
|
|||||||
const size_t buf_len = allocated ? from_len * 6 + 1 : 128;
|
const size_t buf_len = allocated ? from_len * 6 + 1 : 128;
|
||||||
char *result = allocated ? xmalloc(buf_len) : *bufp; // buffer for resulting string
|
char *result = allocated ? xmalloc(buf_len) : *bufp; // buffer for resulting string
|
||||||
|
|
||||||
src = from;
|
const char *src = from;
|
||||||
|
|
||||||
// Copy each byte from *from to result[dlen]
|
// Copy each byte from *from to result[dlen]
|
||||||
while (src <= end) {
|
while (src <= end) {
|
||||||
@ -966,7 +964,7 @@ char *replace_termcodes(const char *const from, const size_t from_len, char **co
|
|||||||
// For "from" side the CTRL-V at the end is included, for the "to"
|
// For "from" side the CTRL-V at the end is included, for the "to"
|
||||||
// part it is removed.
|
// part it is removed.
|
||||||
// If 'cpoptions' does not contain 'B', also accept a backslash.
|
// If 'cpoptions' does not contain 'B', also accept a backslash.
|
||||||
key = *src;
|
char key = *src;
|
||||||
if (key == Ctrl_V || (do_backslash && key == '\\')) {
|
if (key == Ctrl_V || (do_backslash && key == '\\')) {
|
||||||
src++; // skip CTRL-V or backslash
|
src++; // skip CTRL-V or backslash
|
||||||
if (src > end) {
|
if (src > end) {
|
||||||
|
@ -23,9 +23,9 @@
|
|||||||
|
|
||||||
#include "nvim/func_attr.h"
|
#include "nvim/func_attr.h"
|
||||||
|
|
||||||
typedef struct _queue {
|
typedef struct queue {
|
||||||
struct _queue *next;
|
struct queue *next;
|
||||||
struct _queue *prev;
|
struct queue *prev;
|
||||||
} QUEUE;
|
} QUEUE;
|
||||||
|
|
||||||
// Public macros.
|
// Public macros.
|
||||||
|
@ -450,10 +450,8 @@ static void next_search_hl(win_T *win, match_T *search_hl, match_T *shl, linenr_
|
|||||||
} else if (vim_strchr(p_cpo, CPO_SEARCH) == NULL
|
} else if (vim_strchr(p_cpo, CPO_SEARCH) == NULL
|
||||||
|| (shl->rm.endpos[0].lnum == 0
|
|| (shl->rm.endpos[0].lnum == 0
|
||||||
&& shl->rm.endpos[0].col <= shl->rm.startpos[0].col)) {
|
&& shl->rm.endpos[0].col <= shl->rm.startpos[0].col)) {
|
||||||
char *ml;
|
|
||||||
|
|
||||||
matchcol = shl->rm.startpos[0].col;
|
matchcol = shl->rm.startpos[0].col;
|
||||||
ml = ml_get_buf(shl->buf, lnum) + matchcol;
|
char *ml = ml_get_buf(shl->buf, lnum) + matchcol;
|
||||||
if (*ml == NUL) {
|
if (*ml == NUL) {
|
||||||
matchcol++;
|
matchcol++;
|
||||||
shl->lnum = 0;
|
shl->lnum = 0;
|
||||||
|
@ -215,7 +215,6 @@ int get_extra_op_char(int optype)
|
|||||||
/// handle a shift operation
|
/// handle a shift operation
|
||||||
void op_shift(oparg_T *oap, int curs_top, int amount)
|
void op_shift(oparg_T *oap, int curs_top, int amount)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
int block_col = 0;
|
int block_col = 0;
|
||||||
|
|
||||||
if (u_save((linenr_T)(oap->start.lnum - 1),
|
if (u_save((linenr_T)(oap->start.lnum - 1),
|
||||||
@ -227,7 +226,7 @@ void op_shift(oparg_T *oap, int curs_top, int amount)
|
|||||||
block_col = curwin->w_cursor.col;
|
block_col = curwin->w_cursor.col;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = oap->line_count - 1; i >= 0; i--) {
|
for (int i = oap->line_count - 1; i >= 0; i--) {
|
||||||
int first_char = (uint8_t)(*get_cursor_line_ptr());
|
int first_char = (uint8_t)(*get_cursor_line_ptr());
|
||||||
if (first_char == NUL) { // empty line
|
if (first_char == NUL) { // empty line
|
||||||
curwin->w_cursor.col = 0;
|
curwin->w_cursor.col = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user