mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
lint
This commit is contained in:
parent
2ed2b1d505
commit
d72c177b2a
@ -4363,9 +4363,9 @@ void ex_help(exarg_T *eap)
|
||||
if (!curwin->w_buffer->b_help
|
||||
|| cmdmod.tab != 0
|
||||
) {
|
||||
if (cmdmod.tab != 0)
|
||||
if (cmdmod.tab != 0) {
|
||||
wp = NULL;
|
||||
else {
|
||||
} else {
|
||||
wp = NULL;
|
||||
FOR_ALL_WINDOWS_IN_TAB(wp2, curtab) {
|
||||
if (wp2->w_buffer != NULL && wp2->w_buffer->b_help) {
|
||||
@ -4374,13 +4374,11 @@ void ex_help(exarg_T *eap)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (wp != NULL && wp->w_buffer->b_nwindows > 0)
|
||||
if (wp != NULL && wp->w_buffer->b_nwindows > 0) {
|
||||
win_enter(wp, true);
|
||||
else {
|
||||
/*
|
||||
* There is no help window yet.
|
||||
* Try to open the file specified by the "helpfile" option.
|
||||
*/
|
||||
} else {
|
||||
// There is no help window yet.
|
||||
// Try to open the file specified by the "helpfile" option.
|
||||
if ((helpfd = mch_fopen((char *)p_hf, READBIN)) == NULL) {
|
||||
smsg(_("Sorry, help file \"%s\" not found"), p_hf);
|
||||
goto erret;
|
||||
|
@ -5853,12 +5853,12 @@ static void ex_close(exarg_T *eap)
|
||||
{
|
||||
win_T *win = NULL;
|
||||
int winnr = 0;
|
||||
if (cmdwin_type != 0)
|
||||
if (cmdwin_type != 0) {
|
||||
cmdwin_result = Ctrl_C;
|
||||
else if (!text_locked() && !curbuf_locked()) {
|
||||
if (eap->addr_count == 0)
|
||||
} else if (!text_locked() && !curbuf_locked()) {
|
||||
if (eap->addr_count == 0) {
|
||||
ex_win_close(eap->forceit, curwin, NULL);
|
||||
else {
|
||||
} else {
|
||||
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
|
||||
winnr++;
|
||||
if (winnr == eap->line2) {
|
||||
|
@ -4751,14 +4751,14 @@ check_timestamps (
|
||||
|
||||
if (!stuff_empty() || global_busy || !typebuf_typed()
|
||||
|| autocmd_busy || curbuf_lock > 0 || allbuf_lock > 0
|
||||
)
|
||||
need_check_timestamps = TRUE; /* check later */
|
||||
else {
|
||||
++no_wait_return;
|
||||
did_check_timestamps = TRUE;
|
||||
already_warned = FALSE;
|
||||
) {
|
||||
need_check_timestamps = true; // check later
|
||||
} else {
|
||||
no_wait_return++;
|
||||
did_check_timestamps = true;
|
||||
already_warned = false;
|
||||
FOR_ALL_BUFFERS(buf) {
|
||||
/* Only check buffers in a window. */
|
||||
// Only check buffers in a window.
|
||||
if (buf->b_nwindows > 0) {
|
||||
bufref_T bufref;
|
||||
set_bufref(&bufref, buf);
|
||||
|
@ -2488,7 +2488,7 @@ int fix_input_buffer(char_u *buf, int len)
|
||||
for (i = len; --i >= 0; ++p) {
|
||||
if (p[0] == NUL
|
||||
|| (p[0] == K_SPECIAL
|
||||
&& (i < 2 || p[1] != KS_EXTRA))) {
|
||||
&& (i < 2 || p[1] != KS_EXTRA))) {
|
||||
memmove(p + 3, p + 1, (size_t)i);
|
||||
p[2] = (char_u)K_THIRD(p[0]);
|
||||
p[1] = (char_u)K_SECOND(p[0]);
|
||||
|
@ -2321,7 +2321,7 @@ int get_keystroke(void)
|
||||
* terminal code to complete. */
|
||||
n = os_inchar(buf + len, maxlen, len == 0 ? -1L : 100L, 0);
|
||||
if (n > 0) {
|
||||
/* Replace zero and CSI by a special key code. */
|
||||
// Replace zero and CSI by a special key code.
|
||||
n = fix_input_buffer(buf + len, n);
|
||||
len += n;
|
||||
waited = 0;
|
||||
|
@ -3625,10 +3625,10 @@ set_bool_option (
|
||||
|
||||
FOR_ALL_BUFFERS(bp) {
|
||||
curbuf = bp;
|
||||
/* When 'undofile' is set globally: for every buffer, otherwise
|
||||
* only for the current buffer: Try to read in the undofile,
|
||||
* if one exists, the buffer wasn't changed and the buffer was
|
||||
* loaded */
|
||||
// When 'undofile' is set globally: for every buffer, otherwise
|
||||
// only for the current buffer: Try to read in the undofile,
|
||||
// if one exists, the buffer wasn't changed and the buffer was
|
||||
// loaded
|
||||
if ((curbuf == save_curbuf
|
||||
|| (opt_flags & OPT_GLOBAL) || opt_flags == 0)
|
||||
&& !curbufIsChanged() && curbuf->b_ml.ml_mfp != NULL) {
|
||||
|
@ -1795,15 +1795,14 @@ static void spell_load_cb(char_u *fname, void *cookie)
|
||||
}
|
||||
}
|
||||
|
||||
// Add a word to the hashtable of common words.
|
||||
// If it's already there then the counter is increased.
|
||||
void
|
||||
count_common_word (
|
||||
slang_T *lp,
|
||||
char_u *word,
|
||||
int len, // word length, -1 for upto NUL
|
||||
int count // 1 to count once, 10 to init
|
||||
)
|
||||
/// Add a word to the hashtable of common words.
|
||||
/// If it's already there then the counter is increased.
|
||||
///
|
||||
/// @param[in] lp
|
||||
/// @param[in] word added to common words hashtable
|
||||
/// @param[in] len length of word or -1 for NUL terminated
|
||||
/// @param[in] count 1 to count once, 10 to init
|
||||
void count_common_word(slang_T *lp, char_u *word, int len, int count)
|
||||
{
|
||||
hash_T hash;
|
||||
hashitem_T *hi;
|
||||
@ -2288,16 +2287,17 @@ static int find_region(char_u *rp, char_u *region)
|
||||
return i / 2;
|
||||
}
|
||||
|
||||
// Return case type of word:
|
||||
// w word 0
|
||||
// Word WF_ONECAP
|
||||
// W WORD WF_ALLCAP
|
||||
// WoRd wOrd WF_KEEPCAP
|
||||
int
|
||||
captype (
|
||||
char_u *word,
|
||||
char_u *end // When NULL use up to NUL byte.
|
||||
)
|
||||
/// Return case type of word:
|
||||
/// w word 0
|
||||
/// Word WF_ONECAP
|
||||
/// W WORD WF_ALLCAP
|
||||
/// WoRd wOrd WF_KEEPCAP
|
||||
///
|
||||
/// @param[in] word
|
||||
/// @param[in] end End of word or NULL for NUL delimited string
|
||||
///
|
||||
/// @returns Case type of word
|
||||
int captype(char_u *word, char_u *end)
|
||||
{
|
||||
char_u *p;
|
||||
int c;
|
||||
@ -3396,15 +3396,14 @@ static void spell_find_cleanup(suginfo_T *su)
|
||||
hash_clear_all(&su->su_banned, 0);
|
||||
}
|
||||
|
||||
// Make a copy of "word", with the first letter upper or lower cased, to
|
||||
// "wcopy[MAXWLEN]". "word" must not be empty.
|
||||
// The result is NUL terminated.
|
||||
void
|
||||
onecap_copy (
|
||||
char_u *word,
|
||||
char_u *wcopy,
|
||||
bool upper // true: first letter made upper case
|
||||
)
|
||||
/// Make a copy of "word", with the first letter upper or lower cased, to
|
||||
/// "wcopy[MAXWLEN]". "word" must not be empty.
|
||||
/// The result is NUL terminated.
|
||||
///
|
||||
/// @param[in] word source string to copy
|
||||
/// @param[in,out] wcopy copied string, with case of first letter changed
|
||||
/// @param[in] upper True to upper case, otherwise lower case
|
||||
void onecap_copy(char_u *word, char_u *wcopy, bool upper)
|
||||
{
|
||||
char_u *p;
|
||||
int c;
|
||||
@ -4982,8 +4981,9 @@ static void find_keepcap_word(slang_T *slang, char_u *fword, char_u *kword)
|
||||
if (has_mbyte) {
|
||||
flen = MB_CPTR2LEN(fword + fwordidx[depth]);
|
||||
ulen = MB_CPTR2LEN(uword + uwordidx[depth]);
|
||||
} else
|
||||
} else {
|
||||
ulen = flen = 1;
|
||||
}
|
||||
if (round[depth] == 1) {
|
||||
p = fword + fwordidx[depth];
|
||||
l = flen;
|
||||
@ -5885,23 +5885,22 @@ char_u *eval_soundfold(char_u *word)
|
||||
return vim_strsave(word);
|
||||
}
|
||||
|
||||
// Turn "inword" into its sound-a-like equivalent in "res[MAXWLEN]".
|
||||
//
|
||||
// There are many ways to turn a word into a sound-a-like representation. The
|
||||
// oldest is Soundex (1918!). A nice overview can be found in "Approximate
|
||||
// swedish name matching - survey and test of different algorithms" by Klas
|
||||
// Erikson.
|
||||
//
|
||||
// We support two methods:
|
||||
// 1. SOFOFROM/SOFOTO do a simple character mapping.
|
||||
// 2. SAL items define a more advanced sound-folding (and much slower).
|
||||
void
|
||||
spell_soundfold (
|
||||
slang_T *slang,
|
||||
char_u *inword,
|
||||
bool folded, // "inword" is already case-folded
|
||||
char_u *res
|
||||
)
|
||||
/// Turn "inword" into its sound-a-like equivalent in "res[MAXWLEN]".
|
||||
///
|
||||
/// There are many ways to turn a word into a sound-a-like representation. The
|
||||
/// oldest is Soundex (1918!). A nice overview can be found in "Approximate
|
||||
/// swedish name matching - survey and test of different algorithms" by Klas
|
||||
/// Erikson.
|
||||
///
|
||||
/// We support two methods:
|
||||
/// 1. SOFOFROM/SOFOTO do a simple character mapping.
|
||||
/// 2. SAL items define a more advanced sound-folding (and much slower).
|
||||
///
|
||||
/// @param[in] slang
|
||||
/// @param[in] inword word to soundfold
|
||||
/// @param[in] folded whether inword is already case-folded
|
||||
/// @param[in,out] res destination for soundfolded word
|
||||
void spell_soundfold(slang_T *slang, char_u *inword, bool folded, char_u *res)
|
||||
{
|
||||
char_u fword[MAXWLEN];
|
||||
char_u *word;
|
||||
|
@ -384,14 +384,12 @@ struct sblock_S {
|
||||
// A node in the tree.
|
||||
typedef struct wordnode_S wordnode_T;
|
||||
struct wordnode_S {
|
||||
union // shared to save space
|
||||
{
|
||||
union { // shared to save space
|
||||
char_u hashkey[6]; // the hash key, only used while compressing
|
||||
int index; // index in written nodes (valid after first
|
||||
// round)
|
||||
} wn_u1;
|
||||
union // shared to save space
|
||||
{
|
||||
union { // shared to save space
|
||||
wordnode_T *next; // next node with same hash key
|
||||
wordnode_T *wnode; // parent node that will write this node
|
||||
} wn_u2;
|
||||
|
@ -168,10 +168,11 @@ newwindow:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (wp == NULL)
|
||||
if (wp == NULL) {
|
||||
EMSG(_("E441: There is no preview window"));
|
||||
else
|
||||
} else {
|
||||
win_goto(wp);
|
||||
}
|
||||
break;
|
||||
|
||||
/* close all but current window */
|
||||
@ -3366,10 +3367,10 @@ void tabpage_move(int nr)
|
||||
|
||||
tp_dst = tp;
|
||||
|
||||
/* Remove the current tab page from the list of tab pages. */
|
||||
if (curtab == first_tabpage)
|
||||
// Remove the current tab page from the list of tab pages.
|
||||
if (curtab == first_tabpage) {
|
||||
first_tabpage = curtab->tp_next;
|
||||
else {
|
||||
} else {
|
||||
tp = NULL;
|
||||
FOR_ALL_TABS(tp2) {
|
||||
if (tp2->tp_next == curtab) {
|
||||
@ -3377,8 +3378,9 @@ void tabpage_move(int nr)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (tp == NULL) /* "cannot happen" */
|
||||
if (tp == NULL) { // "cannot happen"
|
||||
return;
|
||||
}
|
||||
tp->tp_next = curtab->tp_next;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user