mirror of
https://github.com/neovim/neovim.git
synced 2024-09-17 20:58:20 -04:00
refactor: reformat with uncrustify #15736
* fix function parameter comments * remove space after star in function names
This commit is contained in:
parent
1f8c91bf72
commit
f4ca3a29dd
@ -208,7 +208,7 @@ sp_after_ptr_star_qualifier = ignore # ignore/add/remove/force/not_defined
|
||||
# prototype or function definition.
|
||||
#
|
||||
# Overrides sp_after_ptr_star and sp_type_func.
|
||||
sp_after_ptr_star_func = ignore # ignore/add/remove/force/not_defined
|
||||
sp_after_ptr_star_func = remove # ignore/add/remove/force/not_defined
|
||||
|
||||
# Add or remove space after a pointer star '*' in the trailing return of a
|
||||
# function prototype or function definition.
|
||||
@ -3279,5 +3279,5 @@ set PREPROC REAL_FATTR_CONST
|
||||
set PREPROC REAL_FATTR_NONNULL_ALL
|
||||
set PREPROC REAL_FATTR_PURE
|
||||
set PREPROC REAL_FATTR_WARN_UNUSED_RESULT
|
||||
# option(s) with 'not default' value: 61
|
||||
# option(s) with 'not default' value: 62
|
||||
#
|
||||
|
@ -2938,8 +2938,8 @@ buf_T *setaltfname(char_u *ffname, char_u *sfname, linenr_T lnum)
|
||||
* Get alternate file name for current window.
|
||||
* Return NULL if there isn't any, and give error message if requested.
|
||||
*/
|
||||
char_u * getaltfname(bool errmsg // give error message
|
||||
)
|
||||
char_u *getaltfname(bool errmsg // give error message
|
||||
)
|
||||
{
|
||||
char_u *fname;
|
||||
linenr_T dummy;
|
||||
|
@ -417,7 +417,7 @@ char *transstr(const char *const s)
|
||||
///
|
||||
/// When "buf" is NULL, return an allocated string.
|
||||
/// Otherwise, put the result in buf, limited by buflen, and return buf.
|
||||
char_u * str_foldcase(char_u *str, int orglen, char_u *buf, int buflen)
|
||||
char_u *str_foldcase(char_u *str, int orglen, char_u *buf, int buflen)
|
||||
FUNC_ATTR_NONNULL_RET
|
||||
{
|
||||
garray_T ga;
|
||||
@ -1209,7 +1209,7 @@ char_u *skipdigits(const char_u *q)
|
||||
/// @param q pointer to string
|
||||
///
|
||||
/// @return Pointer to the character after the skipped digits.
|
||||
const char * skipbin(const char *q)
|
||||
const char *skipbin(const char *q)
|
||||
FUNC_ATTR_PURE
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
FUNC_ATTR_NONNULL_RET
|
||||
@ -1228,7 +1228,7 @@ const char * skipbin(const char *q)
|
||||
///
|
||||
/// @return Pointer to the character after the skipped digits and hex
|
||||
/// characters.
|
||||
char_u * skiphex(char_u *q)
|
||||
char_u *skiphex(char_u *q)
|
||||
{
|
||||
char_u *p = q;
|
||||
while (ascii_isxdigit(*p)) {
|
||||
@ -1243,7 +1243,7 @@ char_u * skiphex(char_u *q)
|
||||
/// @param q
|
||||
///
|
||||
/// @return Pointer to the digit or (NUL after the string).
|
||||
char_u * skiptodigit(char_u *q)
|
||||
char_u *skiptodigit(char_u *q)
|
||||
{
|
||||
char_u *p = q;
|
||||
while (*p != NUL && !ascii_isdigit(*p)) {
|
||||
@ -1258,7 +1258,7 @@ char_u * skiptodigit(char_u *q)
|
||||
/// @param q pointer to string
|
||||
///
|
||||
/// @return Pointer to the binary character or (NUL after the string).
|
||||
const char * skiptobin(const char *q)
|
||||
const char *skiptobin(const char *q)
|
||||
FUNC_ATTR_PURE
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
FUNC_ATTR_NONNULL_RET
|
||||
@ -1276,7 +1276,7 @@ const char * skiptobin(const char *q)
|
||||
/// @param q
|
||||
///
|
||||
/// @return Pointer to the hex character or (NUL after the string).
|
||||
char_u * skiptohex(char_u *q)
|
||||
char_u *skiptohex(char_u *q)
|
||||
{
|
||||
char_u *p = q;
|
||||
while (*p != NUL && !ascii_isxdigit(*p)) {
|
||||
@ -1305,7 +1305,7 @@ char_u *skiptowhite(const char_u *p)
|
||||
/// @param p
|
||||
///
|
||||
/// @return Pointer to the next whitespace character.
|
||||
char_u * skiptowhite_esc(char_u *p) {
|
||||
char_u *skiptowhite_esc(char_u *p) {
|
||||
while (*p != ' ' && *p != '\t' && *p != NUL) {
|
||||
if (((*p == '\\') || (*p == Ctrl_V)) && (*(p + 1) != NUL)) {
|
||||
++p;
|
||||
|
@ -507,7 +507,7 @@ static void diff_mark_adjust_tp(tabpage_T *tp, int idx, linenr_T line1, linenr_T
|
||||
/// @param dp
|
||||
///
|
||||
/// @return The new diff block.
|
||||
static diff_T * diff_alloc_new(tabpage_T *tp, diff_T *dprev, diff_T *dp)
|
||||
static diff_T *diff_alloc_new(tabpage_T *tp, diff_T *dprev, diff_T *dp)
|
||||
{
|
||||
diff_T *dnew = xmalloc(sizeof(*dnew));
|
||||
|
||||
|
@ -1821,7 +1821,7 @@ typedef struct {
|
||||
/// @return NULL if OK, an error message for failure. This only needs to be
|
||||
/// used when setting the option, not later when the value has already
|
||||
/// been checked.
|
||||
char_u * keymap_init(void)
|
||||
char_u *keymap_init(void)
|
||||
{
|
||||
curbuf->b_kmap_state &= ~KEYMAP_INIT;
|
||||
|
||||
|
@ -3327,7 +3327,7 @@ void get_complete_info(list_T *what_list, dict_T *retdict)
|
||||
}
|
||||
|
||||
// Return Insert completion mode name string
|
||||
static char_u * ins_compl_mode(void)
|
||||
static char_u *ins_compl_mode(void)
|
||||
{
|
||||
if (ctrl_x_mode == CTRL_X_NOT_DEFINED_YET || compl_started) {
|
||||
return (char_u *)ctrl_x_mode_names[ctrl_x_mode & ~CTRL_X_WANT_IDENT];
|
||||
|
@ -6367,7 +6367,7 @@ int assert_match_common(typval_T *argvars, assert_type_T atype)
|
||||
|
||||
/// Find a window: When using a Window ID in any tab page, when using a number
|
||||
/// in the current tab page.
|
||||
win_T * find_win_by_nr_or_id(typval_T *vp)
|
||||
win_T *find_win_by_nr_or_id(typval_T *vp)
|
||||
{
|
||||
int nr = (int)tv_get_number_chk(vp, NULL);
|
||||
|
||||
|
@ -803,7 +803,7 @@ buf_T *tv_get_buf_from_arg(typval_T *const tv) FUNC_ATTR_NONNULL_ALL
|
||||
|
||||
/// Get the buffer from "arg" and give an error and return NULL if it is not
|
||||
/// valid.
|
||||
buf_T * get_buf_arg(typval_T *arg)
|
||||
buf_T *get_buf_arg(typval_T *arg)
|
||||
{
|
||||
buf_T *buf;
|
||||
|
||||
@ -1081,7 +1081,7 @@ static void f_cindent(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
}
|
||||
}
|
||||
|
||||
static win_T * get_optional_window(typval_T *argvars, int idx)
|
||||
static win_T *get_optional_window(typval_T *argvars, int idx)
|
||||
{
|
||||
win_T *win = curwin;
|
||||
|
||||
|
@ -203,7 +203,7 @@ static void register_closure(ufunc_T *fp)
|
||||
|
||||
|
||||
/// Get a name for a lambda. Returned in static memory.
|
||||
char_u * get_lambda_name(void)
|
||||
char_u *get_lambda_name(void)
|
||||
{
|
||||
static char_u name[30];
|
||||
static int lambda_no = 0;
|
||||
|
@ -1030,7 +1030,7 @@ int getline_equal(LineGetter fgetline, void *cookie, LineGetter func)
|
||||
/// getline function. Otherwise return "cookie".
|
||||
///
|
||||
/// @param cookie argument for fgetline()
|
||||
void * getline_cookie(LineGetter fgetline, void *cookie)
|
||||
void *getline_cookie(LineGetter fgetline, void *cookie)
|
||||
{
|
||||
LineGetter gp;
|
||||
struct loop_cookie *cp;
|
||||
@ -1250,8 +1250,8 @@ static char_u *skip_colon_white(const char_u *p, bool skipleadingwhite)
|
||||
/// This function may be called recursively!
|
||||
///
|
||||
/// @param cookie argument for fgetline()
|
||||
static char_u * do_one_cmd(char_u **cmdlinep, int flags, cstack_T *cstack, LineGetter fgetline,
|
||||
void *cookie)
|
||||
static char_u *do_one_cmd(char_u **cmdlinep, int flags, cstack_T *cstack, LineGetter fgetline,
|
||||
void *cookie)
|
||||
{
|
||||
char_u *p;
|
||||
linenr_T lnum;
|
||||
@ -2905,7 +2905,7 @@ int cmd_exists(const char *const name)
|
||||
/// probably won't change that much -- webb.
|
||||
///
|
||||
/// @param buff buffer for command string
|
||||
const char * set_one_cmd_context(expand_T *xp, const char *buff)
|
||||
const char *set_one_cmd_context(expand_T *xp, const char *buff)
|
||||
{
|
||||
size_t len = 0;
|
||||
exarg_T ea;
|
||||
|
@ -2401,7 +2401,7 @@ void text_locked_msg(void)
|
||||
EMSG(_(get_text_locked_msg()));
|
||||
}
|
||||
|
||||
char_u * get_text_locked_msg(void) {
|
||||
char_u *get_text_locked_msg(void) {
|
||||
if (cmdwin_type != 0) {
|
||||
return e_cmdwin;
|
||||
} else {
|
||||
@ -5218,8 +5218,8 @@ static void expand_shellcmd(char_u *filepat, int *num_file, char_u ***file, int
|
||||
|
||||
/// Call "user_expand_func()" to invoke a user defined Vim script function and
|
||||
/// return the result (either a string, a List or NULL).
|
||||
static void * call_user_expand_func(user_expand_func_T user_expand_func, expand_T *xp,
|
||||
int *num_file, char_u ***file)
|
||||
static void *call_user_expand_func(user_expand_func_T user_expand_func, expand_T *xp, int *num_file,
|
||||
char_u ***file)
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
char_u keep = 0;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -5538,8 +5538,8 @@ bool match_file_list(char_u *list, char_u *sfname, char_u *ffname)
|
||||
/// @param no_bslash Don't use a backward slash as pathsep
|
||||
///
|
||||
/// @return NULL on failure.
|
||||
char_u * file_pat_to_reg_pat(const char_u *pat, const char_u *pat_end, char *allow_dirs,
|
||||
int no_bslash)
|
||||
char_u *file_pat_to_reg_pat(const char_u *pat, const char_u *pat_end, char *allow_dirs,
|
||||
int no_bslash)
|
||||
FUNC_ATTR_NONNULL_ARG(1)
|
||||
{
|
||||
const char_u *endp;
|
||||
|
@ -5,16 +5,16 @@
|
||||
///
|
||||
/// Functions for handling growing arrays.
|
||||
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "nvim/vim.h"
|
||||
#include "nvim/ascii.h"
|
||||
#include "nvim/garray.h"
|
||||
#include "nvim/log.h"
|
||||
#include "nvim/memory.h"
|
||||
#include "nvim/path.h"
|
||||
#include "nvim/garray.h"
|
||||
#include "nvim/strings.h"
|
||||
#include "nvim/vim.h"
|
||||
|
||||
// #include "nvim/globals.h"
|
||||
#include "nvim/memline.h"
|
||||
@ -146,11 +146,11 @@ void ga_remove_duplicate_strings(garray_T *gap)
|
||||
char_u *ga_concat_strings_sep(const garray_T *gap, const char *sep)
|
||||
FUNC_ATTR_NONNULL_RET
|
||||
{
|
||||
const size_t nelem = (size_t) gap->ga_len;
|
||||
const size_t nelem = (size_t)gap->ga_len;
|
||||
const char **strings = gap->ga_data;
|
||||
|
||||
if (nelem == 0) {
|
||||
return (char_u *) xstrdup("");
|
||||
return (char_u *)xstrdup("");
|
||||
}
|
||||
|
||||
size_t len = 0;
|
||||
@ -169,7 +169,7 @@ char_u *ga_concat_strings_sep(const garray_T *gap, const char *sep)
|
||||
}
|
||||
strcpy(s, strings[nelem - 1]);
|
||||
|
||||
return (char_u *) ret;
|
||||
return (char_u *)ret;
|
||||
}
|
||||
|
||||
/// For a growing array that contains a list of strings: concatenate all the
|
||||
@ -178,7 +178,7 @@ char_u *ga_concat_strings_sep(const garray_T *gap, const char *sep)
|
||||
/// @param gap
|
||||
///
|
||||
/// @returns the concatenated strings
|
||||
char_u* ga_concat_strings(const garray_T *gap) FUNC_ATTR_NONNULL_RET
|
||||
char_u *ga_concat_strings(const garray_T *gap) FUNC_ATTR_NONNULL_RET
|
||||
{
|
||||
return ga_concat_strings_sep(gap, ",");
|
||||
}
|
||||
@ -198,7 +198,7 @@ void ga_concat(garray_T *gap, const char_u *restrict s)
|
||||
return;
|
||||
}
|
||||
|
||||
ga_concat_len(gap, (const char *restrict) s, strlen((char *) s));
|
||||
ga_concat_len(gap, (const char *restrict)s, strlen((char *)s));
|
||||
}
|
||||
|
||||
/// Concatenate a string to a growarray which contains characters
|
||||
@ -206,15 +206,14 @@ void ga_concat(garray_T *gap, const char_u *restrict s)
|
||||
/// @param[out] gap Growarray to modify.
|
||||
/// @param[in] s String to concatenate.
|
||||
/// @param[in] len String length.
|
||||
void ga_concat_len(garray_T *const gap, const char *restrict s,
|
||||
const size_t len)
|
||||
void ga_concat_len(garray_T *const gap, const char *restrict s, const size_t len)
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
if (len) {
|
||||
ga_grow(gap, (int) len);
|
||||
ga_grow(gap, (int)len);
|
||||
char *data = gap->ga_data;
|
||||
memcpy(data + gap->ga_len, s, len);
|
||||
gap->ga_len += (int) len;
|
||||
gap->ga_len += (int)len;
|
||||
}
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -22,15 +22,15 @@
|
||||
/// memory).
|
||||
|
||||
#include <assert.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "nvim/vim.h"
|
||||
#include "nvim/ascii.h"
|
||||
#include "nvim/hashtab.h"
|
||||
#include "nvim/message.h"
|
||||
#include "nvim/memory.h"
|
||||
#include "nvim/message.h"
|
||||
#include "nvim/vim.h"
|
||||
|
||||
// Magic value for algorithm that walks through the array.
|
||||
#define PERTURB_SHIFT 5
|
||||
@ -102,8 +102,7 @@ hashitem_T *hash_find(const hashtab_T *const ht, const char_u *const key)
|
||||
///
|
||||
/// @warning Returned pointer becomes invalid as soon as the hash table
|
||||
/// is changed in any way.
|
||||
hashitem_T *hash_find_len(const hashtab_T *const ht, const char *const key,
|
||||
const size_t len)
|
||||
hashitem_T *hash_find_len(const hashtab_T *const ht, const char *const key, const size_t len)
|
||||
{
|
||||
return hash_lookup(ht, key, len, hash_hash_len(key, len));
|
||||
}
|
||||
@ -119,8 +118,7 @@ hashitem_T *hash_find_len(const hashtab_T *const ht, const char *const key,
|
||||
/// used for that key.
|
||||
/// WARNING: Returned pointer becomes invalid as soon as the hash table
|
||||
/// is changed in any way.
|
||||
hashitem_T *hash_lookup(const hashtab_T *const ht,
|
||||
const char *const key, const size_t key_len,
|
||||
hashitem_T *hash_lookup(const hashtab_T *const ht, const char *const key, const size_t key_len,
|
||||
const hash_T hash)
|
||||
{
|
||||
#ifdef HT_DEBUG
|
||||
@ -336,7 +334,7 @@ static void hash_may_resize(hashtab_T *ht, size_t minitems)
|
||||
|
||||
bool newarray_is_small = newsize == HT_INIT_SIZE;
|
||||
bool keep_smallarray = newarray_is_small
|
||||
&& ht->ht_array == ht->ht_smallarray;
|
||||
&& ht->ht_array == ht->ht_smallarray;
|
||||
|
||||
// Make sure that oldarray and newarray do not overlap,
|
||||
// so that copying is possible.
|
||||
@ -387,7 +385,7 @@ static void hash_may_resize(hashtab_T *ht, size_t minitems)
|
||||
}
|
||||
|
||||
#define HASH_CYCLE_BODY(hash, p) \
|
||||
hash = hash * 101 + *p++
|
||||
hash = hash * 101 + *p++
|
||||
|
||||
/// Get the hash number for a key.
|
||||
///
|
||||
|
@ -3,9 +3,11 @@
|
||||
|
||||
// highlight.c: low level code for UI and syntax highlighting
|
||||
|
||||
#include "nvim/vim.h"
|
||||
#include "nvim/api/private/defs.h"
|
||||
#include "nvim/api/private/helpers.h"
|
||||
#include "nvim/highlight.h"
|
||||
#include "nvim/highlight_defs.h"
|
||||
#include "nvim/lua/executor.h"
|
||||
#include "nvim/map.h"
|
||||
#include "nvim/message.h"
|
||||
#include "nvim/option.h"
|
||||
@ -13,9 +15,7 @@
|
||||
#include "nvim/screen.h"
|
||||
#include "nvim/syntax.h"
|
||||
#include "nvim/ui.h"
|
||||
#include "nvim/api/private/defs.h"
|
||||
#include "nvim/api/private/helpers.h"
|
||||
#include "nvim/lua/executor.h"
|
||||
#include "nvim/vim.h"
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "highlight.c.generated.h"
|
||||
@ -361,19 +361,19 @@ void update_window_hl(win_T *wp, bool invalid)
|
||||
int hl_get_underline(void)
|
||||
{
|
||||
return get_attr_entry((HlEntry){
|
||||
.attr = (HlAttrs){
|
||||
.cterm_ae_attr = (int16_t)HL_UNDERLINE,
|
||||
.cterm_fg_color = 0,
|
||||
.cterm_bg_color = 0,
|
||||
.rgb_ae_attr = (int16_t)HL_UNDERLINE,
|
||||
.rgb_fg_color = -1,
|
||||
.rgb_bg_color = -1,
|
||||
.rgb_sp_color = -1,
|
||||
.hl_blend = -1,
|
||||
},
|
||||
.kind = kHlUI,
|
||||
.id1 = 0,
|
||||
.id2 = 0,
|
||||
.attr = (HlAttrs){
|
||||
.cterm_ae_attr = (int16_t)HL_UNDERLINE,
|
||||
.cterm_fg_color = 0,
|
||||
.cterm_bg_color = 0,
|
||||
.rgb_ae_attr = (int16_t)HL_UNDERLINE,
|
||||
.rgb_fg_color = -1,
|
||||
.rgb_bg_color = -1,
|
||||
.rgb_sp_color = -1,
|
||||
.hl_blend = -1,
|
||||
},
|
||||
.kind = kHlUI,
|
||||
.id1 = 0,
|
||||
.id2 = 0,
|
||||
});
|
||||
}
|
||||
|
||||
@ -648,23 +648,23 @@ static int hl_cterm2rgb_color(int nr)
|
||||
};
|
||||
static char_u ansi_table[16][4] = {
|
||||
// R G B idx
|
||||
{ 0, 0, 0, 1 } , // black
|
||||
{ 224, 0, 0, 2 } , // dark red
|
||||
{ 0, 224, 0, 3 } , // dark green
|
||||
{ 224, 224, 0, 4 } , // dark yellow / brown
|
||||
{ 0, 0, 224, 5 } , // dark blue
|
||||
{ 224, 0, 224, 6 } , // dark magenta
|
||||
{ 0, 224, 224, 7 } , // dark cyan
|
||||
{ 224, 224, 224, 8 } , // light grey
|
||||
{ 0, 0, 0, 1 }, // black
|
||||
{ 224, 0, 0, 2 }, // dark red
|
||||
{ 0, 224, 0, 3 }, // dark green
|
||||
{ 224, 224, 0, 4 }, // dark yellow / brown
|
||||
{ 0, 0, 224, 5 }, // dark blue
|
||||
{ 224, 0, 224, 6 }, // dark magenta
|
||||
{ 0, 224, 224, 7 }, // dark cyan
|
||||
{ 224, 224, 224, 8 }, // light grey
|
||||
|
||||
{ 128, 128, 128, 9 } , // dark grey
|
||||
{ 255, 64, 64, 10 } , // light red
|
||||
{ 64, 255, 64, 11 } , // light green
|
||||
{ 255, 255, 64, 12 } , // yellow
|
||||
{ 64, 64, 255, 13 } , // light blue
|
||||
{ 255, 64, 255, 14 } , // light magenta
|
||||
{ 64, 255, 255, 15 } , // light cyan
|
||||
{ 255, 255, 255, 16 } , // white
|
||||
{ 128, 128, 128, 9 }, // dark grey
|
||||
{ 255, 64, 64, 10 }, // light red
|
||||
{ 64, 255, 64, 11 }, // light green
|
||||
{ 255, 255, 64, 12 }, // yellow
|
||||
{ 64, 64, 255, 13 }, // light blue
|
||||
{ 255, 64, 255, 14 }, // light magenta
|
||||
{ 64, 255, 255, 15 }, // light cyan
|
||||
{ 255, 255, 255, 16 }, // white
|
||||
};
|
||||
|
||||
int r = 0;
|
||||
@ -790,7 +790,7 @@ Dictionary hlattrs2dict(HlAttrs ae, bool use_rgb)
|
||||
}
|
||||
|
||||
if (ae.hl_blend > -1) {
|
||||
PUT(hl, "blend", INTEGER_OBJ(ae.hl_blend));
|
||||
PUT(hl, "blend", INTEGER_OBJ(ae.hl_blend));
|
||||
}
|
||||
|
||||
return hl;
|
||||
@ -847,7 +847,7 @@ HlAttrs dict2hlattrs(Dictionary dict, bool use_rgb, int *link_id, Error *err)
|
||||
err)) {
|
||||
cterm_mask |= flags[m].flag;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -915,9 +915,9 @@ HlAttrs dict2hlattrs(Dictionary dict, bool use_rgb, int *link_id, Error *err)
|
||||
hlattrs.rgb_fg_color = fg;
|
||||
hlattrs.rgb_sp_color = sp;
|
||||
hlattrs.cterm_bg_color =
|
||||
ctermbg == -1 ? cterm_normal_bg_color : ctermbg + 1;
|
||||
ctermbg == -1 ? cterm_normal_bg_color : ctermbg + 1;
|
||||
hlattrs.cterm_fg_color =
|
||||
ctermfg == -1 ? cterm_normal_fg_color : ctermfg + 1;
|
||||
ctermfg == -1 ? cterm_normal_fg_color : ctermfg + 1;
|
||||
hlattrs.cterm_ae_attr = cterm_mask;
|
||||
} else {
|
||||
hlattrs.cterm_ae_attr = cterm_mask;
|
||||
@ -945,34 +945,34 @@ static void hl_inspect_impl(Array *arr, int attr)
|
||||
|
||||
HlEntry e = kv_A(attr_entries, attr);
|
||||
switch (e.kind) {
|
||||
case kHlSyntax:
|
||||
PUT(item, "kind", STRING_OBJ(cstr_to_string("syntax")));
|
||||
PUT(item, "hi_name",
|
||||
STRING_OBJ(cstr_to_string((char *)syn_id2name(e.id1))));
|
||||
break;
|
||||
case kHlSyntax:
|
||||
PUT(item, "kind", STRING_OBJ(cstr_to_string("syntax")));
|
||||
PUT(item, "hi_name",
|
||||
STRING_OBJ(cstr_to_string((char *)syn_id2name(e.id1))));
|
||||
break;
|
||||
|
||||
case kHlUI:
|
||||
PUT(item, "kind", STRING_OBJ(cstr_to_string("ui")));
|
||||
const char *ui_name = (e.id1 == -1) ? "Normal" : hlf_names[e.id1];
|
||||
PUT(item, "ui_name", STRING_OBJ(cstr_to_string(ui_name)));
|
||||
PUT(item, "hi_name",
|
||||
STRING_OBJ(cstr_to_string((char *)syn_id2name(e.id2))));
|
||||
break;
|
||||
case kHlUI:
|
||||
PUT(item, "kind", STRING_OBJ(cstr_to_string("ui")));
|
||||
const char *ui_name = (e.id1 == -1) ? "Normal" : hlf_names[e.id1];
|
||||
PUT(item, "ui_name", STRING_OBJ(cstr_to_string(ui_name)));
|
||||
PUT(item, "hi_name",
|
||||
STRING_OBJ(cstr_to_string((char *)syn_id2name(e.id2))));
|
||||
break;
|
||||
|
||||
case kHlTerminal:
|
||||
PUT(item, "kind", STRING_OBJ(cstr_to_string("term")));
|
||||
break;
|
||||
case kHlTerminal:
|
||||
PUT(item, "kind", STRING_OBJ(cstr_to_string("term")));
|
||||
break;
|
||||
|
||||
case kHlCombine:
|
||||
case kHlBlend:
|
||||
case kHlBlendThrough:
|
||||
// attribute combination is associative, so flatten to an array
|
||||
hl_inspect_impl(arr, e.id1);
|
||||
hl_inspect_impl(arr, e.id2);
|
||||
return;
|
||||
case kHlCombine:
|
||||
case kHlBlend:
|
||||
case kHlBlendThrough:
|
||||
// attribute combination is associative, so flatten to an array
|
||||
hl_inspect_impl(arr, e.id1);
|
||||
hl_inspect_impl(arr, e.id2);
|
||||
return;
|
||||
|
||||
case kHlUnknown:
|
||||
return;
|
||||
case kHlUnknown:
|
||||
return;
|
||||
}
|
||||
PUT(item, "id", INTEGER_OBJ(attr));
|
||||
ADD(*arr, DICTIONARY_OBJ(item));
|
||||
|
@ -7,13 +7,14 @@
|
||||
|
||||
#include "nvim/ascii.h"
|
||||
#include "nvim/assert.h"
|
||||
#include "nvim/buffer.h"
|
||||
#include "nvim/change.h"
|
||||
#include "nvim/indent.h"
|
||||
#include "nvim/eval.h"
|
||||
#include "nvim/charset.h"
|
||||
#include "nvim/cursor.h"
|
||||
#include "nvim/mark.h"
|
||||
#include "nvim/eval.h"
|
||||
#include "nvim/extmark.h"
|
||||
#include "nvim/indent.h"
|
||||
#include "nvim/mark.h"
|
||||
#include "nvim/memline.h"
|
||||
#include "nvim/memory.h"
|
||||
#include "nvim/misc1.h"
|
||||
@ -25,7 +26,6 @@
|
||||
#include "nvim/search.h"
|
||||
#include "nvim/strings.h"
|
||||
#include "nvim/undo.h"
|
||||
#include "nvim/buffer.h"
|
||||
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
@ -444,8 +444,8 @@ int get_breakindent_win(win_T *wp, char_u *line)
|
||||
int bri = 0;
|
||||
// window width minus window margin space, i.e. what rests for text
|
||||
const int eff_wwidth = wp->w_width_inner
|
||||
- ((wp->w_p_nu || wp->w_p_rnu)
|
||||
&& (vim_strchr(p_cpo, CPO_NUMCOL) == NULL)
|
||||
- ((wp->w_p_nu || wp->w_p_rnu)
|
||||
&& (vim_strchr(p_cpo, CPO_NUMCOL) == NULL)
|
||||
? number_width(wp) + 1 : 0);
|
||||
|
||||
// used cached indent, unless pointer or 'tabstop' changed
|
||||
@ -510,7 +510,7 @@ int get_breakindent_win(win_T *wp, char_u *line)
|
||||
// the line.
|
||||
int inindent(int extra)
|
||||
{
|
||||
char_u *ptr;
|
||||
char_u *ptr;
|
||||
colnr_T col;
|
||||
|
||||
for (col = 0, ptr = get_cursor_line_ptr(); ascii_iswhite(*ptr); ++col) {
|
||||
@ -533,15 +533,14 @@ int get_expr_indent(void)
|
||||
colnr_T save_curswant;
|
||||
int save_set_curswant;
|
||||
int save_State;
|
||||
int use_sandbox = was_set_insecurely(
|
||||
curwin, (char_u *)"indentexpr", OPT_LOCAL);
|
||||
int use_sandbox = was_set_insecurely(curwin, (char_u *)"indentexpr", OPT_LOCAL);
|
||||
|
||||
// Save and restore cursor position and curswant, in case it was changed
|
||||
// * via :normal commands.
|
||||
save_pos = curwin->w_cursor;
|
||||
save_curswant = curwin->w_curswant;
|
||||
save_set_curswant = curwin->w_set_curswant;
|
||||
set_vim_var_nr(VV_LNUM, (varnumber_T) curwin->w_cursor.lnum);
|
||||
set_vim_var_nr(VV_LNUM, (varnumber_T)curwin->w_cursor.lnum);
|
||||
|
||||
if (use_sandbox) {
|
||||
sandbox++;
|
||||
@ -722,11 +721,11 @@ int get_lisp_indent(void)
|
||||
quotecount = 0;
|
||||
|
||||
if (vi_lisp || ((*that != '"') && (*that != '\'')
|
||||
&& (*that != '#') && ((*that < '0') || (*that > '9')))) {
|
||||
&& (*that != '#') && ((*that < '0') || (*that > '9')))) {
|
||||
while (*that
|
||||
&& (!ascii_iswhite(*that) || quotecount || parencount)
|
||||
&& (!((*that == '(' || *that == '[')
|
||||
&& !quotecount && !parencount && vi_lisp))) {
|
||||
&& !quotecount && !parencount && vi_lisp))) {
|
||||
if (*that == '"') {
|
||||
quotecount = !quotecount;
|
||||
}
|
||||
|
@ -5,16 +5,16 @@
|
||||
#include <inttypes.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "nvim/vim.h"
|
||||
#include "nvim/ascii.h"
|
||||
#include "nvim/keymap.h"
|
||||
#include "nvim/charset.h"
|
||||
#include "nvim/memory.h"
|
||||
#include "nvim/edit.h"
|
||||
#include "nvim/eval.h"
|
||||
#include "nvim/keymap.h"
|
||||
#include "nvim/memory.h"
|
||||
#include "nvim/message.h"
|
||||
#include "nvim/strings.h"
|
||||
#include "nvim/mouse.h"
|
||||
#include "nvim/strings.h"
|
||||
#include "nvim/vim.h"
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "keymap.c.generated.h"
|
||||
@ -51,48 +51,48 @@ static const struct modmasktable {
|
||||
|
||||
static char_u modifier_keys_table[] =
|
||||
{
|
||||
/* mod mask with modifier without modifier */
|
||||
MOD_MASK_SHIFT, '&', '9', '@', '1', /* begin */
|
||||
MOD_MASK_SHIFT, '&', '0', '@', '2', /* cancel */
|
||||
MOD_MASK_SHIFT, '*', '1', '@', '4', /* command */
|
||||
MOD_MASK_SHIFT, '*', '2', '@', '5', /* copy */
|
||||
MOD_MASK_SHIFT, '*', '3', '@', '6', /* create */
|
||||
MOD_MASK_SHIFT, '*', '4', 'k', 'D', /* delete char */
|
||||
MOD_MASK_SHIFT, '*', '5', 'k', 'L', /* delete line */
|
||||
MOD_MASK_SHIFT, '*', '7', '@', '7', /* end */
|
||||
MOD_MASK_CTRL, KS_EXTRA, (int)KE_C_END, '@', '7', /* end */
|
||||
MOD_MASK_SHIFT, '*', '9', '@', '9', /* exit */
|
||||
MOD_MASK_SHIFT, '*', '0', '@', '0', /* find */
|
||||
MOD_MASK_SHIFT, '#', '1', '%', '1', /* help */
|
||||
MOD_MASK_SHIFT, '#', '2', 'k', 'h', /* home */
|
||||
MOD_MASK_CTRL, KS_EXTRA, (int)KE_C_HOME, 'k', 'h', /* home */
|
||||
MOD_MASK_SHIFT, '#', '3', 'k', 'I', /* insert */
|
||||
MOD_MASK_SHIFT, '#', '4', 'k', 'l', /* left arrow */
|
||||
MOD_MASK_CTRL, KS_EXTRA, (int)KE_C_LEFT, 'k', 'l', /* left arrow */
|
||||
MOD_MASK_SHIFT, '%', 'a', '%', '3', /* message */
|
||||
MOD_MASK_SHIFT, '%', 'b', '%', '4', /* move */
|
||||
MOD_MASK_SHIFT, '%', 'c', '%', '5', /* next */
|
||||
MOD_MASK_SHIFT, '%', 'd', '%', '7', /* options */
|
||||
MOD_MASK_SHIFT, '%', 'e', '%', '8', /* previous */
|
||||
MOD_MASK_SHIFT, '%', 'f', '%', '9', /* print */
|
||||
MOD_MASK_SHIFT, '%', 'g', '%', '0', /* redo */
|
||||
MOD_MASK_SHIFT, '%', 'h', '&', '3', /* replace */
|
||||
MOD_MASK_SHIFT, '%', 'i', 'k', 'r', /* right arr. */
|
||||
MOD_MASK_CTRL, KS_EXTRA, (int)KE_C_RIGHT, 'k', 'r', /* right arr. */
|
||||
MOD_MASK_SHIFT, '%', 'j', '&', '5', /* resume */
|
||||
MOD_MASK_SHIFT, '!', '1', '&', '6', /* save */
|
||||
MOD_MASK_SHIFT, '!', '2', '&', '7', /* suspend */
|
||||
MOD_MASK_SHIFT, '!', '3', '&', '8', /* undo */
|
||||
MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_UP, 'k', 'u', /* up arrow */
|
||||
MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_DOWN, 'k', 'd', /* down arrow */
|
||||
// mod mask with modifier without modifier
|
||||
MOD_MASK_SHIFT, '&', '9', '@', '1', // begin
|
||||
MOD_MASK_SHIFT, '&', '0', '@', '2', // cancel
|
||||
MOD_MASK_SHIFT, '*', '1', '@', '4', // command
|
||||
MOD_MASK_SHIFT, '*', '2', '@', '5', // copy
|
||||
MOD_MASK_SHIFT, '*', '3', '@', '6', // create
|
||||
MOD_MASK_SHIFT, '*', '4', 'k', 'D', // delete char
|
||||
MOD_MASK_SHIFT, '*', '5', 'k', 'L', // delete line
|
||||
MOD_MASK_SHIFT, '*', '7', '@', '7', // end
|
||||
MOD_MASK_CTRL, KS_EXTRA, (int)KE_C_END, '@', '7', // end
|
||||
MOD_MASK_SHIFT, '*', '9', '@', '9', // exit
|
||||
MOD_MASK_SHIFT, '*', '0', '@', '0', // find
|
||||
MOD_MASK_SHIFT, '#', '1', '%', '1', // help
|
||||
MOD_MASK_SHIFT, '#', '2', 'k', 'h', // home
|
||||
MOD_MASK_CTRL, KS_EXTRA, (int)KE_C_HOME, 'k', 'h', // home
|
||||
MOD_MASK_SHIFT, '#', '3', 'k', 'I', // insert
|
||||
MOD_MASK_SHIFT, '#', '4', 'k', 'l', // left arrow
|
||||
MOD_MASK_CTRL, KS_EXTRA, (int)KE_C_LEFT, 'k', 'l', // left arrow
|
||||
MOD_MASK_SHIFT, '%', 'a', '%', '3', // message
|
||||
MOD_MASK_SHIFT, '%', 'b', '%', '4', // move
|
||||
MOD_MASK_SHIFT, '%', 'c', '%', '5', // next
|
||||
MOD_MASK_SHIFT, '%', 'd', '%', '7', // options
|
||||
MOD_MASK_SHIFT, '%', 'e', '%', '8', // previous
|
||||
MOD_MASK_SHIFT, '%', 'f', '%', '9', // print
|
||||
MOD_MASK_SHIFT, '%', 'g', '%', '0', // redo
|
||||
MOD_MASK_SHIFT, '%', 'h', '&', '3', // replace
|
||||
MOD_MASK_SHIFT, '%', 'i', 'k', 'r', // right arr.
|
||||
MOD_MASK_CTRL, KS_EXTRA, (int)KE_C_RIGHT, 'k', 'r', // right arr.
|
||||
MOD_MASK_SHIFT, '%', 'j', '&', '5', // resume
|
||||
MOD_MASK_SHIFT, '!', '1', '&', '6', // save
|
||||
MOD_MASK_SHIFT, '!', '2', '&', '7', // suspend
|
||||
MOD_MASK_SHIFT, '!', '3', '&', '8', // undo
|
||||
MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_UP, 'k', 'u', // up arrow
|
||||
MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_DOWN, 'k', 'd', // down arrow
|
||||
|
||||
/* vt100 F1 */
|
||||
// vt100 F1
|
||||
MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_XF1, KS_EXTRA, (int)KE_XF1,
|
||||
MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_XF2, KS_EXTRA, (int)KE_XF2,
|
||||
MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_XF3, KS_EXTRA, (int)KE_XF3,
|
||||
MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_XF4, KS_EXTRA, (int)KE_XF4,
|
||||
|
||||
MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_F1, 'k', '1', /* F1 */
|
||||
MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_F1, 'k', '1', // F1
|
||||
MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_F2, 'k', '2',
|
||||
MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_F3, 'k', '3',
|
||||
MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_F4, 'k', '4',
|
||||
@ -101,7 +101,7 @@ static char_u modifier_keys_table[] =
|
||||
MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_F7, 'k', '7',
|
||||
MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_F8, 'k', '8',
|
||||
MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_F9, 'k', '9',
|
||||
MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_F10, 'k', ';', /* F10 */
|
||||
MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_F10, 'k', ';', // F10
|
||||
|
||||
MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_F11, 'F', '1',
|
||||
MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_F12, 'F', '2',
|
||||
@ -133,7 +133,7 @@ static char_u modifier_keys_table[] =
|
||||
MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_F36, 'F', 'Q',
|
||||
MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_F37, 'F', 'R',
|
||||
|
||||
/* TAB pseudo code*/
|
||||
// TAB pseudo code
|
||||
MOD_MASK_SHIFT, 'k', 'B', KS_EXTRA, (int)KE_TAB,
|
||||
|
||||
NUL
|
||||
@ -397,22 +397,38 @@ int handle_x_keys(const int key)
|
||||
FUNC_ATTR_CONST FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
{
|
||||
switch (key) {
|
||||
case K_XUP: return K_UP;
|
||||
case K_XDOWN: return K_DOWN;
|
||||
case K_XLEFT: return K_LEFT;
|
||||
case K_XRIGHT: return K_RIGHT;
|
||||
case K_XHOME: return K_HOME;
|
||||
case K_ZHOME: return K_HOME;
|
||||
case K_XEND: return K_END;
|
||||
case K_ZEND: return K_END;
|
||||
case K_XF1: return K_F1;
|
||||
case K_XF2: return K_F2;
|
||||
case K_XF3: return K_F3;
|
||||
case K_XF4: return K_F4;
|
||||
case K_S_XF1: return K_S_F1;
|
||||
case K_S_XF2: return K_S_F2;
|
||||
case K_S_XF3: return K_S_F3;
|
||||
case K_S_XF4: return K_S_F4;
|
||||
case K_XUP:
|
||||
return K_UP;
|
||||
case K_XDOWN:
|
||||
return K_DOWN;
|
||||
case K_XLEFT:
|
||||
return K_LEFT;
|
||||
case K_XRIGHT:
|
||||
return K_RIGHT;
|
||||
case K_XHOME:
|
||||
return K_HOME;
|
||||
case K_ZHOME:
|
||||
return K_HOME;
|
||||
case K_XEND:
|
||||
return K_END;
|
||||
case K_ZEND:
|
||||
return K_END;
|
||||
case K_XF1:
|
||||
return K_F1;
|
||||
case K_XF2:
|
||||
return K_F2;
|
||||
case K_XF3:
|
||||
return K_F3;
|
||||
case K_XF4:
|
||||
return K_F4;
|
||||
case K_S_XF1:
|
||||
return K_S_F1;
|
||||
case K_S_XF2:
|
||||
return K_S_F2;
|
||||
case K_S_XF3:
|
||||
return K_S_F3;
|
||||
case K_S_XF4:
|
||||
return K_S_F4;
|
||||
}
|
||||
return key;
|
||||
}
|
||||
@ -427,31 +443,33 @@ char_u *get_special_key_name(int c, int modifiers)
|
||||
|
||||
int i, idx;
|
||||
int table_idx;
|
||||
char_u *s;
|
||||
char_u *s;
|
||||
|
||||
string[0] = '<';
|
||||
idx = 1;
|
||||
|
||||
/* Key that stands for a normal character. */
|
||||
if (IS_SPECIAL(c) && KEY2TERMCAP0(c) == KS_KEY)
|
||||
// Key that stands for a normal character.
|
||||
if (IS_SPECIAL(c) && KEY2TERMCAP0(c) == KS_KEY) {
|
||||
c = KEY2TERMCAP1(c);
|
||||
}
|
||||
|
||||
/*
|
||||
* Translate shifted special keys into unshifted keys and set modifier.
|
||||
* Same for CTRL and ALT modifiers.
|
||||
*/
|
||||
if (IS_SPECIAL(c)) {
|
||||
for (i = 0; modifier_keys_table[i] != 0; i += MOD_KEYS_ENTRY_SIZE)
|
||||
if ( KEY2TERMCAP0(c) == (int)modifier_keys_table[i + 1]
|
||||
&& (int)KEY2TERMCAP1(c) == (int)modifier_keys_table[i + 2]) {
|
||||
for (i = 0; modifier_keys_table[i] != 0; i += MOD_KEYS_ENTRY_SIZE) {
|
||||
if (KEY2TERMCAP0(c) == (int)modifier_keys_table[i + 1]
|
||||
&& (int)KEY2TERMCAP1(c) == (int)modifier_keys_table[i + 2]) {
|
||||
modifiers |= modifier_keys_table[i];
|
||||
c = TERMCAP2KEY(modifier_keys_table[i + 3],
|
||||
modifier_keys_table[i + 4]);
|
||||
modifier_keys_table[i + 4]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* try to find the key in the special key table */
|
||||
// try to find the key in the special key table
|
||||
table_idx = find_special_key_in_table(c);
|
||||
|
||||
/*
|
||||
@ -459,14 +477,13 @@ char_u *get_special_key_name(int c, int modifiers)
|
||||
* extract modifiers.
|
||||
*/
|
||||
if (c > 0
|
||||
&& (*mb_char2len)(c) == 1
|
||||
) {
|
||||
&& (*mb_char2len)(c) == 1) {
|
||||
if (table_idx < 0
|
||||
&& (!vim_isprintc(c) || (c & 0x7f) == ' ')
|
||||
&& (c & 0x80)) {
|
||||
c &= 0x7f;
|
||||
modifiers |= MOD_MASK_ALT;
|
||||
/* try again, to find the un-alted key in the special key table */
|
||||
// try again, to find the un-alted key in the special key table
|
||||
table_idx = find_special_key_in_table(c);
|
||||
}
|
||||
if (table_idx < 0 && !vim_isprintc(c) && c < ' ') {
|
||||
@ -475,15 +492,16 @@ char_u *get_special_key_name(int c, int modifiers)
|
||||
}
|
||||
}
|
||||
|
||||
/* translate the modifier into a string */
|
||||
for (i = 0; mod_mask_table[i].name != 'A'; i++)
|
||||
// translate the modifier into a string
|
||||
for (i = 0; mod_mask_table[i].name != 'A'; i++) {
|
||||
if ((modifiers & mod_mask_table[i].mod_mask)
|
||||
== mod_mask_table[i].mod_flag) {
|
||||
string[idx++] = mod_mask_table[i].name;
|
||||
string[idx++] = (char_u)'-';
|
||||
}
|
||||
}
|
||||
|
||||
if (table_idx < 0) { /* unknown special key, may output t_xx */
|
||||
if (table_idx < 0) { // unknown special key, may output t_xx
|
||||
if (IS_SPECIAL(c)) {
|
||||
string[idx++] = 't';
|
||||
string[idx++] = '_';
|
||||
@ -497,16 +515,17 @@ char_u *get_special_key_name(int c, int modifiers)
|
||||
string[idx++] = (char_u)c;
|
||||
} else {
|
||||
s = transchar(c);
|
||||
while (*s)
|
||||
while (*s) {
|
||||
string[idx++] = *s++;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else { // use name of special key
|
||||
size_t len = STRLEN(key_names_table[table_idx].name);
|
||||
|
||||
if ((int)len + idx + 2 <= MAX_KEY_NAME_LEN) {
|
||||
STRCPY(string + idx, key_names_table[table_idx].name);
|
||||
idx += (int)len;
|
||||
STRCPY(string + idx, key_names_table[table_idx].name);
|
||||
idx += (int)len;
|
||||
}
|
||||
}
|
||||
string[idx++] = '>';
|
||||
@ -525,9 +544,8 @@ char_u *get_special_key_name(int c, int modifiers)
|
||||
/// @param[in] in_string Inside a double quoted string
|
||||
///
|
||||
/// @return Number of characters added to dst, zero for no match.
|
||||
unsigned int trans_special(const char_u **srcp, const size_t src_len,
|
||||
char_u *const dst, const bool keycode,
|
||||
const bool in_string)
|
||||
unsigned int trans_special(const char_u **srcp, const size_t src_len, char_u *const dst,
|
||||
const bool keycode, const bool in_string)
|
||||
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
{
|
||||
int modifiers = 0;
|
||||
@ -582,9 +600,8 @@ unsigned int special_to_buf(int key, int modifiers, bool keycode, char_u *dst)
|
||||
/// @param[in] in_string In string, double quote is escaped
|
||||
///
|
||||
/// @return Key and modifiers or 0 if there is no match.
|
||||
int find_special_key(const char_u **srcp, const size_t src_len, int *const modp,
|
||||
const bool keycode, const bool keep_x_key,
|
||||
const bool in_string)
|
||||
int find_special_key(const char_u **srcp, const size_t src_len, int *const modp, const bool keycode,
|
||||
const bool keep_x_key, const bool in_string)
|
||||
FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
const char_u *last_dash;
|
||||
@ -641,7 +658,7 @@ int find_special_key(const char_u **srcp, const size_t src_len, int *const modp,
|
||||
if (bp <= end && *bp == '>') { // found matching '>'
|
||||
end_of_name = bp + 1;
|
||||
|
||||
/* Which modifiers are given? */
|
||||
// Which modifiers are given?
|
||||
modifiers = 0x0;
|
||||
for (bp = src + 1; bp < last_dash; bp++) {
|
||||
if (*bp != '-') {
|
||||
@ -795,13 +812,14 @@ int get_mouse_button(int code, bool *is_click, bool *is_drag)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; mouse_table[i].pseudo_code; i++)
|
||||
for (i = 0; mouse_table[i].pseudo_code; i++) {
|
||||
if (code == mouse_table[i].pseudo_code) {
|
||||
*is_click = mouse_table[i].is_click;
|
||||
*is_drag = mouse_table[i].is_drag;
|
||||
return mouse_table[i].button;
|
||||
}
|
||||
return 0; /* Shouldn't get here */
|
||||
}
|
||||
return 0; // Shouldn't get here
|
||||
}
|
||||
|
||||
/// Replace any terminal code strings with the equivalent internal
|
||||
@ -829,9 +847,8 @@ int get_mouse_button(int code, bool *is_click, bool *is_drag)
|
||||
/// @return Pointer to an allocated memory in case of success, "from" in case of
|
||||
/// failure. In case of success returned pointer is also saved to
|
||||
/// "bufp".
|
||||
char_u *replace_termcodes(const char_u *from, const size_t from_len,
|
||||
char_u **bufp, const bool from_part, const bool do_lt,
|
||||
const bool special, int cpo_flags)
|
||||
char_u *replace_termcodes(const char_u *from, const size_t from_len, char_u **bufp,
|
||||
const bool from_part, const bool do_lt, const bool special, int cpo_flags)
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
ssize_t i;
|
||||
@ -841,7 +858,7 @@ char_u *replace_termcodes(const char_u *from, const size_t from_len,
|
||||
const char_u *src;
|
||||
const char_u *const end = from + from_len - 1;
|
||||
int do_backslash; // backslash is a special character
|
||||
char_u *result; // buffer for resulting string
|
||||
char_u *result; // buffer for resulting string
|
||||
|
||||
do_backslash = !(cpo_flags&FLAG_CPO_BSLASH);
|
||||
|
||||
@ -897,7 +914,7 @@ char_u *replace_termcodes(const char_u *from, const size_t from_len,
|
||||
}
|
||||
|
||||
if (special) {
|
||||
char_u *p, *s, len;
|
||||
char_u *p, *s, len;
|
||||
|
||||
// Replace <Leader> by the value of "mapleader".
|
||||
// Replace <LocalLeader> by the value of "maplocalleader".
|
||||
|
@ -17,9 +17,9 @@
|
||||
|
||||
#include "auto/config.h"
|
||||
#include "nvim/log.h"
|
||||
#include "nvim/types.h"
|
||||
#include "nvim/os/os.h"
|
||||
#include "nvim/os/time.h"
|
||||
#include "nvim/types.h"
|
||||
|
||||
#define LOG_FILE_ENV "NVIM_LOG_FILE"
|
||||
|
||||
@ -124,8 +124,8 @@ void log_unlock(void)
|
||||
/// @param line_num Source line number, or -1
|
||||
/// @param eol Append linefeed "\n"
|
||||
/// @param fmt printf-style format string
|
||||
bool logmsg(int log_level, const char *context, const char *func_name,
|
||||
int line_num, bool eol, const char *fmt, ...)
|
||||
bool logmsg(int log_level, const char *context, const char *func_name, int line_num, bool eol,
|
||||
const char *fmt, ...)
|
||||
FUNC_ATTR_UNUSED FUNC_ATTR_PRINTF(6, 7)
|
||||
{
|
||||
if (log_level < MIN_LOG_LEVEL) {
|
||||
@ -215,8 +215,7 @@ FILE *open_log_file(void)
|
||||
}
|
||||
|
||||
#ifdef HAVE_EXECINFO_BACKTRACE
|
||||
void log_callstack_to_file(FILE *log_file, const char *const func_name,
|
||||
const int line_num)
|
||||
void log_callstack_to_file(FILE *log_file, const char *const func_name, const int line_num)
|
||||
{
|
||||
void *trace[100];
|
||||
int trace_size = backtrace(trace, ARRAY_SIZE(trace));
|
||||
@ -268,8 +267,7 @@ end:
|
||||
#endif
|
||||
|
||||
static bool do_log_to_file(FILE *log_file, int log_level, const char *context,
|
||||
const char *func_name, int line_num, bool eol,
|
||||
const char *fmt, ...)
|
||||
const char *func_name, int line_num, bool eol, const char *fmt, ...)
|
||||
FUNC_ATTR_PRINTF(7, 8)
|
||||
{
|
||||
va_list args;
|
||||
@ -281,9 +279,8 @@ static bool do_log_to_file(FILE *log_file, int log_level, const char *context,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bool v_do_log_to_file(FILE *log_file, int log_level,
|
||||
const char *context, const char *func_name,
|
||||
int line_num, bool eol, const char *fmt,
|
||||
static bool v_do_log_to_file(FILE *log_file, int log_level, const char *context,
|
||||
const char *func_name, int line_num, bool eol, const char *fmt,
|
||||
va_list args)
|
||||
{
|
||||
static const char *log_levels[] = {
|
||||
@ -317,10 +314,10 @@ static bool v_do_log_to_file(FILE *log_file, int log_level,
|
||||
? fprintf(log_file, "%s %s.%03d %-5" PRId64 " %s",
|
||||
log_levels[log_level], date_time, millis, pid,
|
||||
(context == NULL ? "?:" : context))
|
||||
: fprintf(log_file, "%s %s.%03d %-5" PRId64 " %s%s:%d: ",
|
||||
log_levels[log_level], date_time, millis, pid,
|
||||
(context == NULL ? "" : context),
|
||||
func_name, line_num);
|
||||
: fprintf(log_file, "%s %s.%03d %-5" PRId64 " %s%s:%d: ",
|
||||
log_levels[log_level], date_time, millis, pid,
|
||||
(context == NULL ? "" : context),
|
||||
func_name, line_num);
|
||||
if (rv < 0) {
|
||||
return false;
|
||||
}
|
||||
|
@ -260,7 +260,7 @@ int tslua_push_parser(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static TSParser ** parser_check(lua_State *L, uint16_t index)
|
||||
static TSParser **parser_check(lua_State *L, uint16_t index)
|
||||
{
|
||||
return luaL_checkudata(L, index, TS_META_PARSER);
|
||||
}
|
||||
|
@ -1999,7 +1999,7 @@ void mb_check_adjust_col(void *win_)
|
||||
/// @param line start of the string
|
||||
///
|
||||
/// @return a pointer to the character before "*p", if there is one.
|
||||
char_u * mb_prevptr(char_u *line, char_u *p)
|
||||
char_u *mb_prevptr(char_u *line, char_u *p)
|
||||
{
|
||||
if (p > line) {
|
||||
MB_PTR_BACK(line, p);
|
||||
@ -2099,7 +2099,7 @@ const char *mb_unescape(const char **const pp)
|
||||
/*
|
||||
* Skip the Vim specific head of a 'encoding' name.
|
||||
*/
|
||||
char_u * enc_skip(char_u *p)
|
||||
char_u *enc_skip(char_u *p)
|
||||
{
|
||||
if (STRNCMP(p, "2byte-", 6) == 0) {
|
||||
return p + 6;
|
||||
@ -2202,7 +2202,7 @@ static int enc_alias_search(char_u *name)
|
||||
* Get the canonicalized encoding of the current locale.
|
||||
* Returns an allocated string when successful, NULL when not.
|
||||
*/
|
||||
char_u * enc_locale(void)
|
||||
char_u *enc_locale(void)
|
||||
{
|
||||
int i;
|
||||
char buf[50];
|
||||
@ -2274,7 +2274,7 @@ enc_locale_copy_enc:
|
||||
* Returns (void *)-1 if failed.
|
||||
* (should return iconv_t, but that causes problems with prototypes).
|
||||
*/
|
||||
void * my_iconv_open(char_u *to, char_u *from)
|
||||
void *my_iconv_open(char_u *to, char_u *from)
|
||||
{
|
||||
iconv_t fd;
|
||||
#define ICONV_TESTLEN 400
|
||||
@ -2501,8 +2501,8 @@ char_u *string_convert(const vimconv_T *const vcp, char_u *ptr, size_t *lenp)
|
||||
* an incomplete sequence at the end it is not converted and "*unconvlenp" is
|
||||
* set to the number of remaining bytes.
|
||||
*/
|
||||
char_u * string_convert_ext(const vimconv_T *const vcp, char_u *ptr, size_t *lenp,
|
||||
size_t *unconvlenp)
|
||||
char_u *string_convert_ext(const vimconv_T *const vcp, char_u *ptr, size_t *lenp,
|
||||
size_t *unconvlenp)
|
||||
{
|
||||
char_u *retval = NULL;
|
||||
char_u *d;
|
||||
|
@ -1146,7 +1146,7 @@ size_t home_replace(const buf_T *const buf, const char_u *src, char_u *const dst
|
||||
/// Like home_replace, store the replaced string in allocated memory.
|
||||
/// @param buf When not NULL, check for help files
|
||||
/// @param src Input file name
|
||||
char_u * home_replace_save(buf_T *buf, char_u *src) FUNC_ATTR_NONNULL_RET
|
||||
char_u *home_replace_save(buf_T *buf, char_u *src) FUNC_ATTR_NONNULL_RET
|
||||
{
|
||||
size_t len = 3; // space for "~/" and trailing NUL
|
||||
if (src != NULL) { // just in case
|
||||
|
@ -119,7 +119,7 @@ void signal_accept_deadly(void)
|
||||
rejecting_deadly = false;
|
||||
}
|
||||
|
||||
static char * signal_name(int signum)
|
||||
static char *signal_name(int signum)
|
||||
{
|
||||
switch (signum) {
|
||||
#ifdef SIGPWR
|
||||
|
@ -93,7 +93,7 @@ typedef struct hl_group {
|
||||
static garray_T highlight_ga = GA_EMPTY_INIT_VALUE;
|
||||
Map(cstr_t, int) highlight_unames = MAP_INIT;
|
||||
|
||||
static inline struct hl_group * HL_TABLE(void)
|
||||
static inline struct hl_group *HL_TABLE(void)
|
||||
{
|
||||
return ((struct hl_group *)((highlight_ga.ga_data)));
|
||||
}
|
||||
|
@ -7058,13 +7058,13 @@ void win_id2tabwin(typval_T *const argvars, typval_T *const rettv)
|
||||
tv_list_append_number(list, winnr);
|
||||
}
|
||||
|
||||
win_T * win_id2wp(typval_T *argvars)
|
||||
win_T *win_id2wp(typval_T *argvars)
|
||||
{
|
||||
return win_id2wp_tp(argvars, NULL);
|
||||
}
|
||||
|
||||
// Return the window and tab pointer of window "id".
|
||||
win_T * win_id2wp_tp(typval_T *argvars, tabpage_T **tpp)
|
||||
win_T *win_id2wp_tp(typval_T *argvars, tabpage_T **tpp)
|
||||
{
|
||||
int id = tv_get_number(&argvars[0]);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user