mirror of
https://github.com/neovim/neovim.git
synced 2025-09-17 08:48:16 +00:00
vim-patch:8.0.0096: has('ttyin'), has('ttyout')
Nvim note: intentionally did not include `--ttyfail` since its purpose
is not clear. (And it isn't used in any Vim test files/scripts).
---
Problem: When the input or output is not a tty Vim appears to hang.
Solution: Add the --ttyfail argument. Also add the "ttyin" and "ttyout"
features to be able to check in Vim script.
2cab0e1910
This commit is contained in:
@@ -8317,6 +8317,8 @@ termresponse Compiled with support for |t_RV| and |v:termresponse|.
|
|||||||
textobjects Compiled with support for |text-objects|.
|
textobjects Compiled with support for |text-objects|.
|
||||||
timers Compiled with |timer_start()| support.
|
timers Compiled with |timer_start()| support.
|
||||||
title Compiled with window title support |'title'|.
|
title Compiled with window title support |'title'|.
|
||||||
|
ttyin input is a terminal (tty)
|
||||||
|
ttyout output is a terminal (tty)
|
||||||
unix Unix version of Vim.
|
unix Unix version of Vim.
|
||||||
unnamedplus Compiled with support for "unnamedplus" in 'clipboard'
|
unnamedplus Compiled with support for "unnamedplus" in 'clipboard'
|
||||||
user_commands User-defined commands.
|
user_commands User-defined commands.
|
||||||
|
@@ -10672,6 +10672,10 @@ static void f_has(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
|||||||
n = has_nvim_version(name + 5);
|
n = has_nvim_version(name + 5);
|
||||||
} else if (STRICMP(name, "vim_starting") == 0) {
|
} else if (STRICMP(name, "vim_starting") == 0) {
|
||||||
n = (starting != 0);
|
n = (starting != 0);
|
||||||
|
} else if (STRICMP(name, "ttyin") == 0) {
|
||||||
|
n = stdin_isatty;
|
||||||
|
} else if (STRICMP(name, "ttyout") == 0) {
|
||||||
|
n = stdout_isatty;
|
||||||
} else if (STRICMP(name, "multi_byte_encoding") == 0) {
|
} else if (STRICMP(name, "multi_byte_encoding") == 0) {
|
||||||
n = has_mbyte != 0;
|
n = has_mbyte != 0;
|
||||||
#if defined(USE_ICONV) && defined(DYNAMIC_ICONV)
|
#if defined(USE_ICONV) && defined(DYNAMIC_ICONV)
|
||||||
|
@@ -564,21 +564,22 @@ EXTERN int ru_col; /* column for ruler */
|
|||||||
EXTERN int ru_wid; /* 'rulerfmt' width of ruler when non-zero */
|
EXTERN int ru_wid; /* 'rulerfmt' width of ruler when non-zero */
|
||||||
EXTERN int sc_col; /* column for shown command */
|
EXTERN int sc_col; /* column for shown command */
|
||||||
|
|
||||||
/*
|
//
|
||||||
* When starting or exiting some things are done differently (e.g. screen
|
// When starting or exiting some things are done differently (e.g. screen
|
||||||
* updating).
|
// updating).
|
||||||
*/
|
//
|
||||||
|
|
||||||
|
// First NO_SCREEN, then NO_BUFFERS, then 0 when startup finished.
|
||||||
EXTERN int starting INIT(= NO_SCREEN);
|
EXTERN int starting INIT(= NO_SCREEN);
|
||||||
/* first NO_SCREEN, then NO_BUFFERS and then
|
// true when planning to exit. Might keep running if there is a changed buffer.
|
||||||
* set to 0 when starting up finished */
|
EXTERN int exiting INIT(= false);
|
||||||
EXTERN int exiting INIT(= FALSE);
|
// is stdin a terminal?
|
||||||
/* TRUE when planning to exit Vim. Might
|
EXTERN int stdin_isatty INIT(= true);
|
||||||
* still keep on running if there is a changed
|
// is stdout a terminal?
|
||||||
* buffer. */
|
EXTERN int stdout_isatty INIT(= true);
|
||||||
// volatile because it is used in signal handler deathtrap().
|
// true when doing full-screen output, otherwise only writing some messages.
|
||||||
|
// volatile because it is used in a signal handler.
|
||||||
EXTERN volatile int full_screen INIT(= false);
|
EXTERN volatile int full_screen INIT(= false);
|
||||||
// TRUE when doing full-screen output
|
|
||||||
// otherwise only writing some messages
|
|
||||||
|
|
||||||
EXTERN int restricted INIT(= FALSE);
|
EXTERN int restricted INIT(= FALSE);
|
||||||
// TRUE when started in restricted mode (-Z)
|
// TRUE when started in restricted mode (-Z)
|
||||||
|
@@ -1240,8 +1240,10 @@ static void init_startuptime(mparm_T *paramp)
|
|||||||
|
|
||||||
static void check_and_set_isatty(mparm_T *paramp)
|
static void check_and_set_isatty(mparm_T *paramp)
|
||||||
{
|
{
|
||||||
paramp->input_isatty = os_isatty(fileno(stdin));
|
stdin_isatty
|
||||||
paramp->output_isatty = os_isatty(fileno(stdout));
|
= paramp->input_isatty = os_isatty(fileno(stdin));
|
||||||
|
stdout_isatty
|
||||||
|
= paramp->output_isatty = os_isatty(fileno(stdout));
|
||||||
paramp->err_isatty = os_isatty(fileno(stderr));
|
paramp->err_isatty = os_isatty(fileno(stderr));
|
||||||
TIME_MSG("window checked");
|
TIME_MSG("window checked");
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user