comparison src/terminal.c @ 13678:39fcaaa973db v8.0.1711

patch 8.0.1711: term_setsize() is not implemented yet commit https://github.com/vim/vim/commit/a42d363bac8a581afe769c370db70cf833767c41 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Apr 14 17:05:38 2018 +0200 patch 8.0.1711: term_setsize() is not implemented yet Problem: Term_setsize() is not implemented yet. Solution: Implement it.
author Christian Brabandt <cb@256bit.org>
date Sat, 14 Apr 2018 17:15:05 +0200
parents 6a84e3d2b810
children c32e9628dc30
comparison
equal deleted inserted replaced
13677:4efb4683ea71 13678:39fcaaa973db
38 * in tl_scrollback are no longer used. 38 * in tl_scrollback are no longer used.
39 * 39 *
40 * TODO: 40 * TODO:
41 * - Win32: Make terminal used for :!cmd in the GUI work better. Allow for 41 * - Win32: Make terminal used for :!cmd in the GUI work better. Allow for
42 * redirection. Probably in call to channel_set_pipes(). 42 * redirection. Probably in call to channel_set_pipes().
43 * - implement term_setsize()
44 * - add an optional limit for the scrollback size. When reaching it remove 43 * - add an optional limit for the scrollback size. When reaching it remove
45 * 10% at the start. 44 * 10% at the start.
46 * - Copy text in the vterm to the Vim buffer once in a while, so that 45 * - Copy text in the vterm to the Vim buffer once in a while, so that
47 * completion works. 46 * completion works.
48 * - in GUI vertical split causes problems. Cursor is flickering. (Hirohito 47 * - in GUI vertical split causes problems. Cursor is flickering. (Hirohito
4601 list_append_number(l, buf->b_term->tl_rows); 4600 list_append_number(l, buf->b_term->tl_rows);
4602 list_append_number(l, buf->b_term->tl_cols); 4601 list_append_number(l, buf->b_term->tl_cols);
4603 } 4602 }
4604 4603
4605 /* 4604 /*
4605 * "term_setsize(buf, rows, cols)" function
4606 */
4607 void
4608 f_term_setsize(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
4609 {
4610 buf_T *buf = term_get_buf(argvars, "term_setsize()");
4611 term_T *term;
4612 varnumber_T rows, cols;
4613
4614 if (buf == NULL || buf->b_term->tl_vterm == NULL)
4615 return;
4616 term = buf->b_term;
4617 rows = get_tv_number(&argvars[1]);
4618 rows = rows <= 0 ? term->tl_rows : rows;
4619 cols = get_tv_number(&argvars[2]);
4620 cols = cols <= 0 ? term->tl_cols : cols;
4621 vterm_set_size(term->tl_vterm, rows, cols);
4622 /* handle_resize() will resize the windows */
4623
4624 /* Get and remember the size we ended up with. Update the pty. */
4625 vterm_get_size(term->tl_vterm, &term->tl_rows, &term->tl_cols);
4626 term_report_winsize(term, term->tl_rows, term->tl_cols);
4627 }
4628
4629 /*
4606 * "term_getstatus(buf)" function 4630 * "term_getstatus(buf)" function
4607 */ 4631 */
4608 void 4632 void
4609 f_term_getstatus(typval_T *argvars, typval_T *rettv) 4633 f_term_getstatus(typval_T *argvars, typval_T *rettv)
4610 { 4634 {
5430 vterm_free(term->tl_vterm); 5454 vterm_free(term->tl_vterm);
5431 term->tl_vterm = NULL; 5455 term->tl_vterm = NULL;
5432 } 5456 }
5433 5457
5434 /* 5458 /*
5435 * Request size to terminal. 5459 * Report the size to the terminal.
5436 */ 5460 */
5437 static void 5461 static void
5438 term_report_winsize(term_T *term, int rows, int cols) 5462 term_report_winsize(term_T *term, int rows, int cols)
5439 { 5463 {
5440 if (term->tl_winpty) 5464 if (term->tl_winpty)
5512 vterm_free(term->tl_vterm); 5536 vterm_free(term->tl_vterm);
5513 term->tl_vterm = NULL; 5537 term->tl_vterm = NULL;
5514 } 5538 }
5515 5539
5516 /* 5540 /*
5517 * Request size to terminal. 5541 * Report the size to the terminal.
5518 */ 5542 */
5519 static void 5543 static void
5520 term_report_winsize(term_T *term, int rows, int cols) 5544 term_report_winsize(term_T *term, int rows, int cols)
5521 { 5545 {
5522 /* Use an ioctl() to report the new window size to the job. */ 5546 /* Use an ioctl() to report the new window size to the job. */