Patch 8.0.1711
Problem:    Term_setsize() is not implemented yet.
Solution:   Implement it.
Files:      src/evalfunc.c, src/terminal.c, src/proto/terminal.pro,
            src/testdir/test_terminal.vim, runtime/doc/eval.txt


*** ../vim-8.0.1710/src/evalfunc.c      2018-04-14 13:51:51.978588368 +0200
--- src/evalfunc.c      2018-04-14 16:40:16.517362325 +0200
***************
*** 876,881 ****
--- 876,882 ----
  # endif
      {"term_setkill",  2, 2, f_term_setkill},
      {"term_setrestore",       2, 2, f_term_setrestore},
+     {"term_setsize",  3, 3, f_term_setsize},
      {"term_start",    1, 2, f_term_start},
      {"term_wait",     1, 2, f_term_wait},
  #endif
*** ../vim-8.0.1710/src/terminal.c      2018-04-13 22:11:52.740902329 +0200
--- src/terminal.c      2018-04-14 16:58:54.542065201 +0200
***************
*** 40,46 ****
   * TODO:
   * - Win32: Make terminal used for :!cmd in the GUI work better.  Allow for
   *   redirection.  Probably in call to channel_set_pipes().
-  * - implement term_setsize()
   * - add an optional limit for the scrollback size.  When reaching it remove
   *   10% at the start.
   * - Copy text in the vterm to the Vim buffer once in a while, so that
--- 40,45 ----
***************
*** 4603,4608 ****
--- 4602,4632 ----
  }
  
  /*
+  * "term_setsize(buf, rows, cols)" function
+  */
+     void
+ f_term_setsize(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
+ {
+     buf_T     *buf = term_get_buf(argvars, "term_setsize()");
+     term_T    *term;
+     varnumber_T rows, cols;
+ 
+     if (buf == NULL || buf->b_term->tl_vterm == NULL)
+       return;
+     term = buf->b_term;
+     rows = get_tv_number(&argvars[1]);
+     rows = rows <= 0 ? term->tl_rows : rows;
+     cols = get_tv_number(&argvars[2]);
+     cols = cols <= 0 ? term->tl_cols : cols;
+     vterm_set_size(term->tl_vterm, rows, cols);
+     /* handle_resize() will resize the windows */
+ 
+     /* Get and remember the size we ended up with.  Update the pty. */
+     vterm_get_size(term->tl_vterm, &term->tl_rows, &term->tl_cols);
+     term_report_winsize(term, term->tl_rows, term->tl_cols);
+ }
+ 
+ /*
   * "term_getstatus(buf)" function
   */
      void
***************
*** 5432,5438 ****
  }
  
  /*
!  * Request size to terminal.
   */
      static void
  term_report_winsize(term_T *term, int rows, int cols)
--- 5456,5462 ----
  }
  
  /*
!  * Report the size to the terminal.
   */
      static void
  term_report_winsize(term_T *term, int rows, int cols)
***************
*** 5514,5520 ****
  }
  
  /*
!  * Request size to terminal.
   */
      static void
  term_report_winsize(term_T *term, int rows, int cols)
--- 5538,5544 ----
  }
  
  /*
!  * Report the size to the terminal.
   */
      static void
  term_report_winsize(term_T *term, int rows, int cols)
*** ../vim-8.0.1710/src/proto/terminal.pro      2018-04-10 15:59:04.295392601 
+0200
--- src/proto/terminal.pro      2018-04-14 16:38:13.742270972 +0200
***************
*** 32,50 ****
  void f_term_dumpdiff(typval_T *argvars, typval_T *rettv);
  void f_term_dumpload(typval_T *argvars, typval_T *rettv);
  void f_term_getaltscreen(typval_T *argvars, typval_T *rettv);
- void f_term_getansicolors(typval_T *argvars, typval_T *rettv);
  void f_term_getattr(typval_T *argvars, typval_T *rettv);
  void f_term_getcursor(typval_T *argvars, typval_T *rettv);
  void f_term_getjob(typval_T *argvars, typval_T *rettv);
  void f_term_getline(typval_T *argvars, typval_T *rettv);
  void f_term_getscrolled(typval_T *argvars, typval_T *rettv);
  void f_term_getsize(typval_T *argvars, typval_T *rettv);
  void f_term_getstatus(typval_T *argvars, typval_T *rettv);
  void f_term_gettitle(typval_T *argvars, typval_T *rettv);
  void f_term_gettty(typval_T *argvars, typval_T *rettv);
  void f_term_list(typval_T *argvars, typval_T *rettv);
  void f_term_scrape(typval_T *argvars, typval_T *rettv);
  void f_term_sendkeys(typval_T *argvars, typval_T *rettv);
  void f_term_setansicolors(typval_T *argvars, typval_T *rettv);
  void f_term_setrestore(typval_T *argvars, typval_T *rettv);
  void f_term_setkill(typval_T *argvars, typval_T *rettv);
