Patch 8.0.0817
Problem: Cannot get the line of a terminal window at the cursor.
Solution: Make the row argunt optionsl. (Yasuhiro Matsumoto, closes #1898)
Files: runtime/doc/eval.txt, src/evalfunc.c, src/terminal.c
*** ../vim-8.0.0816/runtime/doc/eval.txt 2017-07-29 20:07:00.760940515
+0200
--- runtime/doc/eval.txt 2017-07-30 18:07:37.485410824 +0200
***************
*** 2371,2380 ****
tempname() String name for a temporary file
term_getattr({attr}, {what} Number get the value of attribute {what}
term_getjob({buf}) Job get the job associated with a terminal
! term_getline({buf}, {row}) String get a line of text from a terminal
term_getsize({buf}) List get the size of a terminal
term_list() List get the list of terminal buffers
! term_scrape({buf}, {row}) List get row of a terminal screen
term_sendkeys({buf}, {keys}) none send keystrokes to a terminal
term_start({cmd}, {options}) Job open a terminal window and run a job
term_wait({buf}) Number wait for screen to be updated
--- 2371,2380 ----
tempname() String name for a temporary file
term_getattr({attr}, {what} Number get the value of attribute {what}
term_getjob({buf}) Job get the job associated with a terminal
! term_getline({buf}[, {row}]) String get a line of text from a terminal
term_getsize({buf}) List get the size of a terminal
term_list() List get the list of terminal buffers
! term_scrape({buf}[, {row}]) List get row of a terminal screen
term_sendkeys({buf}, {keys}) none send keystrokes to a terminal
term_start({cmd}, {options}) Job open a terminal window and run a job
term_wait({buf}) Number wait for screen to be updated
***************
*** 7906,7917 ****
Get the Job associated with terminal window {buf}.
{buf} is used as with |term_getsize()|.
! term_getline({buf}, {row}) *term_getline()*
Get a line of text from the terminal window of {buf}.
{buf} is used as with |term_getsize()|.
The first line has {row} zero. When {row} is invalid an empty
! string is returned.
term_getsize({buf}) *term_getsize()*
Get the size of terminal {buf}. Returns a list with two
--- 7914,7926 ----
Get the Job associated with terminal window {buf}.
{buf} is used as with |term_getsize()|.
! term_getline({buf} [, {row}]) *term_getline()*
Get a line of text from the terminal window of {buf}.
{buf} is used as with |term_getsize()|.
The first line has {row} zero. When {row} is invalid an empty
! string is returned. When {row} is omitted, the cursor line is
! used.
term_getsize({buf}) *term_getsize()*
Get the size of terminal {buf}. Returns a list with two
***************
*** 7922,7938 ****
buffer does not exist or is not a terminal window, an empty
list is returned.
! term_list(}) *term_list()*
Return a list with the buffer numbers of all buffers for
terminal windows.
! term_scrape({buf}, {row}) *term_scrape()*
Get the contents of {row} of terminal screen of {buf}.
For {buf} see |term_getsize()|.
The first {row} is zero. When {row} is invalid an empty list
! is returned.
!
Return a List containing a Dict for each screen cell:
"chars" character(s) at the cell
"fg" foreground color as #rrggbb
--- 7931,7947 ----
buffer does not exist or is not a terminal window, an empty
list is returned.
! term_list() *term_list()*
Return a list with the buffer numbers of all buffers for
terminal windows.
! term_scrape({buf} [, {row}]) *term_scrape()*
Get the contents of {row} of terminal screen of {buf}.
For {buf} see |term_getsize()|.
The first {row} is zero. When {row} is invalid an empty list
! is returned. When {row} is omitted the cursor line is used.
!
Return a List containing a Dict for each screen cell:
"chars" character(s) at the cell
"fg" foreground color as #rrggbb
*** ../vim-8.0.0816/src/evalfunc.c 2017-07-29 20:11:34.730999092 +0200
--- src/evalfunc.c 2017-07-30 18:04:36.754703940 +0200
***************
*** 833,842 ****
#ifdef FEAT_TERMINAL
{"term_getattr", 2, 2, f_term_getattr},
{"term_getjob", 1, 1, f_term_getjob},
! {"term_getline", 2, 2, f_term_getline},
{"term_getsize", 1, 1, f_term_getsize},
{"term_list", 0, 0, f_term_list},
! {"term_scrape", 2, 2, f_term_scrape},
{"term_sendkeys", 2, 2, f_term_sendkeys},
{"term_start", 1, 2, f_term_start},
{"term_wait", 1, 1, f_term_wait},
--- 833,842 ----
#ifdef FEAT_TERMINAL
{"term_getattr", 2, 2, f_term_getattr},
{"term_getjob", 1, 1, f_term_getjob},
! {"term_getline", 1, 2, f_term_getline},
{"term_getsize", 1, 1, f_term_getsize},
{"term_list", 0, 0, f_term_list},
! {"term_scrape", 1, 2, f_term_scrape},
{"term_sendkeys", 2, 2, f_term_sendkeys},
{"term_start", 1, 2, f_term_start},
{"term_wait", 1, 1, f_term_wait},
*** ../vim-8.0.0816/src/terminal.c 2017-07-30 18:02:08.535764402 +0200
--- src/terminal.c 2017-07-30 18:16:44.625495834 +0200
***************
*** 53,58 ****
--- 53,59 ----
* :term <24x80> <close> vim notes.txt
* - To set BS correctly, check get_stty(); Pass the fd of the pty.
* - do not store terminal window in viminfo. Or prefix term:// ?
+ * - add term_getcursor() - return cursor position: [row, col, visible]
* - add a character in :ls output
* - add 't' to mode()
* - when closing window and job has not ended, make terminal hidden?
***************
*** 120,126 ****
garray_T tl_scrollback;
int tl_scrollback_scrolled;
! pos_T tl_cursor;
int tl_cursor_visible;
};
--- 121,127 ----
garray_T tl_scrollback;
int tl_scrollback_scrolled;
! VTermPos tl_cursor_pos;
int tl_cursor_visible;
};
***************
*** 1020,1039 ****
{
term_T *term = (term_T *)user;
win_T *wp;
! int is_current = FALSE;
FOR_ALL_WINDOWS(wp)
{
if (wp->w_buffer == term->tl_buffer)
- {
position_cursor(wp, &pos);
- if (wp == curwin)
- is_current = TRUE;
- }
}
!
! term->tl_cursor_visible = visible;
! if (is_current)
{
may_toggle_cursor(term);
update_cursor(term, TRUE);
--- 1021,1036 ----
{
term_T *term = (term_T *)user;
win_T *wp;
!
! term->tl_cursor_pos = pos;
! term->tl_cursor_visible = visible;
FOR_ALL_WINDOWS(wp)
{
if (wp->w_buffer == term->tl_buffer)
position_cursor(wp, &pos);
}
! if (term->tl_buffer == curbuf)
{
may_toggle_cursor(term);
update_cursor(term, TRUE);
***************
*** 1723,1729 ****
if (buf == NULL)
return;
term = buf->b_term;
! row = (int)get_tv_number(&argvars[1]);
if (term->tl_vterm == NULL)
{
--- 1720,1729 ----
if (buf == NULL)
return;
term = buf->b_term;
! if (argvars[1].v_type == VAR_UNKNOWN)
! row = term->tl_cursor_pos.row;
! else
! row = (int)get_tv_number(&argvars[1]);
if (term->tl_vterm == NULL)
{
***************
*** 1814,1820 ****
screen = vterm_obtain_screen(term->tl_vterm);
l = rettv->vval.v_list;
! pos.row = (int)get_tv_number(&argvars[1]);
for (pos.col = 0; pos.col < term->tl_cols; )
{
dict_T *dcell;
--- 1814,1823 ----
screen = vterm_obtain_screen(term->tl_vterm);
l = rettv->vval.v_list;
! if (argvars[1].v_type == VAR_UNKNOWN)
! pos.row = term->tl_cursor_pos.row;
! else
! pos.row = (int)get_tv_number(&argvars[1]);
for (pos.col = 0; pos.col < term->tl_cols; )
{
dict_T *dcell;
*** ../vim-8.0.0816/src/version.c 2017-07-30 18:02:08.535764402 +0200
--- src/version.c 2017-07-30 18:06:07.782052650 +0200
***************
*** 771,772 ****
--- 771,774 ----
{ /* Add new patch number below this line */
+ /**/
+ 817,
/**/
--
CONCORDE: Message for you, sir.
He falls forward revealing the arrow with the note.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// Bram Moolenaar -- [email protected] -- 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 [email protected].
For more options, visit https://groups.google.com/d/optout.