diff options
Diffstat (limited to 'src/os_unix.c')
-rw-r--r-- | src/os_unix.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/os_unix.c b/src/os_unix.c index 4caf38bb40..f2ab7b15e2 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -3918,6 +3918,44 @@ mch_get_shellsize(void) return OK; } +#if defined(FEAT_TERMINAL) || defined(PROTO) +/* + * Report the windows size "rows" and "cols" to tty "fd". + */ + int +mch_report_winsize(int fd, int rows, int cols) +{ +# ifdef TIOCSWINSZ + struct winsize ws; + + ws.ws_col = cols; + ws.ws_row = rows; + ws.ws_xpixel = cols * 5; + ws.ws_ypixel = rows * 10; + if (ioctl(fd, TIOCSWINSZ, &ws) == 0) + { + ch_log(NULL, "ioctl(TIOCSWINSZ) success"); + return OK; + } + ch_log(NULL, "ioctl(TIOCSWINSZ) failed"); +# else +# ifdef TIOCSSIZE + struct ttysize ts; + + ts.ts_cols = cols; + ts.ts_lines = rows; + if (ioctl(fd, TIOCSSIZE, &ws) == 0) + { + ch_log(NULL, "ioctl(TIOCSSIZE) success"); + return OK; + } + ch_log(NULL, "ioctl(TIOCSSIZE) failed"); +# endif +# endif + return FAIL; +} +#endif + /* * Try to set the window size to Rows and Columns. */ @@ -5473,6 +5511,10 @@ mch_stop_job(job_T *job, char_u *how) sig = SIGINT; else if (STRCMP(how, "kill") == 0) sig = SIGKILL; +#ifdef SIGWINCH + else if (STRCMP(how, "winch") == 0) + sig = SIGWINCH; +#endif else if (isdigit(*how)) sig = atoi((char *)how); else |