--- 32,51 ----
  void f_term_dumpdiff(typval_T *argvars, typval_T *rettv);
  void f_term_dumpload(typval_T *argvars, typval_T *rettv);
  void f_term_getaltscreen(typval_T *argvars, typval_T *rettv);
  void f_term_getattr(typval_T *argvars, typval_T *rettv);
  void f_term_getcursor(typval_T *argvars, typval_T *rettv);
  void f_term_getjob(typval_T *argvars, typval_T *rettv);
  void f_term_getline(typval_T *argvars, typval_T *rettv);
  void f_term_getscrolled(typval_T *argvars, typval_T *rettv);
  void f_term_getsize(typval_T *argvars, typval_T *rettv);
+ void f_term_setsize(typval_T *argvars, typval_T *rettv);
  void f_term_getstatus(typval_T *argvars, typval_T *rettv);
  void f_term_gettitle(typval_T *argvars, typval_T *rettv);
  void f_term_gettty(typval_T *argvars, typval_T *rettv);
  void f_term_list(typval_T *argvars, typval_T *rettv);
  void f_term_scrape(typval_T *argvars, typval_T *rettv);
  void f_term_sendkeys(typval_T *argvars, typval_T *rettv);
+ void f_term_getansicolors(typval_T *argvars, typval_T *rettv);
  void f_term_setansicolors(typval_T *argvars, typval_T *rettv);
  void f_term_setrestore(typval_T *argvars, typval_T *rettv);
  void f_term_setkill(typval_T *argvars, typval_T *rettv);
*** ../vim-8.0.1710/src/testdir/test_terminal.vim       2018-04-11 
20:53:45.765218228 +0200
--- src/testdir/test_terminal.vim       2018-04-14 17:01:36.333075797 +0200
***************
*** 286,294 ****
  
    vsplit
    exe 'terminal ++rows=5 ++cols=33 ' . cmd
!   let size = term_getsize('')
    bwipe!
-   call assert_equal([5, 33], size)
  
    call term_start(cmd, {'term_rows': 6, 'term_cols': 36})
    let size = term_getsize('')
--- 286,303 ----
  
    vsplit
    exe 'terminal ++rows=5 ++cols=33 ' . cmd
!   call assert_equal([5, 33], term_getsize(''))
! 
!   call term_setsize('', 6, 0)
!   call assert_equal([6, 33], term_getsize(''))
! 
!   call term_setsize('', 0, 35)
!   call assert_equal([6, 35], term_getsize(''))
! 
!   call term_setsize('', 7, 30)
!   call assert_equal([7, 30], term_getsize(''))
! 
    bwipe!
  
    call term_start(cmd, {'term_rows': 6, 'term_cols': 36})
    let size = term_getsize('')
*** ../vim-8.0.1710/runtime/doc/eval.txt        2018-04-14 13:51:51.982588340 
+0200
--- runtime/doc/eval.txt        2018-04-14 16:38:01.174364087 +0200
***************
*** 8344,8349 ****
--- 8402,8425 ----
                color codes, like those accepted by |highlight-guifg|.
                Also see |term_getansicolors()| and |g:terminal_ansi_colors|.
  
+               The colors normally are:
+                       0    black
+                       1    dark red
+                       2    dark green
+                       3    brown
+                       4    dark blue
+                       5    dark magenta
+                       6    dark cyan
+                       7    light grey
+                       8    dark grey
+                       9    red
+                       10   green
+                       11   yellow
+                       12   blue
+                       13   magenta
+                       14   cyan
+                       15   white
+ 
                These colors are used in the GUI and in the terminal when
                'termguicolors' is set.  When not using GUI colors (GUI mode
                or |termguicolors|), the terminal window always uses the 16
***************
*** 8373,8380 ****
                Use "NONE" to not restore this window.
                {only available when compiled with the |+terminal| feature}
  
! term_setsize({buf}, {expr})                           *term_setsize()*
!               Not implemented yet.
                {only available when compiled with the |+terminal| feature}
  
  term_start({cmd}, {options})                          *term_start()*
--- 8449,8463 ----
                Use "NONE" to not restore this window.
                {only available when compiled with the |+terminal| feature}
  
! term_setsize({buf}, {rows}, {cols})                   *term_setsize()*
!               Set the size of terminal {buf}. The size of the window
!               containing the terminal will also be adjusted, if possible.
!               If {rows} or {cols} is zero or negative, that dimension is not
!               changed.
! 
!               {buf} must be the buffer number of a terminal window.  Use an
!               empty string for the current buffer.  If the buffer does not
!               exist or is not a terminal window, an error is given.
                {only available when compiled with the |+terminal| feature}
  
  term_start({cmd}, {options})                          *term_start()*
*** ../vim-8.0.1710/src/version.c       2018-04-14 16:12:26.217960118 +0200
--- src/version.c       2018-04-14 17:03:45.756255192 +0200
***************
*** 764,765 ****
--- 764,767 ----
  {   /* Add new patch number below this line */
+ /**/
+     1711,
  /**/

-- 
If Microsoft would build a car...
... Occasionally your car would die on the freeway for no
reason. You would have to pull over to the side of the road,
close all of the car windows, shut it off, restart it, and
reopen the windows before you could continue. For some reason
you would simply accept this.

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui