Patch 8.1.0524

2018-11-11 Fir de Conversatie Bram Moolenaar


Patch 8.1.0524 (after 8.1.0522)
Problem:Terminal test fails on Windows.
Solution:   Skip Test_terminal_does_not_truncate_last_newlines() for now.
Files:  src/testdir/test_terminal.vim


*** ../vim-8.1.0523/src/testdir/test_terminal.vim   2018-11-11 
22:18:17.214948188 +0100
--- src/testdir/test_terminal.vim   2018-11-11 23:13:11.944813440 +0100
***
*** 1660,1666 
  endfunc
  
  func Test_terminal_does_not_truncate_last_newlines()
!   let cmd = has('win32') ? 'type' : 'cat'
let contents = [
\   [ 'One', '', 'X' ],
\   [ 'Two', '', '' ],
--- 1660,1671 
  endfunc
  
  func Test_terminal_does_not_truncate_last_newlines()
!   " FIXME: currently doens't work for Windows
!   if has('win32')
! return
!   endif
! 
!   let cmd = 'cat'
let contents = [
\   [ 'One', '', 'X' ],
\   [ 'Two', '', '' ],
*** ../vim-8.1.0523/src/version.c   2018-11-11 22:50:20.810297803 +0100
--- src/version.c   2018-11-11 23:14:17.976227493 +0100
***
*** 794,795 
--- 794,797 
  {   /* Add new patch number below this line */
+ /**/
+ 524,
  /**/

-- 
ARTHUR:  You fight with the strength of many men, Sir knight.
 I am Arthur, King of the Britons.  [pause]
 I seek the finest and the bravest knights in the land to join me
 in my Court of Camelot.  [pause]
 You have proved yourself worthy; will you join me?  [pause]
 You make me sad.  So be it.  Come, Patsy.
BLACK KNIGHT:  None shall pass.
  The Quest for the Holy Grail (Monty Python)

 /// 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.


Patch 8.1.0523

2018-11-11 Fir de Conversatie Bram Moolenaar


Patch 8.1.0523
Problem:Opening window from quickfix leaves empty buffer behind.
Solution:   Add qf_jump_newwin(). (Yegappan Lakshmanan, closes #2574)
Files:  src/proto/quickfix.pro, src/quickfix.c,
src/testdir/test_quickfix.vim


*** ../vim-8.1.0522/src/proto/quickfix.pro  2018-10-20 20:53:58.143284832 
+0200
--- src/proto/quickfix.pro  2018-11-11 22:45:31.145846186 +0100
***
*** 4,9 
--- 4,10 
  void check_quickfix_busy(void);
  void copy_loclist_stack(win_T *from, win_T *to);
  void qf_jump(qf_info_T *qi, int dir, int errornr, int forceit);
+ void qf_jump_newwin(qf_info_T *qi, int dir, int errornr, int forceit, int 
newwin);
  void qf_list(exarg_T *eap);
  void qf_age(exarg_T *eap);
  void qf_history(exarg_T *eap);
*** ../vim-8.1.0522/src/quickfix.c  2018-10-28 14:36:04.47691 +0100
--- src/quickfix.c  2018-11-11 22:46:08.525548009 +0100
***
*** 2699,2713 
  }
  
  /*
!  * Find a help window or open one.
   */
  static int
! jump_to_help_window(qf_info_T *qi, int *opened_window)
  {
  win_T *wp;
  int   flags;
  
! if (cmdmod.tab != 0)
wp = NULL;
  else
wp = qf_find_help_win();
--- 2699,2714 
  }
  
  /*
!  * Find a help window or open one. If 'newwin' is TRUE, then open a new help
!  * window.
   */
  static int
! jump_to_help_window(qf_info_T *qi, int newwin, int *opened_window)
  {
  win_T *wp;
  int   flags;
  
! if (cmdmod.tab != 0 || newwin)
wp = NULL;
  else
wp = qf_find_help_win();
***
*** 2721,2728 
if (cmdmod.split == 0 && curwin->w_width != Columns
&& curwin->w_width < 80)
flags |= WSP_TOP;
!   if (IS_LL_STACK(qi))
!   flags |= WSP_NEWLOC;  // don't copy the location list
  
if (win_split(0, flags) == FAIL)
return FAIL;
--- 2722,2731 
if (cmdmod.split == 0 && curwin->w_width != Columns
&& curwin->w_width < 80)
flags |= WSP_TOP;
!   // If the user asks to open a new window, then copy the location list.
!   // Otherwise, don't copy the location list.
!   if (IS_LL_STACK(qi) && !newwin)
!   flags |= WSP_NEWLOC;
  
if (win_split(0, flags) == FAIL)
return FAIL;
***
*** 2732,2740 
if (curwin->w_height < p_hh)
win_setheight((int)p_hh);
  
!   if (IS_LL_STACK(qi))// not a quickfix list
{
-   // The new window should use the supplied location list
curwin->w_llist = qi;
qi->qf_refcount++;
}
--- 2735,2745 
if (curwin->w_height < p_hh)
win_setheight((int)p_hh);
  
!   // When using location list, the new window should use the supplied
!   // location list. If the user asks to open a new window, then the new
!   // window will get a copy of the location list.
!   if (IS_LL_STACK(qi) && !newwin)
{
curwin->w_llist = qi;
qi->qf_refcount++;
}
***
*** 2915,2934 
  /*
   * Find a suitable window for opening a file (qf_fnum) from the
   * quickfix/location list and jump to it.  If the file is already opened in a
!  * window, jump to it. Otherwise open a new window to display the file. This 
is
!  * called from either a quickfix or a location list window.
   */
  static int
! qf_jump_to_usable_window(int qf_fnum, int *opened_window)
  {
  win_T *usable_win_ptr = NULL;
  int   usable_win;
! qf_info_T *ll_ref;
  win_T *win;
  
  usable_win = 0;
  
! ll_ref = curwin->w_llist_ref;
  if (ll_ref != NULL)
  {
// Find a non-quickfix window with this location list
--- 2920,2945 
  /*
   * Find a suitable window for opening a file (qf_fnum) from the
   * quickfix/location list and jump to it.  If the file is already opened in a
!  * window, jump to it. Otherwise open a new window to display the file. If
!  * 'newwin' is TRUE, then always open a new window. This is called from either
!  * a quickfix or a location list window.
   */
  static int
! qf_jump_to_usable_window(int qf_fnum, int newwin, int *opened_window)
  {
  win_T *usable_win_ptr = NULL;
  int   usable_win;
! qf_info_T *ll_ref = NULL;
  win_T *win;
  
  usable_win = 0;
  
! // If opening a new window, then don't use the location list referred by
! // the current window.  Otherwise two windows will refer to the same
! // location list.
! if (!newwin)
!   ll_ref = curwin->w_llist_ref;
! 
  if (ll_ref != NULL)
  {
// Find a non-quickfix window with this location list
***
*** 2952,2958 
  
  // If there is only one window and it is the quickfix window, create a
  // new one above the quickfix window.
! if ((ONE_WINDOW && bt_quickfix(curbuf)) || !usable_win)
 

Patch 8.1.0522

2018-11-11 Fir de Conversatie Bram Moolenaar


Patch 8.1.0522
Problem::terminal does not show trailing empty lines.
Solution:   Add empty lines. (Hirohito Higashi, closes #3605)
Files:  src/terminal.c, src/testdir/test_terminal.vim


*** ../vim-8.1.0521/src/terminal.c  2018-10-23 21:42:55.449760330 +0200
--- src/terminal.c  2018-11-11 21:52:13.823591882 +0100
***
*** 1592,1597 
--- 1592,1606 
}
  }
  
+ // Add trailing empty lines.
+ for (pos.row = term->tl_scrollback.ga_len;
+   pos.row < term->tl_scrollback_scrolled + term->tl_cursor_pos.row;
+   ++pos.row)
+ {
+   if (add_empty_scrollback(term, _attr, 0) == OK)
+   add_scrollback_line_to_buffer(term, (char_u *)"", 0);
+ }
+ 
  term->tl_dirty_snapshot = FALSE;
  #ifdef FEAT_TIMERS
  term->tl_timer_set = FALSE;
*** ../vim-8.1.0521/src/testdir/test_terminal.vim   2018-11-03 
21:47:10.949346136 +0100
--- src/testdir/test_terminal.vim   2018-11-11 21:47:20.154059795 +0100
***
*** 1658,1660 
--- 1658,1682 
call WaitForAssert({-> assert_false(bufexists(bnr))})
call assert_equal(1, winnr('$'))
  endfunc
+ 
+ func Test_terminal_does_not_truncate_last_newlines()
+   let cmd = has('win32') ? 'type' : 'cat'
+   let contents = [
+   \   [ 'One', '', 'X' ],
+   \   [ 'Two', '', '' ],
+   \   [ 'Three' ] + repeat([''], 30)
+   \ ]
+ 
+   for c in contents
+ call writefile(c, 'Xfile')
+ exec 'term' cmd 'Xfile'
+ let bnr = bufnr('$')
+ call assert_equal('terminal', getbufvar(bnr, ''))
+ call WaitForAssert({-> assert_equal('finished', term_getstatus(bnr))})
+ sleep 50m
+ call assert_equal(c, getline(1, line('$')))
+ quit
+   endfor
+ 
+   call delete('Xfile')
+ endfunc
*** ../vim-8.1.0521/src/version.c   2018-11-11 21:22:53.649977524 +0100
--- src/version.c   2018-11-11 22:17:05.407532879 +0100
***
*** 794,795 
--- 794,797 
  {   /* Add new patch number below this line */
+ /**/
+ 522,
  /**/

-- 
Seen on the back of a biker's vest: If you can read this, my wife fell off.

 /// 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.


Re: [vim/vim] Opening files from quickfix window in new split creates new buffers [No Name] (#2574)

2018-11-11 Fir de Conversatie Yegappan Lakshmanan
Hi,

On Fri, Nov 2, 2018 at 10:06 AM Yegappan Lakshmanan  wrote:
>
> Hi Jason,
>
> On Thu, Nov 1, 2018 at 10:15 AM Jason Franklin
>  wrote:
> >
> > Yegappan,
> >
> > Thanks for the patch.  I didn't try the code, but I looked at the diff.
> >
> > It strikes me as odd that a new, empty buffer will need to be created at
> > all.  Why waste a buffer number?  It seems like there should be a more
> > clean solution in which the target buffer is opened in a split view
> > directly without discarding an empty buffer in between.
> >
>
> I was trying to address the removal of the temporary buffer without
> significantly changing the functionality.
>
> >
> > It seems to me like this is hiding the underlying problem, rather than
> > fixing it.
> >
> > Maybe I'm being a little to picky?  Let me know what you think...
> >
>
> I will take a look to see how this can be achieved.
>

The attached patch fixes this problem.

While fixing this issue, I noticed that pressing CTRL-W-Enter key in a
location list window opened by running the ":lhelpgrep" command
doesn't open a new window. The attached patch fixes this issue also.

- Yegappan

-- 
-- 
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.


qfsplit_v3.diff
Description: Binary data


Patch 8.1.0521

2018-11-11 Fir de Conversatie Bram Moolenaar


Patch 8.1.0521
Problem:Cannot build with +eval but without +quickfix.
Solution:   Remove #ifdef for e_stringreq. (John Marriott)
Files:  src/evalfunc.c


*** ../vim-8.1.0520/src/evalfunc.c  2018-11-11 15:20:32.432704446 +0100
--- src/evalfunc.c  2018-11-11 21:21:27.762608082 +0100
***
*** 29,37 
  #endif
  
  static char *e_listarg = N_("E686: Argument of %s must be a List");
- #ifdef FEAT_QUICKFIX
  static char *e_stringreq = N_("E928: String required");
- #endif
  
  #ifdef FEAT_FLOAT
  static void f_abs(typval_T *argvars, typval_T *rettv);
--- 29,35 
*** ../vim-8.1.0520/src/version.c   2018-11-11 18:51:39.293611339 +0100
--- src/version.c   2018-11-11 21:22:16.630249881 +0100
***
*** 794,795 
--- 794,797 
  {   /* Add new patch number below this line */
+ /**/
+ 521,
  /**/

-- 
ARTHUR:  Shut up!  Will you shut up!
DENNIS:  Ah, now we see the violence inherent in the system.
ARTHUR:  Shut up!
DENNIS:  Oh!  Come and see the violence inherent in the system!
 HELP! HELP!  I'm being repressed!
  The Quest for the Holy Grail (Monty Python)

 /// 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.


Re: Patch 8.1.0519

2018-11-11 Fir de Conversatie Yegappan Lakshmanan
Hi,

On Sun, Nov 11, 2018 at 10:40 AM John Marriott
 wrote:
>
> On 12-Nov.-2018 01:21, Bram Moolenaar wrote:
> > Patch 8.1.0519
> > Problem:Cannot save and restore the tag stack.
> > Solution:   Add gettagstack() and settagstack(). (Yegappan Lakshmanan,
> >  closes #3604)
> > Files:runtime/doc/eval.txt, runtime/doc/tagsrch.txt,
> >  runtime/doc/usr_41.txt, src/alloc.h, src/dict.c, 
> > src/evalfunc.c,
> >  src/list.c, src/misc2.c, src/proto/dict.pro, 
> > src/proto/list.pro,
> >  src/proto/misc2.pro, src/proto/tag.pro, src/tag.c,
> >  src/testdir/test_tagjump.vim
> >
> After this patch, mingw-64 throws this error if FEAT_QUICKFIX is not
> defined:
>

How are you building Vim and how are you disabling FEAT_QUICKFIX?
Are you manually editing feature.h to disable FEAT_QUICKFIX?

>
> gcc -c -I. -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603
> -DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -DFEAT_MBYTE -pipe
> -march=native -Wall -O3 -fomit-frame-pointer -freg-struct-return -s
> evalfunc.c -o objnative/evalfunc.o
> In file included from evalfunc.c:15:
> evalfunc.c: In function 'f_settagstack':
> evalfunc.c:11194:9: error: 'e_stringreq' undeclared (first use in this
> function); did you mean 'f_string'?
>EMSG(_(e_stringreq));
>   ^~~
> vim.h:1627:39: note: in definition of macro 'EMSG'
>   #define EMSG(s)   emsg((char_u *)(s))
> ^
> evalfunc.c:11194:7: note: in expansion of macro '_'
>EMSG(_(e_stringreq));
> ^
> evalfunc.c:11194:9: note: each undeclared identifier is reported only
> once for each function it appears in
>EMSG(_(e_stringreq));
>   ^~~
> vim.h:1627:39: note: in definition of macro 'EMSG'
>   #define EMSG(s)   emsg((char_u *)(s))
> ^
> evalfunc.c:11194:7: note: in expansion of macro '_'
>EMSG(_(e_stringreq));
> ^
>
> The attached patch tries to fix it. Please check.
>

The patch looks good to me.

Regards,
Yegappan

-- 
-- 
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.


Re: Patch 8.1.0519

2018-11-11 Fir de Conversatie Tony Mechelynck
On Linux64, even with that #ifdef in place, evalfunc.c compiles with
no error, even in my Tiny and Small builds compiled with -quickfix and
-eval (using gcc 7.3.1). All my other builds (Normal, Big and Huge)
have +quickfix and +eval.

Here are my configure options for the Normal build:

export CONF_OPT_GUI='--enable-gui=gtk2'
export CONF_OPT_MULTIBYTE='--enable-multibyte'
export CONF_OPT_AUTOSERVE='--enable-autoservername'
export CONF_OPT_FEAT='--with-features=normal'
export CONF_ARGS='--with-vim-name=vim-normal'
export 
CONF_OPT_COMPBY='"--with-compiledby=antoine.mechely...@gmail.com"'

According to doc/various.txt line 426, Normal and higher builds are
with +quickfix. Did you try to override that and build a Normal build
without the quickfix feature?

Have you tried replacing evalfunc.c line 32 with
#ifdef FEAT_NORMAL
rather than removing it altogether along with line 34?


Best regards,
Tony.

-- 
-- 
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.


Re: Patch 8.1.0519

2018-11-11 Fir de Conversatie John Marriott



On 12-Nov.-2018 01:21, Bram Moolenaar wrote:

Patch 8.1.0519
Problem:Cannot save and restore the tag stack.
Solution:   Add gettagstack() and settagstack(). (Yegappan Lakshmanan,
 closes #3604)
Files:  runtime/doc/eval.txt, runtime/doc/tagsrch.txt,
 runtime/doc/usr_41.txt, src/alloc.h, src/dict.c, src/evalfunc.c,
 src/list.c, src/misc2.c, src/proto/dict.pro, src/proto/list.pro,
 src/proto/misc2.pro, src/proto/tag.pro, src/tag.c,
 src/testdir/test_tagjump.vim


After this patch, mingw-64 throws this error if FEAT_QUICKFIX is not 
defined:
gcc -c -I. -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603 
-DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -DFEAT_MBYTE -pipe 
-march=native -Wall -O3 -fomit-frame-pointer -freg-struct-return -s 
evalfunc.c -o objnative/evalfunc.o

In file included from evalfunc.c:15:
evalfunc.c: In function 'f_settagstack':
evalfunc.c:11194:9: error: 'e_stringreq' undeclared (first use in this 
function); did you mean 'f_string'?

  EMSG(_(e_stringreq));
 ^~~
vim.h:1627:39: note: in definition of macro 'EMSG'
 #define EMSG(s)   emsg((char_u *)(s))
   ^
evalfunc.c:11194:7: note: in expansion of macro '_'
  EMSG(_(e_stringreq));
   ^
evalfunc.c:11194:9: note: each undeclared identifier is reported only 
once for each function it appears in

  EMSG(_(e_stringreq));
 ^~~
vim.h:1627:39: note: in definition of macro 'EMSG'
 #define EMSG(s)   emsg((char_u *)(s))
   ^
evalfunc.c:11194:7: note: in expansion of macro '_'
  EMSG(_(e_stringreq));
   ^

The attached patch tries to fix it. Please check.
Cheers
John

--
--
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.
--- evalfunc.orig.c 2018-11-12 05:15:25.846826600 +1100
+++ evalfunc.c  2018-11-12 05:33:21.053883100 +1100
@@ -29,9 +29,7 @@
 #endif
 
 static char *e_listarg = N_("E686: Argument of %s must be a List");
-#ifdef FEAT_QUICKFIX
 static char *e_stringreq = N_("E928: String required");
-#endif
 
 #ifdef FEAT_FLOAT
 static void f_abs(typval_T *argvars, typval_T *rettv);


Patch 8.1.0520

2018-11-11 Fir de Conversatie Bram Moolenaar


Patch 8.1.0520
Problem:Screen diff test sometimes fails.
Solution:   Add to list of flaky tests.
Files:  src/testdir/runtest.vim


*** ../vim-8.1.0519/src/testdir/runtest.vim 2018-10-07 15:42:04.279309175 
+0200
--- src/testdir/runtest.vim 2018-11-11 18:45:38.800483945 +0100
***
*** 279,284 
--- 279,285 
\ 'Test_collapse_buffers()',
\ 'Test_communicate()',
\ 'Test_cwd()',
+   \ 'Test_diff_screen()',
\ 'Test_exit_callback_interval()',
\ 'Test_nb_basic()',
\ 'Test_oneshot()',
*** ../vim-8.1.0519/src/version.c   2018-11-11 15:20:32.436704418 +0100
--- src/version.c   2018-11-11 18:48:12.159297738 +0100
***
*** 794,795 
--- 794,797 
  {   /* Add new patch number below this line */
+ /**/
+ 520,
  /**/

-- 
ARTHUR:  Be quiet!
DENNIS:  Well you can't expect to wield supreme executive power just 'cause
 some watery tart threw a sword at you!
ARTHUR:  Shut up!
DENNIS:  I mean, if I went around sayin' I was an empereror just because some
 moistened bint had lobbed a scimitar at me they'd put me away!
  The Quest for the Holy Grail (Monty Python)

 /// 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.


Patch 8.1.0519

2018-11-11 Fir de Conversatie Bram Moolenaar


Patch 8.1.0519
Problem:Cannot save and restore the tag stack.
Solution:   Add gettagstack() and settagstack(). (Yegappan Lakshmanan,
closes #3604)
Files:  runtime/doc/eval.txt, runtime/doc/tagsrch.txt,
runtime/doc/usr_41.txt, src/alloc.h, src/dict.c, src/evalfunc.c,
src/list.c, src/misc2.c, src/proto/dict.pro, src/proto/list.pro,
src/proto/misc2.pro, src/proto/tag.pro, src/tag.c,
src/testdir/test_tagjump.vim


*** ../vim-8.1.0518/runtime/doc/eval.txt2018-11-10 17:33:23.091518784 
+0100
--- runtime/doc/eval.txt2018-11-11 15:16:01.878631709 +0100
***
*** 2198,2203 
--- 2206,2212 
any variable {varname} in tab {nr} or {def}
  gettabwinvar({tabnr}, {winnr}, {name} [, {def}])
any {name} in {winnr} in tab page {tabnr}
+ gettagstack([{nr}])   Dictget the tag stack of window {nr}
  getwininfo([{winid}]) Listlist of info about each window
  getwinpos([{timeout}])ListX and Y coord in pixels of the 
Vim window
  getwinposx()  Number  X coord in pixels of the Vim window
***
*** 2371,2376 
--- 2379,2386 
  settabwinvar({tabnr}, {winnr}, {varname}, {val})
noneset {varname} in window {winnr} in tab
page {tabnr} to {val}
+ settagstack({nr}, {dict} [, {action}])
+   Number  modify tag stack using {dict}
  setwinvar({nr}, {varname}, {val}) noneset {varname} in window {nr} to 
{val}
  sha256({string})  String  SHA256 checksum of {string}
  shellescape({string} [, {special}])
***
*** 4959,4964 
--- 4971,5007 
:let list_is_on = gettabwinvar(1, 2, '')
:echo "myvar = " . gettabwinvar(3, 1, 'myvar')
  <
+   To obtain all window-local variables use: >
+   gettabwinvar({tabnr}, {winnr}, '&')
+ 
+ gettagstack([{nr}])   *gettagstack()*
+   The result is a Dict, which is the tag stack of window {nr}.
+   {nr} can be the window number or the |window-ID|.
+   When {nr} is not specified, the current window is used.
+   When window {nr} doesn't exist, an empty Dict is returned.
+ 
+   The returned dictionary contains the following entries:
+   curidx  Current index in the stack. When at
+   top of the stack, set to (length + 1).
+   Index of bottom of the stack is 1.
+   items   List of items in the stack. Each item
+   is a dictionary containing the
+   entries described below.
+   length  Number of entries in the stack.
+ 
+   Each item in the stack is a dictionary with the following
+   entries:
+   bufnr   buffer number of the current jump
+   fromcursor position before the tag jump.
+   See |getpos()| for the format of the
+   returned list.
+   matchnr current matching tag number. Used when
+   multiple matching tags are found for a
+   name.
+   tagname name of the tag
+ 
+   See |tagstack| for more information about the tag stack.
+ 
  getwininfo([{winid}]) *getwininfo()*
Returns information about windows as a List with Dictionaries.
  
***
*** 7522,7527 
--- 7566,7602 
:call settabwinvar(3, 2, "myvar", "foobar")
  < This function is not available in the |sandbox|.
  
+ settagstack({nr}, {dict} [, {action}])*settagstack()*
+   Modify the tag stack of the window {nr} using {dict}.
+   {nr} can be the window number or the |window-ID|.
+ 
+   For a list of supported items in {dict}, refer to
+   |gettagstack()|
+   *E962*
+   If {action} is not present or is set to 'r', then the tag
+   stack is replaced. If {action} is set to 'a', then new entries
+   from {dict} are pushed onto the tag stack.
+ 
+   Returns zero for success, -1 for failure.
+ 
+   Examples:
+   Set current index of the tag stack to 4: >
+   call settagstack(1005, {'curidx' : 4})
+ 
+ < Empty the tag stack of window 3: >
+   call 

Re: Patch to add functions for manipulating the tag stack of a window

2018-11-11 Fir de Conversatie Yegappan Lakshmanan
Hi Bram,

On Sat, Nov 10, 2018 at 11:23 AM Bram Moolenaar  wrote:
>
> Yegappan wrote:
>
> > On Tue, Nov 6, 2018 at 10:12 AM Yegappan Lakshmanan  
> > wrote:
> > >
> > > > > > > >
> > > > > > > > The attached patch adds two new functions (gettagstack() and
> > > > > > > > settagstack()) for getting and modifying the tag stack of a
> > > > > > > > window. The documentation update and a test are also part
> > > > > > > > of this patch.
> > > > > > > >
> > > > >
> > > > > I am attaching an updated patch that moves the new tag stack related
> > > > > functions to the tag.c file from the evalfunc.c file and also adds 
> > > > > additional
> > > > > test cases.
> > > > >
> > > >
> >
> > An updated patch with additional tests for memory allocation failures is
> > attached.
>
> Thanks.  For me the test fails:
>
> Found errors in Test_getsettagstack():
> function RunTheTest[40]..Test_getsettagstack line 34: Expected [{'bufnr': 2,
> 'tagname': 'one', 'from': [2, 1, 0, 0], 'matchnr': 1}, {'bufnr': 2,
> 'tagname': 'two', 'from': [2, 1, 0, 0], 'matchnr': 1}, {'bufnr': 5,
> 'tagname': 'three', 'from': [5, 2, 0, 0], 'matchnr': 1}] but got [{'bufnr':
> 1043, 'tagname': 'one', 'from': [1043, 1, 0, 0], 'matchnr': 1}, {'bufnr':
> 1043, 'tagname': 'two', 'from': [1043, 1, 0, 0], 'matchnr': 1}, {'bufnr':
> 1073, 'tagname': 'three', 'from': [1073, 2, 0, 0], 'matchnr': 1}] function
> RunTheTest[40]..Test_getsettagstack line 37: Expected [{'bufnr': 2,
> 'tagname': 'one', 'from': [2, 1, 0, 0], 'matchnr': 1}, {'bufnr': 2,
> 'tagname': 'two', 'from': [2, 1, 0, 0], 'matchnr': 1}, {'bufnr': 5,
> 'tagname': 'three', 'from': [5, 2, 0, 0], 'matchnr': 1}] but got [{'bufnr':
> 1043, 'tagname': 'one', 'from': [1043, 1, 0, 0], 'matchnr': 1}, {'bufnr':
> 1043, 'tagname': 'two', 'from': [1043, 1, 0, 0], 'matchnr': 1}, {'bufnr':
> 1073, 'tagname': 'three', 'from': [1073, 2, 0, 0], 'matchnr': 1}]
>

The buffer numbers in the test are hard coded. This lead to this failure.
I have fixed it now.

I have created a pull request for this patch (to make sure that all
the tests are
passing):

https://github.com/vim/vim/pull/3604

Regards,
Yegappan

-- 
-- 
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.