/*
* Set 'keywordprg' to ":help" if an empty
* value was passed to :set by the user.
- * Misuse errbuf[] for the resulting string.
*/
if (varp == (char_u *)&p_kp && (*arg == NUL || *arg == ' '))
{
- STRCPY(errbuf, ":help");
save_arg = arg;
- arg = (char_u *)errbuf;
+ arg = (char_u *)":help";
}
/*
* Convert 'backspace' number to string, for
* but do remove it for "\\\\machine\\path".
* The reverse is found in ExpandOldSetting().
*/
- while (*arg && !VIM_ISWHITE(*arg))
+ while (*arg != NUL && !VIM_ISWHITE(*arg))
{
int i;
&& vim_isfilec(arg[1])
&& !VIM_ISWHITE(arg[1])
&& (arg[1] != '\\'
- || (s == newval && arg[2] != '\\')))
+ || (s == newval && arg[2] != '\\')))
#endif
)
++arg; // remove backslash
}
}
- if (save_arg != NULL) // number for 'whichwrap'
- arg = save_arg;
+ if (save_arg != NULL)
+ arg = save_arg; // arg was temporarily changed, restore it
}
/*
only!
endfunc
+" :set empty string for global 'keywordprg' falls back to ":help"
+func Test_keywordprg_empty()
+ let k = &keywordprg
+ set keywordprg=man
+ call assert_equal('man', &keywordprg)
+ set keywordprg=
+ call assert_equal(':help', &keywordprg)
+ set keywordprg=man
+ call assert_equal('man', &keywordprg)
+ call assert_equal("\n keywordprg=:help", execute('set kp= kp?'))
+ let &keywordprg = k
+endfunc
+
+
" vim: shiftwidth=2 sts=2 expandtab