refactor: format with uncrustify #15778

* fixup: force exactly one whitespace between type and variable
This commit is contained in:
dundargoc
2021-09-26 02:16:04 +02:00
committed by GitHub
parent 05d685be52
commit 2f9b9e61d7
28 changed files with 2159 additions and 2313 deletions

View File

@@ -956,10 +956,11 @@ static int do_autocmd_event(event_T event, char_u *pat, bool once, int nested, c
return OK; return OK;
} }
// Implementation of ":doautocmd [group] event [fname]". /// Implementation of ":doautocmd [group] event [fname]".
// Return OK for success, FAIL for failure; /// Return OK for success, FAIL for failure;
int do_doautocmd(char_u *arg, bool do_msg, // give message for no matching autocmds? ///
bool *did_something) /// @param do_msg give message for no matching autocmds?
int do_doautocmd(char_u *arg, bool do_msg, bool *did_something)
{ {
char_u *fname; char_u *fname;
int nothing_done = true; int nothing_done = true;
@@ -1916,8 +1917,8 @@ char_u *get_augroup_name(expand_T *xp, int idx)
return (char_u *)AUGROUP_NAME(idx); return (char_u *)AUGROUP_NAME(idx);
} }
char_u *set_context_in_autocmd(expand_T *xp, char_u *arg, int doautocmd // true for :doauto*, false for :autocmd /// @param doautocmd true for :doauto*, false for :autocmd
) char_u *set_context_in_autocmd(expand_T *xp, char_u *arg, int doautocmd)
{ {
char_u *p; char_u *p;
int group; int group;

View File

@@ -98,10 +98,12 @@ typedef enum {
kBffInitChangedtick = 2, kBffInitChangedtick = 2,
} BufFreeFlags; } BufFreeFlags;
// Read data from buffer for retrying. /// Read data from buffer for retrying.
static int read_buffer(int read_stdin, // read file from stdin, otherwise fifo ///
exarg_T *eap, // for forced 'ff' and 'fenc' or NULL /// @param read_stdin read file from stdin, otherwise fifo
int flags) // extra flags for readfile() /// @param eap for forced 'ff' and 'fenc' or NULL
/// @param flags extra flags for readfile()
static int read_buffer(int read_stdin, exarg_T *eap, int flags)
{ {
int retval = OK; int retval = OK;
linenr_T line_count; linenr_T line_count;
@@ -146,13 +148,15 @@ static int read_buffer(int read_stdin, // read file from stdin, otherwis
return retval; return retval;
} }
// Open current buffer, that is: open the memfile and read the file into /// Open current buffer, that is: open the memfile and read the file into
// memory. /// memory.
// Return FAIL for failure, OK otherwise. ///
int open_buffer(int read_stdin, // read file from stdin /// @param read_stdin read file from stdin
exarg_T *eap, // for forced 'ff' and 'fenc' or NULL /// @param eap for forced 'ff' and 'fenc' or NULL
int flags // extra flags for readfile() /// @param flags extra flags for readfile()
) ///
/// @return FAIL for failure, OK otherwise.
int open_buffer(int read_stdin, exarg_T *eap, int flags)
{ {
int retval = OK; int retval = OK;
bufref_T old_curbuf; bufref_T old_curbuf;
@@ -939,23 +943,22 @@ void handle_swap_exists(bufref_T *old_curbuf)
swap_exists_action = SEA_NONE; // -V519 swap_exists_action = SEA_NONE; // -V519
} }
/* /// do_bufdel() - delete or unload buffer(s)
* do_bufdel() - delete or unload buffer(s) ///
* /// addr_count == 0: ":bdel" - delete current buffer
* addr_count == 0: ":bdel" - delete current buffer /// addr_count == 1: ":N bdel" or ":bdel N [N ..]" - first delete
* addr_count == 1: ":N bdel" or ":bdel N [N ..]" - first delete /// buffer "end_bnr", then any other arguments.
* buffer "end_bnr", then any other arguments. /// addr_count == 2: ":N,N bdel" - delete buffers in range
* addr_count == 2: ":N,N bdel" - delete buffers in range ///
* /// command can be DOBUF_UNLOAD (":bunload"), DOBUF_WIPE (":bwipeout") or
* command can be DOBUF_UNLOAD (":bunload"), DOBUF_WIPE (":bwipeout") or /// DOBUF_DEL (":bdel")
* DOBUF_DEL (":bdel") ///
* /// @param arg pointer to extra arguments
* Returns error message or NULL /// @param start_bnr first buffer number in a range
*/ /// @param end_bnr buffer nr or last buffer nr in a range
char_u *do_bufdel(int command, char_u *arg, // pointer to extra arguments ///
int addr_count, int start_bnr, // first buffer number in a range /// @return error message or NULL
int end_bnr, // buffer nr or last buffer nr in a range char_u *do_bufdel(int command, char_u *arg, int addr_count, int start_bnr, int end_bnr, int forceit)
int forceit)
{ {
int do_current = 0; // delete current buffer? int do_current = 0; // delete current buffer?
int deleted = 0; // number of buffers deleted int deleted = 0; // number of buffers deleted
@@ -1097,26 +1100,26 @@ static int empty_curbuf(int close_others, int forceit, int action)
return retval; return retval;
} }
/*
* Implementation of the commands for the buffer list. /// Implementation of the commands for the buffer list.
* ///
* action == DOBUF_GOTO go to specified buffer /// action == DOBUF_GOTO go to specified buffer
* action == DOBUF_SPLIT split window and go to specified buffer /// action == DOBUF_SPLIT split window and go to specified buffer
* action == DOBUF_UNLOAD unload specified buffer(s) /// action == DOBUF_UNLOAD unload specified buffer(s)
* action == DOBUF_DEL delete specified buffer(s) from buffer list /// action == DOBUF_DEL delete specified buffer(s) from buffer list
* action == DOBUF_WIPE delete specified buffer(s) really /// action == DOBUF_WIPE delete specified buffer(s) really
* ///
* start == DOBUF_CURRENT go to "count" buffer from current buffer /// start == DOBUF_CURRENT go to "count" buffer from current buffer
* start == DOBUF_FIRST go to "count" buffer from first buffer /// start == DOBUF_FIRST go to "count" buffer from first buffer
* start == DOBUF_LAST go to "count" buffer from last buffer /// start == DOBUF_LAST go to "count" buffer from last buffer
* start == DOBUF_MOD go to "count" modified buffer from current buffer /// start == DOBUF_MOD go to "count" modified buffer from current buffer
* ///
* Return FAIL or OK. /// @param dir FORWARD or BACKWARD
*/ /// @param count buffer number or number of buffers
int do_buffer(int action, int start, int dir, // FORWARD or BACKWARD /// @param forceit true for :...!
int count, // buffer number or number of buffers ///
int forceit // true for :...! /// @return FAIL or OK.
) int do_buffer(int action, int start, int dir, int count, int forceit)
{ {
buf_T *buf; buf_T *buf;
buf_T *bp; buf_T *bp;
@@ -2154,11 +2157,13 @@ static buf_T *buflist_findname_file_id(char_u *ffname, FileID *file_id, bool fil
/// Find file in buffer list by a regexp pattern. /// Find file in buffer list by a regexp pattern.
/// Return fnum of the found buffer. /// Return fnum of the found buffer.
/// Return < 0 for error. /// Return < 0 for error.
int buflist_findpat(const char_u *pattern, const char_u *pattern_end, // pointer to first char after pattern ///
bool unlisted, // find unlisted buffers /// @param pattern_end pointer to first char after pattern
bool diffmode, // find diff-mode buffers only /// @param unlisted find unlisted buffers
bool curtab_only // find buffers in current tab only /// @param diffmode find diff-mode buffers only
) /// @param curtab_only find buffers in current tab only
int buflist_findpat(const char_u *pattern, const char_u *pattern_end, bool unlisted, bool diffmode,
bool curtab_only)
FUNC_ATTR_NONNULL_ARG(1) FUNC_ATTR_NONNULL_ARG(1)
{ {
int match = -1; int match = -1;
@@ -2466,14 +2471,14 @@ buf_T *buflist_findnr(int nr)
return handle_get_buffer((handle_T)nr); return handle_get_buffer((handle_T)nr);
} }
/* /// Get name of file 'n' in the buffer list.
* Get name of file 'n' in the buffer list. /// When the file has no name an empty string is returned.
* When the file has no name an empty string is returned. /// home_replace() is used to shorten the file name (used for marks).
* home_replace() is used to shorten the file name (used for marks). ///
* Returns a pointer to allocated memory, of NULL when failed. /// @param helptail for help buffers return tail only
*/ ///
char_u *buflist_nr2name(int n, int fullname, int helptail // for help buffers return tail only /// @return a pointer to allocated memory, of NULL when failed.
) char_u *buflist_nr2name(int n, int fullname, int helptail)
{ {
buf_T *buf; buf_T *buf;
@@ -2800,13 +2805,14 @@ int buflist_name_nr(int fnum, char_u **fname, linenr_T *lnum)
return OK; return OK;
} }
// Set the file name for "buf" to "ffname_arg", short file name to /// Set the file name for "buf" to "ffname_arg", short file name to
// "sfname_arg". /// "sfname_arg".
// The file name with the full path is also remembered, for when :cd is used. /// The file name with the full path is also remembered, for when :cd is used.
// Returns FAIL for failure (file name already in use by other buffer) ///
// OK otherwise. /// @param message give message when buffer already exists
int setfname(buf_T *buf, char_u *ffname_arg, char_u *sfname_arg, bool message // give message when buffer already exists ///
) /// @return FAIL for failure (file name already in use by other buffer) OK otherwise.
int setfname(buf_T *buf, char_u *ffname_arg, char_u *sfname_arg, bool message)
{ {
char_u *ffname = ffname_arg; char_u *ffname = ffname_arg;
char_u *sfname = sfname_arg; char_u *sfname = sfname_arg;
@@ -2934,12 +2940,11 @@ buf_T *setaltfname(char_u *ffname, char_u *sfname, linenr_T lnum)
return buf; return buf;
} }
/* /// Get alternate file name for current window.
* Get alternate file name for current window. /// Return NULL if there isn't any, and give error message if requested.
* Return NULL if there isn't any, and give error message if requested. ///
*/ /// @param errmsg give error message
char_u *getaltfname(bool errmsg // give error message char_u *getaltfname(bool errmsg)
)
{ {
char_u *fname; char_u *fname;
linenr_T dummy; linenr_T dummy;
@@ -3078,11 +3083,10 @@ static bool buf_same_file_id(buf_T *buf, FileID *file_id)
return buf->file_id_valid && os_fileid_equal(&(buf->file_id), file_id); return buf->file_id_valid && os_fileid_equal(&(buf->file_id), file_id);
} }
/* /// Print info about the current buffer.
* Print info about the current buffer. ///
*/ /// @param fullname when non-zero print full path
void fileinfo(int fullname, // when non-zero print full path void fileinfo(int fullname, int shorthelp, int dont_truncate)
int shorthelp, int dont_truncate)
{ {
char_u *name; char_u *name;
int n; int n;
@@ -4751,12 +4755,11 @@ char_u *alist_name(aentry_T *aep)
return bp->b_fname; return bp->b_fname;
} }
/* /// do_arg_all(): Open up to 'count' windows, one for each argument.
* do_arg_all(): Open up to 'count' windows, one for each argument. ///
*/ /// @param forceit hide buffers in current windows
void do_arg_all(int count, int forceit, // hide buffers in current windows /// @param keep_tabs keep current tabs, for ":tab drop file"
int keep_tabs // keep current tabs, for ":tab drop file" void do_arg_all(int count, int forceit, int keep_tabs)
)
{ {
char_u *opened; // Array of weight for which args are open: char_u *opened; // Array of weight for which args are open:
// 0: not opened // 0: not opened
@@ -5254,12 +5257,11 @@ void do_modelines(int flags)
entered--; entered--;
} }
/* /// chk_modeline() - check a single line for a mode string
* chk_modeline() - check a single line for a mode string /// Return FAIL if an error encountered.
* Return FAIL if an error encountered. ///
*/ /// @param flags Same as for do_modelines().
static int chk_modeline(linenr_T lnum, int flags // Same as for do_modelines(). static int chk_modeline(linenr_T lnum, int flags)
)
{ {
char_u *s; char_u *s;
char_u *e; char_u *e;
@@ -5631,13 +5633,12 @@ bool buf_contents_changed(buf_T *buf)
return differ; return differ;
} }
/* /// Wipe out a buffer and decrement the last buffer number if it was used for
* Wipe out a buffer and decrement the last buffer number if it was used for /// this buffer. Call this to wipe out a temp buffer that does not contain any
* this buffer. Call this to wipe out a temp buffer that does not contain any /// marks.
* marks. ///
*/ /// @param aucmd When true trigger autocommands.
void wipe_buffer(buf_T *buf, bool aucmd // When true trigger autocommands. void wipe_buffer(buf_T *buf, bool aucmd)
)
{ {
if (!aucmd) { if (!aucmd) {
// Don't trigger BufDelete autocommands here. // Don't trigger BufDelete autocommands here.

View File

@@ -461,15 +461,15 @@ void changed_lines_buf(buf_T *buf, linenr_T lnum, linenr_T lnume, long xtra)
/// When only inserting lines, "lnum" and "lnume" are equal. /// When only inserting lines, "lnum" and "lnume" are equal.
/// Takes care of calling changed() and updating b_mod_*. /// Takes care of calling changed() and updating b_mod_*.
/// Careful: may trigger autocommands that reload the buffer. /// Careful: may trigger autocommands that reload the buffer.
void changed_lines(linenr_T lnum, // first line with change ///
colnr_T col, // column in first line with change /// @param lnum first line with change
linenr_T lnume, // line below last changed line /// @param col column in first line with change
long xtra, // number of extra lines (negative when deleting) /// @param lnume line below last changed line
bool do_buf_event // some callers like undo/redo call changed_lines() /// @param xtra number of extra lines (negative when deleting)
// and then increment changedtick *again*. This flag /// @param do_buf_event some callers like undo/redo call changed_lines() and
// allows these callers to send the nvim_buf_lines_event /// then increment changedtick *again*. This flag allows these callers to send
// events after they're done modifying changedtick. /// the nvim_buf_lines_event events after they're done modifying changedtick.
) void changed_lines(linenr_T lnum, colnr_T col, linenr_T lnume, long xtra, bool do_buf_event)
{ {
changed_lines_buf(curbuf, lnum, lnume, xtra); changed_lines_buf(curbuf, lnum, lnume, xtra);
@@ -950,9 +950,10 @@ int copy_indent(int size, char_u *src)
/// "second_line_indent": indent for after ^^D in Insert mode or if flag /// "second_line_indent": indent for after ^^D in Insert mode or if flag
/// OPENLINE_COM_LIST /// OPENLINE_COM_LIST
/// ///
/// @param dir FORWARD or BACKWARD
///
/// @return true on success, false on failure /// @return true on success, false on failure
int open_line(int dir, // FORWARD or BACKWARD int open_line(int dir, int flags, int second_line_indent)
int flags, int second_line_indent)
{ {
char_u *next_line = NULL; // copy of the next line char_u *next_line = NULL; // copy of the next line
char_u *p_extra = NULL; // what goes to next line char_u *p_extra = NULL; // what goes to next line

View File

@@ -93,10 +93,10 @@ int coladvance(colnr_T wcol)
return rc; return rc;
} }
static int coladvance2(pos_T *pos, bool addspaces, // change the text to achieve our goal? /// @param addspaces change the text to achieve our goal?
bool finetune, // change char offset for the exact column /// @param finetune change char offset for the exact column
colnr_T wcol_arg // column to move to (can be negative) /// @param wcol_arg column to move to (can be negative)
) static int coladvance2(pos_T *pos, bool addspaces, bool finetune, colnr_T wcol_arg)
{ {
colnr_T wcol = wcol_arg; colnr_T wcol = wcol_arg;
int idx; int idx;

View File

@@ -718,10 +718,11 @@ void ex_breaklist(exarg_T *eap)
/// Find a breakpoint for a function or sourced file. /// Find a breakpoint for a function or sourced file.
/// Returns line number at which to break; zero when no matching breakpoint. /// Returns line number at which to break; zero when no matching breakpoint.
linenr_T dbg_find_breakpoint(bool file, // true for a file, false for a function ///
char_u *fname, // file or function name /// @param file true for a file, false for a function
linenr_T after // after this line number /// @param fname file or function name
) /// @param after after this line number
linenr_T dbg_find_breakpoint(bool file, char_u *fname, linenr_T after)
{ {
return debuggy_find(file, fname, after, &dbg_breakp, NULL); return debuggy_find(file, fname, after, &dbg_breakp, NULL);
} }
@@ -738,12 +739,13 @@ bool has_profiling(bool file, char_u *fname, bool *fp)
} }
/// Common code for dbg_find_breakpoint() and has_profiling(). /// Common code for dbg_find_breakpoint() and has_profiling().
static linenr_T debuggy_find(bool file, // true for a file, false for a function ///
char_u *fname, // file or function name /// @param file true for a file, false for a function
linenr_T after, // after this line number /// @param fname file or function name
garray_T *gap, // either &dbg_breakp or &prof_ga /// @param after after this line number
bool *fp // if not NULL: return forceit /// @param gap either &dbg_breakp or &prof_ga
) /// @param fp if not NULL: return forceit
static linenr_T debuggy_find(bool file, char_u *fname, linenr_T after, garray_T *gap, bool *fp)
{ {
struct debuggy *bp; struct debuggy *bp;
linenr_T lnum = 0; linenr_T lnum = 0;

View File

@@ -51,8 +51,7 @@ void sha256_start(context_sha256_T *ctx)
ctx->state[7] = 0x5BE0CD19; ctx->state[7] = 0x5BE0CD19;
} }
static void sha256_process(context_sha256_T *ctx, static void sha256_process(context_sha256_T *ctx, const char_u data[SHA256_BUFFER_SIZE])
const char_u data[SHA256_BUFFER_SIZE])
{ {
uint32_t temp1, temp2, W[SHA256_BUFFER_SIZE]; uint32_t temp1, temp2, W[SHA256_BUFFER_SIZE];
uint32_t A, B, C, D, E, F, G, H; uint32_t A, B, C, D, E, F, G, H;
@@ -262,8 +261,8 @@ void sha256_finish(context_sha256_T *ctx, char_u digest[SHA256_SUM_SIZE])
/// ///
/// @returns hex digest of "buf[buf_len]" in a static array. /// @returns hex digest of "buf[buf_len]" in a static array.
/// if "salt" is not NULL also do "salt[salt_len]". /// if "salt" is not NULL also do "salt[salt_len]".
const char *sha256_bytes(const uint8_t *restrict buf, size_t buf_len, const char *sha256_bytes(const uint8_t *restrict buf, size_t buf_len, const uint8_t *restrict salt,
const uint8_t *restrict salt, size_t salt_len) size_t salt_len)
{ {
char_u sha256sum[SHA256_SUM_SIZE]; char_u sha256sum[SHA256_SUM_SIZE];
static char hexit[SHA256_BUFFER_SIZE + 1]; // buf size + NULL static char hexit[SHA256_BUFFER_SIZE + 1]; // buf size + NULL

File diff suppressed because it is too large Load Diff

View File

@@ -6,19 +6,19 @@
// //
#include "nvim/vim.h"
#include "nvim/sign.h"
#include "nvim/ascii.h" #include "nvim/ascii.h"
#include "nvim/buffer.h" #include "nvim/buffer.h"
#include "nvim/charset.h" #include "nvim/charset.h"
#include "nvim/cursor.h" #include "nvim/cursor.h"
#include "nvim/ex_docmd.h"
#include "nvim/edit.h" #include "nvim/edit.h"
#include "nvim/ex_docmd.h"
#include "nvim/fold.h" #include "nvim/fold.h"
#include "nvim/move.h" #include "nvim/move.h"
#include "nvim/screen.h"
#include "nvim/syntax.h"
#include "nvim/option.h" #include "nvim/option.h"
#include "nvim/screen.h"
#include "nvim/sign.h"
#include "nvim/syntax.h"
#include "nvim/vim.h"
/// Struct to hold the sign properties. /// Struct to hold the sign properties.
typedef struct sign sign_T; typedef struct sign sign_T;
@@ -166,17 +166,19 @@ int sign_group_get_next_signid(buf_T *buf, const char_u *groupname)
/// Insert a new sign into the signlist for buffer 'buf' between the 'prev' and /// Insert a new sign into the signlist for buffer 'buf' between the 'prev' and
/// 'next' signs. /// 'next' signs.
static void insert_sign( ///
buf_T *buf, // buffer to store sign in /// @param buf buffer to store sign in
sign_entry_T *prev, // previous sign entry /// @param prev previous sign entry
sign_entry_T *next, // next sign entry /// @param next next sign entry
int id, // sign ID /// @param id sign ID
const char_u *group, // sign group; NULL for global group /// @param group sign group; NULL for global group
int prio, // sign priority /// @param prio sign priority
linenr_T lnum, // line number which gets the mark /// @param lnum line number which gets the mark
int typenr, // typenr of sign we are adding /// @param typenr typenr of sign we are adding
bool has_text_or_icon // sign has text or icon /// @param has_text_or_icon sign has text or icon
) static void insert_sign(buf_T *buf, sign_entry_T *prev, sign_entry_T *next, int id,
const char_u *group, int prio, linenr_T lnum, int typenr,
bool has_text_or_icon)
{ {
sign_entry_T *newsign = xmalloc(sizeof(sign_entry_T)); sign_entry_T *newsign = xmalloc(sizeof(sign_entry_T));
newsign->se_id = id; newsign->se_id = id;
@@ -212,16 +214,17 @@ static void insert_sign(
} }
/// Insert a new sign sorted by line number and sign priority. /// Insert a new sign sorted by line number and sign priority.
static void insert_sign_by_lnum_prio( ///
buf_T *buf, // buffer to store sign in /// @param buf buffer to store sign in
sign_entry_T *prev, // previous sign entry /// @param prev previous sign entry
int id, // sign ID /// @param id sign ID
const char_u *group, // sign group; NULL for global group /// @param group sign group; NULL for global group
int prio, // sign priority /// @param prio sign priority
linenr_T lnum, // line number which gets the mark /// @param lnum line number which gets the mark
int typenr, // typenr of sign we are adding /// @param typenr typenr of sign we are adding
bool has_text_or_icon // sign has text or icon /// @param has_text_or_icon sign has text or icon
) static void insert_sign_by_lnum_prio(buf_T *buf, sign_entry_T *prev, int id, const char_u *group,
int prio, linenr_T lnum, int typenr, bool has_text_or_icon)
{ {
sign_entry_T *sign; sign_entry_T *sign;
@@ -345,15 +348,16 @@ static void sign_sort_by_prio_on_line(buf_T *buf, sign_entry_T *sign)
/// Add the sign into the signlist. Find the right spot to do it though. /// Add the sign into the signlist. Find the right spot to do it though.
void buf_addsign( ///
buf_T *buf, // buffer to store sign in /// @param buf buffer to store sign in
int id, // sign ID /// @param id sign ID
const char_u *groupname, // sign group /// @param groupname sign group
int prio, // sign priority /// @param prio sign priority
linenr_T lnum, // line number which gets the mark /// @param lnum line number which gets the mark
int typenr, // typenr of sign we are adding /// @param typenr typenr of sign we are adding
bool has_text_or_icon // sign has text or icon /// @param has_text_or_icon sign has text or icon
) void buf_addsign(buf_T *buf, int id, const char_u *groupname, int prio, linenr_T lnum, int typenr,
bool has_text_or_icon)
{ {
sign_entry_T *sign; // a sign in the signlist sign_entry_T *sign; // a sign in the signlist
sign_entry_T *prev; // the previous sign sign_entry_T *prev; // the previous sign
@@ -368,8 +372,7 @@ void buf_addsign(
sign_sort_by_prio_on_line(buf, sign); sign_sort_by_prio_on_line(buf, sign);
return; return;
} else if (lnum < sign->se_lnum) { } else if (lnum < sign->se_lnum) {
insert_sign_by_lnum_prio( insert_sign_by_lnum_prio(buf,
buf,
prev, prev,
id, id,
groupname, groupname,
@@ -382,8 +385,7 @@ void buf_addsign(
prev = sign; prev = sign;
} }
insert_sign_by_lnum_prio( insert_sign_by_lnum_prio(buf,
buf,
prev, prev,
id, id,
groupname, groupname,
@@ -393,15 +395,15 @@ void buf_addsign(
has_text_or_icon); has_text_or_icon);
} }
// For an existing, placed sign "markId" change the type to "typenr". /// For an existing, placed sign "markId" change the type to "typenr".
// Returns the line number of the sign, or zero if the sign is not found. /// Returns the line number of the sign, or zero if the sign is not found.
linenr_T buf_change_sign_type( ///
buf_T *buf, // buffer to store sign in /// @param buf buffer to store sign in
int markId, // sign ID /// @param markId sign ID
const char_u *group, // sign group /// @param group sign group
int typenr, // typenr of sign we are adding /// @param typenr typenr of sign we are adding
int prio // sign priority /// @param prio sign priority
) linenr_T buf_change_sign_type(buf_T *buf, int markId, const char_u *group, int typenr, int prio)
{ {
sign_entry_T *sign; // a sign in the signlist sign_entry_T *sign; // a sign in the signlist
@@ -426,8 +428,7 @@ linenr_T buf_change_sign_type(
/// @param max_signs the number of signs, with priority for the ones /// @param max_signs the number of signs, with priority for the ones
/// with the highest Ids. /// with the highest Ids.
/// @return Attrs of the matching sign, or NULL /// @return Attrs of the matching sign, or NULL
sign_attrs_T * sign_get_attr(SignType type, sign_attrs_T sattrs[], sign_attrs_T *sign_get_attr(SignType type, sign_attrs_T sattrs[], int idx, int max_signs)
int idx, int max_signs)
{ {
sign_attrs_T *matches[SIGN_SHOW_MAX]; sign_attrs_T *matches[SIGN_SHOW_MAX];
int nr_matches = 0; int nr_matches = 0;
@@ -520,14 +521,15 @@ int buf_get_signattrs(buf_T *buf, linenr_T lnum, sign_attrs_T sattrs[])
/// If 'group' is '*', then delete the sign in all the groups. If 'group' is /// If 'group' is '*', then delete the sign in all the groups. If 'group' is
/// NULL, then delete the sign in the global group. Otherwise delete the sign in /// NULL, then delete the sign in the global group. Otherwise delete the sign in
/// the specified group. /// the specified group.
/// Returns the line number of the deleted sign. If multiple signs are deleted, ///
/// @param buf buffer sign is stored in
/// @param atlnum sign at this line, 0 - at any line
/// @param id sign id
/// @param group sign group
///
/// @return the line number of the deleted sign. If multiple signs are deleted,
/// then returns the line number of the last sign deleted. /// then returns the line number of the last sign deleted.
linenr_T buf_delsign( linenr_T buf_delsign(buf_T *buf, linenr_T atlnum, int id, char_u *group)
buf_T *buf, // buffer sign is stored in
linenr_T atlnum, // sign at this line, 0 - at any line
int id, // sign id
char_u *group // sign group
)
{ {
sign_entry_T **lastp; // pointer to pointer to current sign sign_entry_T **lastp; // pointer to pointer to current sign
sign_entry_T *sign; // a sign in a b_signlist sign_entry_T *sign; // a sign in a b_signlist
@@ -580,11 +582,11 @@ linenr_T buf_delsign(
/// Find the line number of the sign with the requested id in group 'group'. If /// Find the line number of the sign with the requested id in group 'group'. If
/// the sign does not exist, return 0 as the line number. This will still let /// the sign does not exist, return 0 as the line number. This will still let
/// the correct file get loaded. /// the correct file get loaded.
int buf_findsign( ///
buf_T *buf, // buffer to store sign in /// @param buf buffer to store sign in
int id, // sign ID /// @param id sign ID
char_u *group // sign group /// @param group sign group
) int buf_findsign(buf_T *buf, int id, char_u *group)
{ {
sign_entry_T *sign; // a sign in the signlist sign_entry_T *sign; // a sign in the signlist
@@ -599,11 +601,11 @@ int buf_findsign(
/// Return the sign at line 'lnum' in buffer 'buf'. Returns NULL if a sign is /// Return the sign at line 'lnum' in buffer 'buf'. Returns NULL if a sign is
/// not found at the line. If 'groupname' is NULL, searches in the global group. /// not found at the line. If 'groupname' is NULL, searches in the global group.
static sign_entry_T * buf_getsign_at_line( ///
buf_T *buf, // buffer whose sign we are searching for /// @param buf buffer whose sign we are searching for
linenr_T lnum, // line number of sign /// @param lnum line number of sign
char_u *groupname // sign group name /// @param groupname sign group name
) static sign_entry_T *buf_getsign_at_line(buf_T *buf, linenr_T lnum, char_u *groupname)
{ {
sign_entry_T *sign; // a sign in the signlist sign_entry_T *sign; // a sign in the signlist
@@ -623,11 +625,11 @@ static sign_entry_T * buf_getsign_at_line(
} }
/// Return the identifier of the sign at line number 'lnum' in buffer 'buf'. /// Return the identifier of the sign at line number 'lnum' in buffer 'buf'.
int buf_findsign_id( ///
buf_T *buf, // buffer whose sign we are searching for /// @param buf buffer whose sign we are searching for
linenr_T lnum, // line number of sign /// @param lnum line number of sign
char_u *groupname // sign group name /// @param groupname sign group name
) int buf_findsign_id(buf_T *buf, linenr_T lnum, char_u *groupname)
{ {
sign_entry_T *sign; // a sign in the signlist sign_entry_T *sign; // a sign in the signlist
@@ -720,12 +722,7 @@ void sign_list_placed(buf_T *rbuf, char_u *sign_group)
} }
/// Adjust a placed sign for inserted/deleted lines. /// Adjust a placed sign for inserted/deleted lines.
void sign_mark_adjust( void sign_mark_adjust(linenr_T line1, linenr_T line2, long amount, long amount_after)
linenr_T line1,
linenr_T line2,
long amount,
long amount_after
)
{ {
sign_entry_T *sign; // a sign in a b_signlist sign_entry_T *sign; // a sign in a b_signlist
sign_entry_T *next; // the next sign in a b_signlist sign_entry_T *next; // the next sign in a b_signlist
@@ -769,10 +766,10 @@ void sign_mark_adjust(
/// Find index of a ":sign" subcmd from its name. /// Find index of a ":sign" subcmd from its name.
/// "*end_cmd" must be writable. /// "*end_cmd" must be writable.
static int sign_cmd_idx( ///
char_u *begin_cmd, // begin of sign subcmd /// @param begin_cmd begin of sign subcmd
char_u *end_cmd // just after sign subcmd /// @param end_cmd just after sign subcmd
) static int sign_cmd_idx(char_u *begin_cmd, char_u *end_cmd)
{ {
int idx; int idx;
char_u save = *end_cmd; char_u save = *end_cmd;
@@ -904,14 +901,8 @@ static int sign_define_init_text(sign_T *sp, char_u *text)
} }
/// Define a new sign or update an existing sign /// Define a new sign or update an existing sign
int sign_define_by_name( int sign_define_by_name(char_u *name, char_u *icon, char_u *linehl, char_u *text, char_u *texthl,
char_u *name, char_u *numhl)
char_u *icon,
char_u *linehl,
char_u *text,
char_u *texthl,
char_u *numhl
)
{ {
sign_T *sp_prev; sign_T *sp_prev;
sign_T *sp; sign_T *sp;
@@ -1005,14 +996,8 @@ static void sign_list_by_name(char_u *name)
/// Place a sign at the specified file location or update a sign. /// Place a sign at the specified file location or update a sign.
int sign_place( int sign_place(int *sign_id, const char_u *sign_group, const char_u *sign_name, buf_T *buf,
int *sign_id, linenr_T lnum, int prio)
const char_u *sign_group,
const char_u *sign_name,
buf_T *buf,
linenr_T lnum,
int prio
)
{ {
sign_T *sp; sign_T *sp;
@@ -1038,8 +1023,7 @@ int sign_place(
// ":sign place {id} line={lnum} name={name} file={fname}": // ":sign place {id} line={lnum} name={name} file={fname}":
// place a sign // place a sign
bool has_text_or_icon = sp->sn_text != NULL || sp->sn_icon != NULL; bool has_text_or_icon = sp->sn_text != NULL || sp->sn_icon != NULL;
buf_addsign( buf_addsign(buf,
buf,
*sign_id, *sign_id,
sign_group, sign_group,
prio, prio,
@@ -1194,14 +1178,8 @@ static void sign_define_cmd(char_u *sign_name, char_u *cmdline)
} }
/// ":sign place" command /// ":sign place" command
static void sign_place_cmd( static void sign_place_cmd(buf_T *buf, linenr_T lnum, char_u *sign_name, int id, char_u *group,
buf_T *buf, int prio)
linenr_T lnum,
char_u *sign_name,
int id,
char_u *group,
int prio
)
{ {
if (id <= 0) { if (id <= 0) {
// List signs placed in a file/buffer // List signs placed in a file/buffer
@@ -1233,13 +1211,7 @@ static void sign_place_cmd(
} }
/// ":sign unplace" command /// ":sign unplace" command
static void sign_unplace_cmd( static void sign_unplace_cmd(buf_T *buf, linenr_T lnum, char_u *sign_name, int id, char_u *group)
buf_T *buf,
linenr_T lnum,
char_u *sign_name,
int id,
char_u *group
)
{ {
if (lnum >= 0 || sign_name != NULL || (group != NULL && *group == '\0')) { if (lnum >= 0 || sign_name != NULL || (group != NULL && *group == '\0')) {
EMSG(_(e_invarg)); EMSG(_(e_invarg));
@@ -1296,13 +1268,7 @@ static void sign_unplace_cmd(
/// :sign jump {id} buffer={nr} /// :sign jump {id} buffer={nr}
/// :sign jump {id} group={group} file={fname} /// :sign jump {id} group={group} file={fname}
/// :sign jump {id} group={group} buffer={nr} /// :sign jump {id} group={group} buffer={nr}
static void sign_jump_cmd( static void sign_jump_cmd(buf_T *buf, linenr_T lnum, char_u *sign_name, int id, char_u *group)
buf_T *buf,
linenr_T lnum,
char_u *sign_name,
int id,
char_u *group
)
{ {
if (sign_name == NULL && group == NULL && id == -1) { if (sign_name == NULL && group == NULL && id == -1) {
EMSG(_(e_argreq)); EMSG(_(e_argreq));
@@ -1324,16 +1290,8 @@ static void sign_jump_cmd(
/// ":sign jump" commands. /// ":sign jump" commands.
/// The supported arguments are: line={lnum} name={name} group={group} /// The supported arguments are: line={lnum} name={name} group={group}
/// priority={prio} and file={fname} or buffer={nr}. /// priority={prio} and file={fname} or buffer={nr}.
static int parse_sign_cmd_args( static int parse_sign_cmd_args(int cmd, char_u *arg, char_u **sign_name, int *signid,
int cmd, char_u **group, int *prio, buf_T **buf, linenr_T *lnum)
char_u *arg,
char_u **sign_name,
int *signid,
char_u **group,
int *prio,
buf_T **buf,
linenr_T *lnum
)
{ {
char_u *arg1; char_u *arg1;
char_u *name; char_u *name;
@@ -1574,11 +1532,7 @@ list_T *get_buffer_signs(buf_T *buf)
} }
/// Return information about all the signs placed in a buffer /// Return information about all the signs placed in a buffer
static void sign_get_placed_in_buf( static void sign_get_placed_in_buf(buf_T *buf, linenr_T lnum, int sign_id, const char_u *sign_group,
buf_T *buf,
linenr_T lnum,
int sign_id,
const char_u *sign_group,
list_T *retlist) list_T *retlist)
{ {
dict_T *d; dict_T *d;
@@ -1609,13 +1563,8 @@ static void sign_get_placed_in_buf(
/// Get a list of signs placed in buffer 'buf'. If 'num' is non-zero, return the /// Get a list of signs placed in buffer 'buf'. If 'num' is non-zero, return the
/// sign placed at the line number. If 'lnum' is zero, return all the signs /// sign placed at the line number. If 'lnum' is zero, return all the signs
/// placed in 'buf'. If 'buf' is NULL, return signs placed in all the buffers. /// placed in 'buf'. If 'buf' is NULL, return signs placed in all the buffers.
void sign_get_placed( void sign_get_placed(buf_T *buf, linenr_T lnum, int sign_id, const char_u *sign_group,
buf_T *buf, list_T *retlist)
linenr_T lnum,
int sign_id,
const char_u *sign_group,
list_T *retlist
)
{ {
if (buf != NULL) { if (buf != NULL) {
sign_get_placed_in_buf(buf, lnum, sign_id, sign_group, retlist); sign_get_placed_in_buf(buf, lnum, sign_id, sign_group, retlist);
@@ -1957,11 +1906,7 @@ void sign_define_multiple(list_T *l, list_T *retlist)
/// Place a new sign using the values specified in dict 'dict'. Returns the sign /// Place a new sign using the values specified in dict 'dict'. Returns the sign
/// identifier if successfully placed, otherwise returns 0. /// identifier if successfully placed, otherwise returns 0.
int sign_place_from_dict( int sign_place_from_dict(typval_T *id_tv, typval_T *group_tv, typval_T *name_tv, typval_T *buf_tv,
typval_T *id_tv,
typval_T *group_tv,
typval_T *name_tv,
typval_T *buf_tv,
dict_T *dict) dict_T *dict)
{ {
int sign_id = 0; int sign_id = 0;

View File

@@ -3,19 +3,18 @@
#include <assert.h> #include <assert.h>
#include "nvim/lib/kvec.h"
#include "nvim/ascii.h" #include "nvim/ascii.h"
#include "nvim/log.h"
#include "nvim/state.h"
#include "nvim/vim.h"
#include "nvim/main.h"
#include "nvim/getchar.h"
#include "nvim/option_defs.h"
#include "nvim/ui.h"
#include "nvim/os/input.h"
#include "nvim/ex_docmd.h"
#include "nvim/edit.h" #include "nvim/edit.h"
#include "nvim/ex_docmd.h"
#include "nvim/getchar.h"
#include "nvim/lib/kvec.h"
#include "nvim/log.h"
#include "nvim/main.h"
#include "nvim/option_defs.h"
#include "nvim/os/input.h"
#include "nvim/state.h"
#include "nvim/ui.h"
#include "nvim/vim.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS #ifdef INCLUDE_GENERATED_DECLARATIONS
# include "state.c.generated.h" # include "state.c.generated.h"

View File

@@ -1,4 +1,4 @@
# Uncrustify-0.73.0-168-f20a083e # Uncrustify-0.73.0-181-847f1e99
# #
# General options # General options
@@ -259,7 +259,7 @@ sp_before_byref_func = ignore # ignore/add/remove/force/not_defined
# following word. # following word.
# #
# Default: force # Default: force
sp_after_type = ignore # ignore/add/remove/force/not_defined sp_after_type = force # ignore/add/remove/force/not_defined
# Add or remove space between 'decltype(...)' and word, # Add or remove space between 'decltype(...)' and word,
# brace or function call. # brace or function call.
@@ -447,12 +447,18 @@ sp_before_ellipsis = ignore # ignore/add/remove/force/not_defined
# Add or remove space between a type and '...'. # Add or remove space between a type and '...'.
sp_type_ellipsis = ignore # ignore/add/remove/force/not_defined sp_type_ellipsis = ignore # ignore/add/remove/force/not_defined
# Add or remove space between a '*' and '...'.
sp_ptr_type_ellipsis = ignore # ignore/add/remove/force/not_defined
# (D) Add or remove space between a type and '?'. # (D) Add or remove space between a type and '?'.
sp_type_question = ignore # ignore/add/remove/force/not_defined sp_type_question = ignore # ignore/add/remove/force/not_defined
# Add or remove space between ')' and '...'. # Add or remove space between ')' and '...'.
sp_paren_ellipsis = ignore # ignore/add/remove/force/not_defined sp_paren_ellipsis = ignore # ignore/add/remove/force/not_defined
# Add or remove space between '&&' and '...'.
sp_byref_ellipsis = ignore # ignore/add/remove/force/not_defined
# Add or remove space between ')' and a qualifier such as 'const'. # Add or remove space between ')' and a qualifier such as 'const'.
sp_paren_qualifier = ignore # ignore/add/remove/force/not_defined sp_paren_qualifier = ignore # ignore/add/remove/force/not_defined
@@ -507,6 +513,12 @@ sp_sizeof_ellipsis = ignore # ignore/add/remove/force/not_defined
# Add or remove space between 'sizeof...' and '('. # Add or remove space between 'sizeof...' and '('.
sp_sizeof_ellipsis_paren = ignore # ignore/add/remove/force/not_defined sp_sizeof_ellipsis_paren = ignore # ignore/add/remove/force/not_defined
# Add or remove space between '...' and a parameter pack.
sp_ellipsis_parameter_pack = ignore # ignore/add/remove/force/not_defined
# Add or remove space between a parameter pack and '...'.
sp_parameter_pack_ellipsis = ignore # ignore/add/remove/force/not_defined
# Add or remove space between 'decltype' and '('. # Add or remove space between 'decltype' and '('.
sp_decltype_paren = ignore # ignore/add/remove/force/not_defined sp_decltype_paren = ignore # ignore/add/remove/force/not_defined
@@ -2020,7 +2032,7 @@ nl_constr_colon = ignore # ignore/add/remove/force/not_defined
# Whether to collapse a two-line namespace, like 'namespace foo\n{ decl; }' # Whether to collapse a two-line namespace, like 'namespace foo\n{ decl; }'
# into a single line. If true, prevents other brace newline rules from turning # into a single line. If true, prevents other brace newline rules from turning
# such code into four lines. # such code into four lines. If true, it also preserves one-liner namespaces.
nl_namespace_two_to_one_liner = false # true/false nl_namespace_two_to_one_liner = false # true/false
# Whether to remove a newline in simple unbraced if statements, turning them # Whether to remove a newline in simple unbraced if statements, turning them
@@ -3279,5 +3291,5 @@ set PREPROC REAL_FATTR_CONST
set PREPROC REAL_FATTR_NONNULL_ALL set PREPROC REAL_FATTR_NONNULL_ALL
set PREPROC REAL_FATTR_PURE set PREPROC REAL_FATTR_PURE
set PREPROC REAL_FATTR_WARN_UNUSED_RESULT set PREPROC REAL_FATTR_WARN_UNUSED_RESULT
# option(s) with 'not default' value: 62 # option(s) with 'not default' value: 61
# #