mirror of
https://github.com/neovim/neovim.git
synced 2024-12-31 17:13:26 -07:00
vim-patch:8.0.1109: timer causes error on exit from Ex mode
Problem: Timer causes error on exit from Ex mode. (xtal8)
Solution: save and restore the ex_pressedreturn flag. (Christian Brabandt,
closes vim/vim#2079)
f5291f301e
This commit is contained in:
parent
42a0513095
commit
b853b6e4ea
@ -18437,6 +18437,7 @@ static void timer_due_cb(TimeWatcher *tw, void *data)
|
|||||||
timer_T *timer = (timer_T *)data;
|
timer_T *timer = (timer_T *)data;
|
||||||
int save_did_emsg = did_emsg;
|
int save_did_emsg = did_emsg;
|
||||||
int save_called_emsg = called_emsg;
|
int save_called_emsg = called_emsg;
|
||||||
|
const bool save_ex_pressedreturn = get_pressedreturn();
|
||||||
|
|
||||||
if (timer->stopped || timer->paused) {
|
if (timer->stopped || timer->paused) {
|
||||||
return;
|
return;
|
||||||
@ -18465,6 +18466,7 @@ static void timer_due_cb(TimeWatcher *tw, void *data)
|
|||||||
}
|
}
|
||||||
did_emsg = save_did_emsg;
|
did_emsg = save_did_emsg;
|
||||||
called_emsg = save_called_emsg;
|
called_emsg = save_called_emsg;
|
||||||
|
set_pressedreturn(save_ex_pressedreturn);
|
||||||
|
|
||||||
if (timer->emsg_count >= 3) {
|
if (timer->emsg_count >= 3) {
|
||||||
timer_stop(timer);
|
timer_stop(timer);
|
||||||
|
@ -77,7 +77,7 @@
|
|||||||
#include "nvim/api/private/helpers.h"
|
#include "nvim/api/private/helpers.h"
|
||||||
|
|
||||||
static int quitmore = 0;
|
static int quitmore = 0;
|
||||||
static int ex_pressedreturn = FALSE;
|
static bool ex_pressedreturn = false;
|
||||||
|
|
||||||
/// Whether ":lcd" or ":tcd" was produced for a session.
|
/// Whether ":lcd" or ":tcd" was produced for a session.
|
||||||
static int did_lcd;
|
static int did_lcd;
|
||||||
@ -1278,14 +1278,14 @@ static char_u * do_one_cmd(char_u **cmdlinep,
|
|||||||
|| getline_equal(fgetline, cookie, getexline))
|
|| getline_equal(fgetline, cookie, getexline))
|
||||||
&& curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count) {
|
&& curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count) {
|
||||||
ea.cmd = (char_u *)"+";
|
ea.cmd = (char_u *)"+";
|
||||||
ex_pressedreturn = TRUE;
|
ex_pressedreturn = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ignore comment and empty lines */
|
/* ignore comment and empty lines */
|
||||||
if (*ea.cmd == '"')
|
if (*ea.cmd == '"')
|
||||||
goto doend;
|
goto doend;
|
||||||
if (*ea.cmd == NUL) {
|
if (*ea.cmd == NUL) {
|
||||||
ex_pressedreturn = TRUE;
|
ex_pressedreturn = true;
|
||||||
goto doend;
|
goto doend;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10131,6 +10131,17 @@ static void ex_folddo(exarg_T *eap)
|
|||||||
ml_clearmarked(); // clear rest of the marks
|
ml_clearmarked(); // clear rest of the marks
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool get_pressedreturn(void)
|
||||||
|
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
|
||||||
|
{
|
||||||
|
return ex_pressedreturn;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_pressedreturn(bool val)
|
||||||
|
{
|
||||||
|
ex_pressedreturn = val;
|
||||||
|
}
|
||||||
|
|
||||||
static void ex_terminal(exarg_T *eap)
|
static void ex_terminal(exarg_T *eap)
|
||||||
{
|
{
|
||||||
char ex_cmd[1024];
|
char ex_cmd[1024];
|
||||||
|
@ -252,4 +252,15 @@ func Test_peek_and_get_char()
|
|||||||
call timer_stop(intr)
|
call timer_stop(intr)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_ex_mode()
|
||||||
|
" Function with an empty line.
|
||||||
|
func Foo(...)
|
||||||
|
|
||||||
|
endfunc
|
||||||
|
let timer = timer_start(40, function('g:Foo'), {'repeat':-1})
|
||||||
|
" This used to throw error E749.
|
||||||
|
exe "normal Qsleep 100m\rvi\r"
|
||||||
|
call timer_stop(timer)
|
||||||
|
endfunc
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
Loading…
Reference in New Issue
Block a user