From 9acd7bfe25b5ea2b31ffbbdbd201f5f09afc4237 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 10 Jul 2017 01:58:54 +0200 Subject: tui: job-control: use saved termios for pty jobs On startup, if running in a terminal, save the termios properties. Use the saved termios for `:terminal` and `jobstart()` pty jobs. This won't affect nvim spawned outside of a terminal. questions: - This affects `:terminal` and `jobstart({'pty':v:true})`. Should we be more conservative for `jobstart({'pty':v:true})` (e.g. pass NULL to forkpty() and let the OS defaults prevail)? - Note: `iutf8` would not be set in that case. --- src/nvim/main.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/nvim/main.c') diff --git a/src/nvim/main.c b/src/nvim/main.c index aa57913f7c..0346414697 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -73,6 +73,9 @@ #include "nvim/api/private/helpers.h" #include "nvim/api/private/handle.h" #include "nvim/api/private/dispatch.h" +#ifndef WIN32 +# include "nvim/os/pty_process_unix.h" +#endif /* Maximum number of commands from + or -c arguments. */ #define MAX_ARG_CMDS 10 @@ -1247,6 +1250,14 @@ static void check_and_set_isatty(mparm_T *paramp) stdout_isatty = paramp->output_isatty = os_isatty(fileno(stdout)); paramp->err_isatty = os_isatty(fileno(stderr)); + int tty_fd = paramp->input_isatty + ? OS_STDIN_FILENO + : (paramp->output_isatty + ? OS_STDOUT_FILENO + : (paramp->err_isatty ? OS_STDERR_FILENO : -1)); +#ifndef WIN32 + pty_process_save_termios(tty_fd); +#endif TIME_MSG("window checked"); } -- cgit