mirror of
https://github.com/neovim/neovim.git
synced 2025-09-22 19:18:34 +00:00
vim-patch:8.2.2871: unnessary VIM_ISDIGIT() calls, badly indented code
Problem: Unnessary VIM_ISDIGIT() calls, badly indented code.
Solution: Call skipdigits() on the next character. Improve indenting.
(Dominique Pellé, closes vim/vim#8227)
4781d6fd86
This commit is contained in:
@@ -1772,7 +1772,7 @@ static char_u * do_one_cmd(char_u **cmdlinep,
|
|||||||
// count, it's a buffer name.
|
// count, it's a buffer name.
|
||||||
///
|
///
|
||||||
if ((ea.argt & EX_COUNT) && ascii_isdigit(*ea.arg)
|
if ((ea.argt & EX_COUNT) && ascii_isdigit(*ea.arg)
|
||||||
&& (!(ea.argt & EX_BUFNAME) || *(p = skipdigits(ea.arg)) == NUL
|
&& (!(ea.argt & EX_BUFNAME) || *(p = skipdigits(ea.arg + 1)) == NUL
|
||||||
|| ascii_iswhite(*p))) {
|
|| ascii_iswhite(*p))) {
|
||||||
n = getdigits_long(&ea.arg, false, -1);
|
n = getdigits_long(&ea.arg, false, -1);
|
||||||
ea.arg = skipwhite(ea.arg);
|
ea.arg = skipwhite(ea.arg);
|
||||||
@@ -2790,15 +2790,18 @@ static struct cmdmod {
|
|||||||
*/
|
*/
|
||||||
int modifier_len(char_u *cmd)
|
int modifier_len(char_u *cmd)
|
||||||
{
|
{
|
||||||
int i, j;
|
|
||||||
char_u *p = cmd;
|
char_u *p = cmd;
|
||||||
|
|
||||||
if (ascii_isdigit(*cmd))
|
if (ascii_isdigit(*cmd)) {
|
||||||
p = skipwhite(skipdigits(cmd));
|
p = skipwhite(skipdigits(cmd + 1));
|
||||||
for (i = 0; i < (int)ARRAY_SIZE(cmdmods); ++i) {
|
}
|
||||||
for (j = 0; p[j] != NUL; ++j)
|
for (int i = 0; i < (int)ARRAY_SIZE(cmdmods); i++) {
|
||||||
if (p[j] != cmdmods[i].name[j])
|
int j;
|
||||||
|
for (j = 0; p[j] != NUL; j++) {
|
||||||
|
if (p[j] != cmdmods[i].name[j]) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (j >= cmdmods[i].minlen
|
if (j >= cmdmods[i].minlen
|
||||||
&& !ASCII_ISALPHA(p[j])
|
&& !ASCII_ISALPHA(p[j])
|
||||||
&& (p == cmd || cmdmods[i].has_count)) {
|
&& (p == cmd || cmdmods[i].has_count)) {
|
||||||
|
@@ -1942,11 +1942,13 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
|
|||||||
case OP_FORMAT:
|
case OP_FORMAT:
|
||||||
if (*curbuf->b_p_fex != NUL) {
|
if (*curbuf->b_p_fex != NUL) {
|
||||||
op_formatexpr(oap); // use expression
|
op_formatexpr(oap); // use expression
|
||||||
} else if (*p_fp != NUL || *curbuf->b_p_fp != NUL) {
|
} else {
|
||||||
|
if (*p_fp != NUL || *curbuf->b_p_fp != NUL) {
|
||||||
op_colon(oap); // use external command
|
op_colon(oap); // use external command
|
||||||
} else {
|
} else {
|
||||||
op_format(oap, false); // use internal function
|
op_format(oap, false); // use internal function
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OP_FORMAT2:
|
case OP_FORMAT2:
|
||||||
|
@@ -3010,7 +3010,7 @@ static int find_extra(char_u **pp)
|
|||||||
// Repeat for addresses separated with ';'
|
// Repeat for addresses separated with ';'
|
||||||
for (;; ) {
|
for (;; ) {
|
||||||
if (ascii_isdigit(*str)) {
|
if (ascii_isdigit(*str)) {
|
||||||
str = skipdigits(str);
|
str = skipdigits(str + 1);
|
||||||
} else if (*str == '/' || *str == '?') {
|
} else if (*str == '/' || *str == '?') {
|
||||||
str = skip_regexp(str + 1, *str, false, NULL);
|
str = skip_regexp(str + 1, *str, false, NULL);
|
||||||
if (*str != first_char) {
|
if (*str != first_char) {
|
||||||
|
Reference in New Issue
Block a user