mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 8.2.0774: t_TI and t_TE are output when using 'visualbell'
Problem: t_TI and t_TE are output when using 'visualbell'. (Dominique Pelle) Solution: Do not change the terminal mode for a short sleep. Do not output t_TI and t_TE when switching to/from TMODE_SLEEP. Make tmode an enum.
This commit is contained in:
@@ -215,7 +215,8 @@ static volatile sig_atomic_t in_mch_delay = FALSE; // sleeping in mch_delay()
|
||||
static int dont_check_job_ended = 0;
|
||||
#endif
|
||||
|
||||
static int curr_tmode = TMODE_COOK; // contains current terminal mode
|
||||
// Current terminal mode from mch_settmode(). Can differ from cur_tmode.
|
||||
static tmode_T mch_cur_tmode = TMODE_COOK;
|
||||
|
||||
#ifdef USE_XSMP
|
||||
typedef struct
|
||||
@@ -581,7 +582,7 @@ mch_total_mem(int special UNUSED)
|
||||
void
|
||||
mch_delay(long msec, int ignoreinput)
|
||||
{
|
||||
int old_tmode;
|
||||
tmode_T old_tmode;
|
||||
#ifdef FEAT_MZSCHEME
|
||||
long total = msec; // remember original value
|
||||
#endif
|
||||
@@ -591,9 +592,10 @@ mch_delay(long msec, int ignoreinput)
|
||||
// Go to cooked mode without echo, to allow SIGINT interrupting us
|
||||
// here. But we don't want QUIT to kill us (CTRL-\ used in a
|
||||
// shell may produce SIGQUIT).
|
||||
// Only do this if sleeping for more than half a second.
|
||||
in_mch_delay = TRUE;
|
||||
old_tmode = curr_tmode;
|
||||
if (curr_tmode == TMODE_RAW)
|
||||
old_tmode = mch_cur_tmode;
|
||||
if (mch_cur_tmode == TMODE_RAW && msec > 500)
|
||||
settmode(TMODE_SLEEP);
|
||||
|
||||
/*
|
||||
@@ -650,7 +652,8 @@ mch_delay(long msec, int ignoreinput)
|
||||
while (total > 0);
|
||||
#endif
|
||||
|
||||
settmode(old_tmode);
|
||||
if (msec > 500)
|
||||
settmode(old_tmode);
|
||||
in_mch_delay = FALSE;
|
||||
}
|
||||
else
|
||||
@@ -3461,7 +3464,7 @@ mch_tcgetattr(int fd, void *term)
|
||||
}
|
||||
|
||||
void
|
||||
mch_settmode(int tmode)
|
||||
mch_settmode(tmode_T tmode)
|
||||
{
|
||||
static int first = TRUE;
|
||||
|
||||
@@ -3558,7 +3561,7 @@ mch_settmode(int tmode)
|
||||
ttybnew.sg_flags &= ~(ECHO);
|
||||
ioctl(read_cmd_fd, TIOCSETN, &ttybnew);
|
||||
#endif
|
||||
curr_tmode = tmode;
|
||||
mch_cur_tmode = tmode;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -4455,7 +4458,7 @@ mch_call_shell_system(
|
||||
char *ifn = NULL;
|
||||
char *ofn = NULL;
|
||||
#endif
|
||||
int tmode = cur_tmode;
|
||||
tmode_T tmode = cur_tmode;
|
||||
char_u *newcmd; // only needed for unix
|
||||
int x;
|
||||
|
||||
@@ -4549,7 +4552,7 @@ mch_call_shell_fork(
|
||||
char_u *cmd,
|
||||
int options) // SHELL_*, see vim.h
|
||||
{
|
||||
int tmode = cur_tmode;
|
||||
tmode_T tmode = cur_tmode;
|
||||
pid_t pid;
|
||||
pid_t wpid = 0;
|
||||
pid_t wait_pid = 0;
|
||||
@@ -5939,7 +5942,7 @@ mch_create_pty_channel(job_T *job, jobopt_T *options)
|
||||
void
|
||||
mch_breakcheck(int force)
|
||||
{
|
||||
if ((curr_tmode == TMODE_RAW || force)
|
||||
if ((mch_cur_tmode == TMODE_RAW || force)
|
||||
&& RealWaitForChar(read_cmd_fd, 0L, NULL, NULL))
|
||||
fill_input_buf(FALSE);
|
||||
}
|
||||
|
Reference in New Issue
Block a user