mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge pull request #21706 from bfredl/notermios
refactor(pty): remove old logic for inheriting termios from host terminal
This commit is contained in:
commit
80a02d1cef
@ -279,15 +279,6 @@ int main(int argc, char **argv)
|
|||||||
// argument list "global_alist".
|
// argument list "global_alist".
|
||||||
command_line_scan(¶ms);
|
command_line_scan(¶ms);
|
||||||
|
|
||||||
#ifndef MSWIN
|
|
||||||
int tty_fd = params.input_isatty
|
|
||||||
? STDIN_FILENO
|
|
||||||
: (params.output_isatty
|
|
||||||
? STDOUT_FILENO
|
|
||||||
: (params.err_isatty ? STDERR_FILENO : -1));
|
|
||||||
pty_process_save_termios(tty_fd);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
nlua_init(argv, argc, params.lua_arg0);
|
nlua_init(argv, argc, params.lua_arg0);
|
||||||
TIME_MSG("init lua interpreter");
|
TIME_MSG("init lua interpreter");
|
||||||
|
|
||||||
|
@ -160,39 +160,13 @@ static pid_t forkpty(int *amaster, char *name, struct termios *termp, struct win
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// termios saved at startup (for TUI) or initialized by pty_process_spawn().
|
|
||||||
static struct termios termios_default;
|
|
||||||
|
|
||||||
/// Saves the termios properties associated with `tty_fd`.
|
|
||||||
///
|
|
||||||
/// @param tty_fd TTY file descriptor, or -1 if not in a terminal.
|
|
||||||
void pty_process_save_termios(int tty_fd)
|
|
||||||
{
|
|
||||||
if (embedded_mode) {
|
|
||||||
// TODO(bfredl): currently we cannot use the state of the host terminal in
|
|
||||||
// the server. when the TUI process launches the server, the state has already
|
|
||||||
// changed. we would need to serialize termios_default in the TUI process and
|
|
||||||
// transmit it. Altough, just always using the clean slate of init_termios() might
|
|
||||||
// be preferrable anyway.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (tty_fd == -1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
int rv = tcgetattr(tty_fd, &termios_default);
|
|
||||||
if (rv != 0) {
|
|
||||||
ELOG("tcgetattr failed (tty_fd=%d): %s", tty_fd, strerror(errno));
|
|
||||||
} else {
|
|
||||||
DLOG("tty_fd=%d", tty_fd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @returns zero on success, or negative error code
|
/// @returns zero on success, or negative error code
|
||||||
int pty_process_spawn(PtyProcess *ptyproc)
|
int pty_process_spawn(PtyProcess *ptyproc)
|
||||||
FUNC_ATTR_NONNULL_ALL
|
FUNC_ATTR_NONNULL_ALL
|
||||||
{
|
{
|
||||||
|
// termios initialized at first use
|
||||||
|
static struct termios termios_default;
|
||||||
if (!termios_default.c_cflag) {
|
if (!termios_default.c_cflag) {
|
||||||
// TODO(jkeyes): We could pass NULL to forkpty() instead ...
|
|
||||||
init_termios(&termios_default);
|
init_termios(&termios_default);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user