mirror of
https://github.com/neovim/neovim.git
synced 2024-12-29 14:41:06 -07:00
vim-patch:8.2.3716: Vim9: range without a command is not compiled
Problem: Vim9: range without a command is not compiled.
Solution: Add the ISN_EXECRANGE byte code.
e4eed8c6db
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
parent
3700d94c6f
commit
88c698083a
@ -2079,29 +2079,7 @@ static char *do_one_cmd(char **cmdlinep, int flags, cstack_T *cstack, LineGetter
|
||||
if (ea.skip) { // skip this if inside :if
|
||||
goto doend;
|
||||
}
|
||||
if (*ea.cmd == '|' || (exmode_active && ea.line1 != ea.line2)) {
|
||||
ea.cmdidx = CMD_print;
|
||||
ea.argt = EX_RANGE | EX_COUNT | EX_TRLBAR;
|
||||
if ((errormsg = invalid_range(&ea)) == NULL) {
|
||||
correct_range(&ea);
|
||||
ex_print(&ea);
|
||||
}
|
||||
} else if (ea.addr_count != 0) {
|
||||
if (ea.line2 > curbuf->b_ml.ml_line_count) {
|
||||
ea.line2 = curbuf->b_ml.ml_line_count;
|
||||
}
|
||||
|
||||
if (ea.line2 < 0) {
|
||||
errormsg = _(e_invrange);
|
||||
} else {
|
||||
if (ea.line2 == 0) {
|
||||
curwin->w_cursor.lnum = 1;
|
||||
} else {
|
||||
curwin->w_cursor.lnum = ea.line2;
|
||||
}
|
||||
beginline(BL_SOL | BL_FIX);
|
||||
}
|
||||
}
|
||||
errormsg = ex_range_without_command(&ea);
|
||||
goto doend;
|
||||
}
|
||||
|
||||
@ -2447,6 +2425,38 @@ char *ex_errmsg(const char *const msg, const char *const arg)
|
||||
return ex_error_buf;
|
||||
}
|
||||
|
||||
/// Handle a range without a command.
|
||||
/// Returns an error message on failure.
|
||||
static char *ex_range_without_command(exarg_T *eap)
|
||||
{
|
||||
char *errormsg = NULL;
|
||||
|
||||
if (*eap->cmd == '|' || (exmode_active && eap->line1 != eap->line2)) {
|
||||
eap->cmdidx = CMD_print;
|
||||
eap->argt = EX_RANGE | EX_COUNT | EX_TRLBAR;
|
||||
if ((errormsg = invalid_range(eap)) == NULL) {
|
||||
correct_range(eap);
|
||||
ex_print(eap);
|
||||
}
|
||||
} else if (eap->addr_count != 0) {
|
||||
if (eap->line2 > curbuf->b_ml.ml_line_count) {
|
||||
eap->line2 = curbuf->b_ml.ml_line_count;
|
||||
}
|
||||
|
||||
if (eap->line2 < 0) {
|
||||
errormsg = _(e_invrange);
|
||||
} else {
|
||||
if (eap->line2 == 0) {
|
||||
curwin->w_cursor.lnum = 1;
|
||||
} else {
|
||||
curwin->w_cursor.lnum = eap->line2;
|
||||
}
|
||||
beginline(BL_SOL | BL_FIX);
|
||||
}
|
||||
}
|
||||
return errormsg;
|
||||
}
|
||||
|
||||
/// Parse and skip over command modifiers:
|
||||
/// - update eap->cmd
|
||||
/// - store flags in "cmod".
|
||||
|
Loading…
Reference in New Issue
Block a user