This commit is contained in:
James McCoy 2017-03-11 00:26:44 -05:00
parent 2ed2b1d505
commit d72c177b2a
No known key found for this signature in database
GPG Key ID: DFE691AE331BA3DB
9 changed files with 78 additions and 81 deletions

View File

@ -4363,9 +4363,9 @@ void ex_help(exarg_T *eap)
if (!curwin->w_buffer->b_help if (!curwin->w_buffer->b_help
|| cmdmod.tab != 0 || cmdmod.tab != 0
) { ) {
if (cmdmod.tab != 0) if (cmdmod.tab != 0) {
wp = NULL; wp = NULL;
else { } else {
wp = NULL; wp = NULL;
FOR_ALL_WINDOWS_IN_TAB(wp2, curtab) { FOR_ALL_WINDOWS_IN_TAB(wp2, curtab) {
if (wp2->w_buffer != NULL && wp2->w_buffer->b_help) { 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); win_enter(wp, true);
else { } else {
/* // There is no help window yet.
* There is no help window yet. // Try to open the file specified by the "helpfile" option.
* Try to open the file specified by the "helpfile" option.
*/
if ((helpfd = mch_fopen((char *)p_hf, READBIN)) == NULL) { if ((helpfd = mch_fopen((char *)p_hf, READBIN)) == NULL) {
smsg(_("Sorry, help file \"%s\" not found"), p_hf); smsg(_("Sorry, help file \"%s\" not found"), p_hf);
goto erret; goto erret;

View File

@ -5853,12 +5853,12 @@ static void ex_close(exarg_T *eap)
{ {
win_T *win = NULL; win_T *win = NULL;
int winnr = 0; int winnr = 0;
if (cmdwin_type != 0) if (cmdwin_type != 0) {
cmdwin_result = Ctrl_C; cmdwin_result = Ctrl_C;
else if (!text_locked() && !curbuf_locked()) { } else if (!text_locked() && !curbuf_locked()) {
if (eap->addr_count == 0) if (eap->addr_count == 0) {
ex_win_close(eap->forceit, curwin, NULL); ex_win_close(eap->forceit, curwin, NULL);
else { } else {
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) { FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
winnr++; winnr++;
if (winnr == eap->line2) { if (winnr == eap->line2) {

View File

@ -4751,14 +4751,14 @@ check_timestamps (
if (!stuff_empty() || global_busy || !typebuf_typed() if (!stuff_empty() || global_busy || !typebuf_typed()
|| autocmd_busy || curbuf_lock > 0 || allbuf_lock > 0 || autocmd_busy || curbuf_lock > 0 || allbuf_lock > 0
) ) {
need_check_timestamps = TRUE; /* check later */ need_check_timestamps = true; // check later
else { } else {
++no_wait_return; no_wait_return++;
did_check_timestamps = TRUE; did_check_timestamps = true;
already_warned = FALSE; already_warned = false;
FOR_ALL_BUFFERS(buf) { FOR_ALL_BUFFERS(buf) {
/* Only check buffers in a window. */ // Only check buffers in a window.
if (buf->b_nwindows > 0) { if (buf->b_nwindows > 0) {
bufref_T bufref; bufref_T bufref;
set_bufref(&bufref, buf); set_bufref(&bufref, buf);

View File

@ -2488,7 +2488,7 @@ int fix_input_buffer(char_u *buf, int len)
for (i = len; --i >= 0; ++p) { for (i = len; --i >= 0; ++p) {
if (p[0] == NUL if (p[0] == NUL
|| (p[0] == K_SPECIAL || (p[0] == K_SPECIAL
&& (i < 2 || p[1] != KS_EXTRA))) { && (i < 2 || p[1] != KS_EXTRA))) {
memmove(p + 3, p + 1, (size_t)i); memmove(p + 3, p + 1, (size_t)i);
p[2] = (char_u)K_THIRD(p[0]); p[2] = (char_u)K_THIRD(p[0]);
p[1] = (char_u)K_SECOND(p[0]); p[1] = (char_u)K_SECOND(p[0]);

View File

@ -2321,7 +2321,7 @@ int get_keystroke(void)
* terminal code to complete. */ * terminal code to complete. */
n = os_inchar(buf + len, maxlen, len == 0 ? -1L : 100L, 0); n = os_inchar(buf + len, maxlen, len == 0 ? -1L : 100L, 0);
if (n > 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); n = fix_input_buffer(buf + len, n);
len += n; len += n;
waited = 0; waited = 0;

View File

@ -3625,10 +3625,10 @@ set_bool_option (
FOR_ALL_BUFFERS(bp) { FOR_ALL_BUFFERS(bp) {
curbuf = bp; curbuf = bp;
/* When 'undofile' is set globally: for every buffer, otherwise // When 'undofile' is set globally: for every buffer, otherwise
* only for the current buffer: Try to read in the undofile, // only for the current buffer: Try to read in the undofile,
* if one exists, the buffer wasn't changed and the buffer was // if one exists, the buffer wasn't changed and the buffer was
* loaded */ // loaded
if ((curbuf == save_curbuf if ((curbuf == save_curbuf
|| (opt_flags & OPT_GLOBAL) || opt_flags == 0) || (opt_flags & OPT_GLOBAL) || opt_flags == 0)
&& !curbufIsChanged() && curbuf->b_ml.ml_mfp != NULL) { && !curbufIsChanged() && curbuf->b_ml.ml_mfp != NULL) {

View File

@ -1795,15 +1795,14 @@ static void spell_load_cb(char_u *fname, void *cookie)
} }
} }
// Add a word to the hashtable of common words. /// Add a word to the hashtable of common words.
// If it's already there then the counter is increased. /// If it's already there then the counter is increased.
void ///
count_common_word ( /// @param[in] lp
slang_T *lp, /// @param[in] word added to common words hashtable
char_u *word, /// @param[in] len length of word or -1 for NUL terminated
int len, // word length, -1 for upto NUL /// @param[in] count 1 to count once, 10 to init
int 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; hash_T hash;
hashitem_T *hi; hashitem_T *hi;
@ -2288,16 +2287,17 @@ static int find_region(char_u *rp, char_u *region)
return i / 2; return i / 2;
} }
// Return case type of word: /// Return case type of word:
// w word 0 /// w word 0
// Word WF_ONECAP /// Word WF_ONECAP
// W WORD WF_ALLCAP /// W WORD WF_ALLCAP
// WoRd wOrd WF_KEEPCAP /// WoRd wOrd WF_KEEPCAP
int ///
captype ( /// @param[in] word
char_u *word, /// @param[in] end End of word or NULL for NUL delimited string
char_u *end // When NULL use up to NUL byte. ///
) /// @returns Case type of word
int captype(char_u *word, char_u *end)
{ {
char_u *p; char_u *p;
int c; int c;
@ -3396,15 +3396,14 @@ static void spell_find_cleanup(suginfo_T *su)
hash_clear_all(&su->su_banned, 0); hash_clear_all(&su->su_banned, 0);
} }
// Make a copy of "word", with the first letter upper or lower cased, to /// Make a copy of "word", with the first letter upper or lower cased, to
// "wcopy[MAXWLEN]". "word" must not be empty. /// "wcopy[MAXWLEN]". "word" must not be empty.
// The result is NUL terminated. /// The result is NUL terminated.
void ///
onecap_copy ( /// @param[in] word source string to copy
char_u *word, /// @param[in,out] wcopy copied string, with case of first letter changed
char_u *wcopy, /// @param[in] upper True to upper case, otherwise lower case
bool upper // true: first letter made upper case void onecap_copy(char_u *word, char_u *wcopy, bool upper)
)
{ {
char_u *p; char_u *p;
int c; int c;
@ -4982,8 +4981,9 @@ static void find_keepcap_word(slang_T *slang, char_u *fword, char_u *kword)
if (has_mbyte) { if (has_mbyte) {
flen = MB_CPTR2LEN(fword + fwordidx[depth]); flen = MB_CPTR2LEN(fword + fwordidx[depth]);
ulen = MB_CPTR2LEN(uword + uwordidx[depth]); ulen = MB_CPTR2LEN(uword + uwordidx[depth]);
} else } else {
ulen = flen = 1; ulen = flen = 1;
}
if (round[depth] == 1) { if (round[depth] == 1) {
p = fword + fwordidx[depth]; p = fword + fwordidx[depth];
l = flen; l = flen;
@ -5885,23 +5885,22 @@ char_u *eval_soundfold(char_u *word)
return vim_strsave(word); return vim_strsave(word);
} }
// Turn "inword" into its sound-a-like equivalent in "res[MAXWLEN]". /// 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 /// 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 /// oldest is Soundex (1918!). A nice overview can be found in "Approximate
// swedish name matching - survey and test of different algorithms" by Klas /// swedish name matching - survey and test of different algorithms" by Klas
// Erikson. /// Erikson.
// ///
// We support two methods: /// We support two methods:
// 1. SOFOFROM/SOFOTO do a simple character mapping. /// 1. SOFOFROM/SOFOTO do a simple character mapping.
// 2. SAL items define a more advanced sound-folding (and much slower). /// 2. SAL items define a more advanced sound-folding (and much slower).
void ///
spell_soundfold ( /// @param[in] slang
slang_T *slang, /// @param[in] inword word to soundfold
char_u *inword, /// @param[in] folded whether inword is already case-folded
bool folded, // "inword" is already case-folded /// @param[in,out] res destination for soundfolded word
char_u *res void spell_soundfold(slang_T *slang, char_u *inword, bool folded, char_u *res)
)
{ {
char_u fword[MAXWLEN]; char_u fword[MAXWLEN];
char_u *word; char_u *word;

View File

@ -384,14 +384,12 @@ struct sblock_S {
// A node in the tree. // A node in the tree.
typedef struct wordnode_S wordnode_T; typedef struct wordnode_S wordnode_T;
struct wordnode_S { struct wordnode_S {
union // shared to save space union { // shared to save space
{
char_u hashkey[6]; // the hash key, only used while compressing char_u hashkey[6]; // the hash key, only used while compressing
int index; // index in written nodes (valid after first int index; // index in written nodes (valid after first
// round) // round)
} wn_u1; } wn_u1;
union // shared to save space union { // shared to save space
{
wordnode_T *next; // next node with same hash key wordnode_T *next; // next node with same hash key
wordnode_T *wnode; // parent node that will write this node wordnode_T *wnode; // parent node that will write this node
} wn_u2; } wn_u2;

View File

@ -168,10 +168,11 @@ newwindow:
break; break;
} }
} }
if (wp == NULL) if (wp == NULL) {
EMSG(_("E441: There is no preview window")); EMSG(_("E441: There is no preview window"));
else } else {
win_goto(wp); win_goto(wp);
}
break; break;
/* close all but current window */ /* close all but current window */
@ -3366,10 +3367,10 @@ void tabpage_move(int nr)
tp_dst = tp; tp_dst = tp;
/* Remove the current tab page from the list of tab pages. */ // Remove the current tab page from the list of tab pages.
if (curtab == first_tabpage) if (curtab == first_tabpage) {
first_tabpage = curtab->tp_next; first_tabpage = curtab->tp_next;
else { } else {
tp = NULL; tp = NULL;
FOR_ALL_TABS(tp2) { FOR_ALL_TABS(tp2) {
if (tp2->tp_next == curtab) { if (tp2->tp_next == curtab) {
@ -3377,8 +3378,9 @@ void tabpage_move(int nr)
break; break;
} }
} }
if (tp == NULL) /* "cannot happen" */ if (tp == NULL) { // "cannot happen"
return; return;
}
tp->tp_next = curtab->tp_next; tp->tp_next = curtab->tp_next;
} }