Re: [vim/vim] End-of-line (EOL) character being displayed despite file does not end with newline (#6119)

2020-05-22 Fir de Conversatie Gary Johnson
On 2020-05-22, dirdi wrote:
> Thank you both for your fast response!
> 
> Gary wrote:
> It says that the eol character appears at the end of the line;
> it does not say that the eol character represents the EOL sequence.
> 
> My point is that the line does not end, but the file. Therefore, the behavior
> does - to my understanding - not comply to :help lcs-eol.

That's an interesting perspective.  I would have said that the line
ends at the end of the file, as the programs I've seen that don't
end the last line of the file with an EOL nevertheless intend that
the line end there.  That's not how "cat file1 file2" would handle
it, though, for example, if file1 didn't end with an EOL.

> Gary wrote:
> In the case of the last line of a file that does not end with an EOL
> sequence, the eol character shows where the text of that line, including
> white space, ends. By not having the eol character at the end of the last
> line, the user would lose that information. So I think it's a feature and
> the intended behavior, not a bug.
> 
> Is not the lcs-trail setting responsible for indicating trailing spaces?

That would work, too.

> *lcs-trail*
> trail:c Character to show for trailing spaces.  When omitted,
> trailing spaces are blank.  Overrides the "space"
> setting for trailing spaces.
> 
> E.g. setting it to a dot :set listchars:eol:$,trail:. gives:
> 2020-05-23-021102_90x52_scrot
> 
> My (maybe wrong?) intention is that the window content should represent what
> will be written to disk, when one executes the write command. Hence, the
> lcs-eol character should be displayed, iff it would be written to disk (i.e. 
> if
> it is present or if the fixeol setting is set).

I don't think you're wrong:  you have a good point.  I think there's
more than one way to present this information.  Vim (vi?) chose one
way and you would have chosen another.

I suppose it could be an option [ducks].  There are some issues with
the way that some other listchars are handled (notably lcs-extends),
but no solution yet, so there might be an opportunity to make
lcs-eol work either as you would like or as it does now.

Regards,
Gary

-- 
-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20200523030124.GB8832%40phoenix.


Re: [vim/vim] End-of-line (EOL) character being displayed despite file does not end with newline (#6119)

2020-05-22 Fir de Conversatie Tony Mechelynck
In addition to what Gary said, I'd mention that binary files (files read
with e.g. :e ++bin filename.ext) and files where ":setlocal nofixeol" has
been set (which is not the default) will be written with an incomplete last
line if 'noeol' was set either at read-time (because no EOL was found on
the last line) or later (e.g. manually). No matter whether or not 'tist' is
set or whether or not 'listchars' includes a visible EOL (the default is
eol:$, I use eol:¶) or a blank EOL (set e.g. by eol:\  with a
backslash-escaped space, or by omitting the eol: suboption altogether):
'list' and 'listchars' are only for display purposes, and, as Gary said,
they are one possible way to notice that there is whitespace at the end of
a line.

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/CAJkCKXvBCqJcE%2BSaqcckZyrRnmPFyjoYBZe4vCFqW3iEp7ywvw%40mail.gmail.com.


Re: [vim/vim] End-of-line (EOL) character being displayed despite file does not end with newline (#6119)

2020-05-22 Fir de Conversatie Gary Johnson
On 2020-05-22, dirdi wrote:
> Bug Description
> The end-of-line character (lcs-eol, $ by default) is displayed at the end of
> file (EOF), no matter if the file actually ends with a newline.
> 
> To Reproduce
> 
>  1. Create a file without a newline at EOF echo -n foo > bar
>  2. Run vim --clean bar
>  3. Enable list mode :set list
> 
> Neither disabling the fixeol setting (:set nofixeol), nor starting Vim in
> binary mode (vim --clean -b bar) affects this behavior.
> 
> Expected behavior
> There should be no EOL character (i.e. $) being displayed.

While I appreciate your point of view, ":help lcs-eol" says:

eol:c Character to show at the end of each line.  When
  omitted, there is no extra character at the end of
  the line.  

It says that the eol character appears at the end of the line;
it does not say that the eol character represents the EOL sequence.

In the case of the last line of a file that does not end with an EOL
sequence, the eol character shows where the text of that line,
including white space, ends.  By not having the eol character at the
end of the last line, the user would lose that information.

So I think it's a feature and the intended behavior, not a bug.

As for being able to visualize that distinction, as you would like,
I'm afraid I can't think a solution at the moment that uses the
existing capabilities of Vim.

Regards,
Gary

-- 
-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20200522212103.GA8832%40phoenix.


Patch 8.2.0813

2020-05-22 Fir de Conversatie Bram Moolenaar


Patch 8.2.0813
Problem:libvterm code is slightly different from upstream.
Solution:   Use upstream text to avoid future merge problems.  Mainly comment
style changes.
Files:  src/libvterm/include/vterm.h, src/libvterm/src/rect.h,
src/libvterm/src/utf8.h, src/libvterm/src/vterm_internal.h,
src/libvterm/src/encoding.c, src/libvterm/src/keyboard.c,
src/libvterm/src/mouse.c, src/libvterm/src/parser.c,
src/libvterm/src/pen.c, src/libvterm/src/screen.c,
src/libvterm/src/state.c, src/libvterm/src/unicode.c,
src/libvterm/src/vterm.c


*** ../vim-8.2.0812/src/libvterm/include/vterm.h2020-05-21 
20:10:00.285336763 +0200
--- src/libvterm/include/vterm.h2020-05-22 20:59:25.001252440 +0200
***
*** 35,43 
int col;
  } VTermPos;
  
! /*
!  * Some small utility functions; we can just keep these static here.
!  */
  
  /*
   * Order points by on-screen flow order:
--- 35,41 
int col;
  } VTermPos;
  
! /* some small utility functions; we can just keep these static here */
  
  /*
   * Order points by on-screen flow order:
***
*** 62,68 
int end_col;
  } VTermRect;
  
! // Return true if the rect "r" contains the point "p".
  int vterm_rect_contains(VTermRect r, VTermPos p);
  
  #if defined(DEFINE_INLINES) || USE_INLINE
--- 60,66 
int end_col;
  } VTermRect;
  
! /* true if the rect contains the point */
  int vterm_rect_contains(VTermRect r, VTermPos p);
  
  #if defined(DEFINE_INLINES) || USE_INLINE
***
*** 73,78 
--- 71,77 
  }
  #endif
  
+ /* move a rect */
  // Move "rect" "row_delta" down and "col_delta" right.
  // Does not check boundaries.
  void vterm_rect_move(VTermRect *rect, int row_delta, int col_delta);
***
*** 185,193 
   */
  int vterm_color_is_equal(const VTermColor *a, const VTermColor *b);
  
- 
  typedef enum {
!   // VTERM_VALUETYPE_NONE = 0
VTERM_VALUETYPE_BOOL = 1,
VTERM_VALUETYPE_INT,
VTERM_VALUETYPE_STRING,
--- 184,191 
   */
  int vterm_color_is_equal(const VTermColor *a, const VTermColor *b);
  
  typedef enum {
!   /* VTERM_VALUETYPE_NONE = 0 */
VTERM_VALUETYPE_BOOL = 1,
VTERM_VALUETYPE_INT,
VTERM_VALUETYPE_STRING,
***
*** 211,217 
  } VTermValue;
  
  typedef enum {
!   // VTERM_ATTR_NONE = 0
VTERM_ATTR_BOLD = 1,   // bool:   1, 22
VTERM_ATTR_UNDERLINE,  // number: 4, 21, 24
VTERM_ATTR_ITALIC, // bool:   3, 23
--- 209,215 
  } VTermValue;
  
  typedef enum {
!   /* VTERM_ATTR_NONE = 0 */
VTERM_ATTR_BOLD = 1,   // bool:   1, 22
VTERM_ATTR_UNDERLINE,  // number: 4, 21, 24
VTERM_ATTR_ITALIC, // bool:   3, 23
***
*** 227,233 
  } VTermAttr;
  
  typedef enum {
!   // VTERM_PROP_NONE = 0
VTERM_PROP_CURSORVISIBLE = 1, // bool
VTERM_PROP_CURSORBLINK,   // bool
VTERM_PROP_ALTSCREEN, // bool
--- 225,231 
  } VTermAttr;
  
  typedef enum {
!   /* VTERM_PROP_NONE = 0 */
VTERM_PROP_CURSORVISIBLE = 1, // bool
VTERM_PROP_CURSORBLINK,   // bool
VTERM_PROP_ALTSCREEN, // bool
***
*** 261,269 
  typedef struct {
const uint32_t *chars;
int width;
!   unsigned intprotected_cell:1;  // DECSCA-protected against DECSEL/DECSED
!   unsigned intdwl:1; // DECDWL or DECDHL double-width line
!   unsigned intdhl:2; // DECDHL double-height line (1=top 
2=bottom)
  } VTermGlyphInfo;
  
  typedef struct {
--- 259,267 
  typedef struct {
const uint32_t *chars;
int width;
!   unsigned intprotected_cell:1;  /* DECSCA-protected against 
DECSEL/DECSED */
!   unsigned intdwl:1; /* DECDWL or DECDHL double-width line */
!   unsigned intdhl:2; /* DECDHL double-height line (1=top 
2=bottom) */
  } VTermGlyphInfo;
  
  typedef struct {
***
*** 272,280 
unsigned intcontinuation:1;/* Line is a flow continuation of the 
previous */
  } VTermLineInfo;
  
  typedef struct {
!   // libvterm relies on the allocated memory to be zeroed out before it is
!   // returned by the allocator.
void *(*malloc)(size_t size, void *allocdata);
void  (*free)(void *ptr, void *allocdata);
  } VTermAllocatorFunctions;
--- 270,287 
unsigned intcontinuation:1;/* Line is a flow continuation of the 
previous */
  } VTermLineInfo;
  
+ /* Copies of VTermState fields that the 'resize' callback might have reason to
+  * edit. 'resize' callback gets total control of these fields and may
+  * free-and-reallocate them if required. They will be copied back from the
+  * struct after the callback has returned.
+  */
+ typedef struct {
+   VTermPos pos;/* current cursor position */
+ } VTermStateFields;
+ 
  typedef struct {
!   /* libvterm relies on this memory to be zeroed out before it is returned
!* by the allocator. */

Re: Patch 8.2.0807

2020-05-22 Fir de Conversatie Bram Moolenaar


Marius Gedminas wrote:

> On Fri, May 22, 2020 at 01:11:18PM +0200, Bram Moolenaar wrote:
> > Patch 8.2.0807
> > Problem:Cannot easily restore a mapping.
> > Solution:   Add mapset().
> > Files:  runtime/doc/eval.txt, src/map.c, src/proto/map.pro, 
> > src/evalfunc.c
> > src/testdir/test_maparg.vim
> 
> > *** ../vim-8.2.0806/runtime/doc/eval.txt2020-05-13 16:34:10.397723799 
> > +0200
> > --- runtime/doc/eval.txt2020-05-22 12:52:07.920142788 +0200
> > ***
> > *** 2582,2587 
> > --- 2586,2593 
> > rhs of mapping {name} in mode {mode}
> >   mapcheck({name} [, {mode} [, {abbr}]])
> > String  check for mappings matching {name}
> > + mapset({name}, {mode}, {abbr}, {dict}
> 
> This line is missing a closing )

Right, and {name} should not be there.


-- 
hundred-and-one symptoms of being an internet addict:
164. You got out to buy software, instead of going out for a beer.

 /// 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202005221841.04MIfN8m024111%40masaka.moolenaar.net.


Patch 8.2.0812

2020-05-22 Fir de Conversatie Bram Moolenaar


Patch 8.2.0812
Problem:mapset() does not properly handle <> notation.
Solution:   Convert <> codes. (closes #6116)
Files:  src/map.c, src/testdir/test_maparg.vim


*** ../vim-8.2.0811/src/map.c   2020-05-22 13:38:15.606498510 +0200
--- src/map.c   2020-05-22 19:47:17.196385407 +0200
***
*** 2269,2274 
--- 2269,2276 
  dict_T*d;
  char_u*lhs;
  char_u*rhs;
+ char_u*orig_rhs;
+ char_u*arg_buf = NULL;
  int   noremap;
  int   expr;
  int   silent;
***
*** 2304,2309 
--- 2306,2314 
emsg(_("E99: rhs entry missing in mapset() dict argument"));
return;
  }
+ orig_rhs = rhs;
+ rhs = replace_termcodes(rhs, _buf,
+   REPTERM_DO_LT | REPTERM_SPECIAL, NULL);
  
  noremap = dict_get_number(d, (char_u *)"noremap") ? REMAP_NONE: 0;
  if (dict_get_number(d, (char_u *)"script") != 0)
***
*** 2330,2338 
  
  keys = replace_termcodes(lhs, _buf,
  REPTERM_FROM_PART | REPTERM_DO_LT, NULL);
! (void)map_add(map_table, abbr_table, keys, rhs, rhs, noremap,
nowait, silent, mode, is_abbr, expr, sid, lnum, simplified);
  vim_free(keys_buf);
  }
  #endif
  
--- 2335,2344 
  
  keys = replace_termcodes(lhs, _buf,
  REPTERM_FROM_PART | REPTERM_DO_LT, NULL);
! (void)map_add(map_table, abbr_table, keys, rhs, orig_rhs, noremap,
nowait, silent, mode, is_abbr, expr, sid, lnum, simplified);
  vim_free(keys_buf);
+ vim_free(arg_buf);
  }
  #endif
  
*** ../vim-8.2.0811/src/testdir/test_maparg.vim 2020-05-22 13:09:55.320226061 
+0200
--- src/testdir/test_maparg.vim 2020-05-22 20:00:19.320652928 +0200
***
*** 6,12 
return str2nr(matchstr(expand(''), '\zs\d\+\ze_SID$'))
  endfunc
  
! funct Test_maparg()
new
set cpo-=<
set encoding=utf8
--- 6,12 
return str2nr(matchstr(expand(''), '\zs\d\+\ze_SID$'))
  endfunc
  
! func Test_maparg()
new
set cpo-=<
set encoding=utf8
***
*** 156,161 
--- 156,228 
  func Test_mapset()
call One_mapset_test('K')
call One_mapset_test('')
+ 
+   " Check <> key conversion
+   new
+   inoremap K onex
+   call feedkeys("iK\", 'xt')
+   call assert_equal('onxe', getline(1))
+ 
+   let orig = maparg('K', 'i', 0, 1)
+   call assert_equal('K', orig.lhs)
+   call assert_equal('onex', orig.rhs)
+   call assert_equal('i', orig.mode)
+ 
+   iunmap K
+   let d = maparg('K', 'i', 0, 1)
+   call assert_equal({}, d)
+ 
+   call mapset('i', 0, orig)
+   call feedkeys("SK\", 'xt')
+   call assert_equal('onxe', getline(1))
+ 
+   iunmap K
+ 
+   " Test literal  using a backslash
+   let cpo_save = 
+   set cpo-=B
+   inoremap K one\two
+   call feedkeys("SK\", 'xt')
+   call assert_equal('onetwo', getline(1))
+ 
+   let orig = maparg('K', 'i', 0, 1)
+   call assert_equal('K', orig.lhs)
+   call assert_equal('one\two', orig.rhs)
+   call assert_equal('i', orig.mode)
+ 
+   iunmap K
+   let d = maparg('K', 'i', 0, 1)
+   call assert_equal({}, d)
+ 
+   call mapset('i', 0, orig)
+   call feedkeys("SK\", 'xt')
+   call assert_equal('onetwo', getline(1))
+ 
+   iunmap K
+   let  = cpo_save
+ 
+   " Test literal  using CTRL-V
+   inoremap K one two
+   call feedkeys("SK\", 'xt')
+   call assert_equal('onetwo', getline(1))
+ 
+   let orig = maparg('K', 'i', 0, 1)
+   call assert_equal('K', orig.lhs)
+   call assert_equal("one\x16two", orig.rhs)
+   call assert_equal('i', orig.mode)
+ 
+   iunmap K
+   let d = maparg('K', 'i', 0, 1)
+   call assert_equal({}, d)
+ 
+   call mapset('i', 0, orig)
+   call feedkeys("SK\", 'xt')
+   call assert_equal('onetwo', getline(1))
+ 
+   iunmap K
+   let  = cpo_save
+ 
+   bwipe!
  endfunc
  
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.0811/src/version.c   2020-05-22 14:44:23.301661908 +0200
--- src/version.c   2020-05-22 19:42:44.073770419 +0200
***
*** 748,749 
--- 748,751 
  {   /* Add new patch number below this line */
+ /**/
+ 812,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
163. You go outside for the fresh air (at -30 degrees) but open the
 window first to hear new mail arrive.

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

Re: Patch 8.2.0807

2020-05-22 Fir de Conversatie Marius Gedminas
On Fri, May 22, 2020 at 01:11:18PM +0200, Bram Moolenaar wrote:
> Patch 8.2.0807
> Problem:Cannot easily restore a mapping.
> Solution:   Add mapset().
> Files:  runtime/doc/eval.txt, src/map.c, src/proto/map.pro, src/evalfunc.c
> src/testdir/test_maparg.vim

> *** ../vim-8.2.0806/runtime/doc/eval.txt  2020-05-13 16:34:10.397723799 
> +0200
> --- runtime/doc/eval.txt  2020-05-22 12:52:07.920142788 +0200
> ***
> *** 2582,2587 
> --- 2586,2593 
>   rhs of mapping {name} in mode {mode}
>   mapcheck({name} [, {mode} [, {abbr}]])
>   String  check for mappings matching {name}
> + mapset({name}, {mode}, {abbr}, {dict}

This line is missing a closing )

> + nonerestore mapping from |maparg()| result
>   match({expr}, {pat} [, {start} [, {count}]])
>   Number  position where {pat} matches in {expr}
>   matchadd({group}, {pattern} [, {priority} [, {id} [, {dict}]]])

Marius Gedminas
-- 
Isn't air travel wonderful?  Breakfast in London, dinner in New York,
luggage in Brazil.

-- 
-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20200522175003.apohgnrymvqnl72u%40blynas.


signature.asc
Description: PGP signature


Patch 8.2.0811

2020-05-22 Fir de Conversatie Bram Moolenaar


Patch 8.2.0811
Problem:Terminal keycode test is flaky.
Solution:   Use WaitForAssert()
Files:  src/testdir/test_terminal.vim


*** ../vim-8.2.0810/src/testdir/test_terminal.vim   2020-05-22 
13:33:58.203383951 +0200
--- src/testdir/test_terminal.vim   2020-05-22 14:43:18.425961839 +0200
***
*** 2493,2498 
--- 2493,2499 
call term_sendkeys(buf, ":call OpenTerm(1)\")
call TermWait(buf, 150)
call term_sendkeys(buf, ":set hlsearch\")
+   call TermWait(buf, 100)
call term_sendkeys(buf, "/edit\")
call VerifyScreenDump(buf, 'Test_terminal_popup_3', {})
   
***
*** 2517,2523 
  
call TermWait(buf, 50)
call term_sendkeys(buf, ":q\")
!   call TermWait(buf, 100)  " wait for terminal to vanish
  
call StopVimInTerminal(buf)
call delete('Xtext')
--- 2518,2524 
  
call TermWait(buf, 50)
call term_sendkeys(buf, ":q\")
!   call TermWait(buf, 150)  " wait for terminal to vanish
  
call StopVimInTerminal(buf)
call delete('Xtext')
***
*** 2704,2711 
call term_sendkeys(buf, "i")
for i in range(len(keys))
  call term_sendkeys(buf, "\\" .. keys[i])
! call term_wait(buf)
! call assert_equal(output[i], term_getline(buf, 1))
endfor
  
let keypad_keys = ["\", "\", "\", "\", "\", "\",
--- 2705,2711 
call term_sendkeys(buf, "i")
for i in range(len(keys))
  call term_sendkeys(buf, "\\" .. keys[i])
! call WaitForAssert({-> assert_equal(output[i], term_getline(buf, 1))})
endfor
  
let keypad_keys = ["\", "\", "\", "\", "\", "\",
***
*** 2720,2732 
continue
  endif
  call term_sendkeys(buf, "\" .. keypad_keys[i])
! call term_wait(buf)
! call assert_equal(keypad_output[i], term_getline(buf, 1))
endfor
  
call feedkeys("\\\one\.two", 'xt')
!   call term_wait(buf)
!   call assert_equal('two', term_getline(buf, 1))
  
call StopVimInTerminal(buf)
  endfunc
--- 2720,2730 
continue
  endif
  call term_sendkeys(buf, "\" .. keypad_keys[i])
! call WaitForAssert({-> assert_equal(keypad_output[i], term_getline(buf, 
1))})
endfor
  
call feedkeys("\\\one\.two", 'xt')
!   call WaitForAssert({-> assert_equal('two', term_getline(buf, 1))})
  
call StopVimInTerminal(buf)
  endfunc
*** ../vim-8.2.0810/src/version.c   2020-05-22 14:10:33.791770351 +0200
--- src/version.c   2020-05-22 14:36:03.800096628 +0200
***
*** 748,749 
--- 748,751 
  {   /* Add new patch number below this line */
+ /**/
+ 811,
  /**/

-- 
Send $25.00 for handy leaflet on how to make money by selling leaflets

 /// 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202005221245.04MCjewW009835%40masaka.moolenaar.net.


Patch 8.2.0810

2020-05-22 Fir de Conversatie Bram Moolenaar


Patch 8.2.0810
Problem:Error when appending "tagfile" to 'wildoptions'.
Solution:   use flags P_ONECOMMA and P_NODUP. (Dmitri Vereshchagin,
closes #6105)
Files:  src/optiondefs.h, src/testdir/test_options.vim


*** ../vim-8.2.0809/src/optiondefs.h2020-01-18 15:53:15.954799326 +0100
--- src/optiondefs.h2020-05-22 14:09:19.220029708 +0200
***
*** 2837,2843 
  {"wildmode","wim",  P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP,
(char_u *)_wim, PV_NONE,
{(char_u *)"full", (char_u *)0L} SCTX_INIT},
! {"wildoptions", "wop",  P_STRING|P_VI_DEF,
(char_u *)_wop, PV_NONE,
{(char_u *)"", (char_u *)0L}
SCTX_INIT},
--- 2837,2843 
  {"wildmode","wim",  P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP,
(char_u *)_wim, PV_NONE,
{(char_u *)"full", (char_u *)0L} SCTX_INIT},
! {"wildoptions", "wop",  P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP,
(char_u *)_wop, PV_NONE,
{(char_u *)"", (char_u *)0L}
SCTX_INIT},
*** ../vim-8.2.0809/src/testdir/test_options.vim2020-05-07 
18:43:40.867365982 +0200
--- src/testdir/test_options.vim2020-05-22 14:07:26.292422465 +0200
***
*** 60,65 
--- 60,72 
set wildchar&
  endfunc
  
+ func Test_wildoptions()
+   set wildoptions=
+   set wildoptions+=tagfile
+   set wildoptions+=tagfile
+   call assert_equal('tagfile', )
+ endfunc
+ 
  func Test_options_command()
let caught = 'ok'
try
*** ../vim-8.2.0809/src/version.c   2020-05-22 13:38:15.606498510 +0200
--- src/version.c   2020-05-22 14:09:01.304092026 +0200
***
*** 748,749 
--- 748,751 
  {   /* Add new patch number below this line */
+ /**/
+ 810,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
160. You get in the elevator and double-click the button for the floor
 you want.

 /// 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202005221211.04MCB58K029448%40masaka.moolenaar.net.


Patch 8.2.0809

2020-05-22 Fir de Conversatie Bram Moolenaar


Patch 8.2.0809
Problem:Build failure with small features. (Tony Mechelynck)
Solution:   Move "expr" inside #ifdef.
Files:  src/map.c


*** ../vim-8.2.0808/src/map.c   2020-05-22 13:09:55.320226061 +0200
--- src/map.c   2020-05-22 13:37:20.370688926 +0200
***
*** 211,223 
char_u  *keys,
char_u  *rhs,
char_u  *orig_rhs,
-   int expr,
int noremap,
int nowait,
int silent,
int mode,
int is_abbr,
  #ifdef FEAT_EVAL
scid_T  sid,// -1 to use current_sctx
linenr_Tlnum,
  #endif
--- 211,223 
char_u  *keys,
char_u  *rhs,
char_u  *orig_rhs,
int noremap,
int nowait,
int silent,
int mode,
int is_abbr,
  #ifdef FEAT_EVAL
+   int expr,
scid_T  sid,// -1 to use current_sctx
linenr_Tlnum,
  #endif
***
*** 839,849 
continue;   // have added the new entry already
  
// Get here when adding a new entry to the maphash[] list or abbrlist.
!   if (map_add(map_table, abbr_table, keys, rhs, orig_rhs, expr,
!   noremap, nowait, silent, mode,
!   abbrev,
  #ifdef FEAT_EVAL
!   /* sid */ -1, /* lnum */ 0,
  #endif
did_simplify && keyround == 1) == FAIL)
{
--- 839,848 
continue;   // have added the new entry already
  
// Get here when adding a new entry to the maphash[] list or abbrlist.
!   if (map_add(map_table, abbr_table, keys, rhs, orig_rhs,
!   noremap, nowait, silent, mode, abbrev,
  #ifdef FEAT_EVAL
!   expr, /* sid */ -1, /* lnum */ 0,
  #endif
did_simplify && keyround == 1) == FAIL)
{
***
*** 2331,2338 
  
  keys = replace_termcodes(lhs, _buf,
  REPTERM_FROM_PART | REPTERM_DO_LT, NULL);
! (void)map_add(map_table, abbr_table, keys, rhs, rhs, expr,
!   noremap, nowait, silent, mode, is_abbr, sid, lnum, simplified);
  vim_free(keys_buf);
  }
  #endif
--- 2330,2337 
  
  keys = replace_termcodes(lhs, _buf,
  REPTERM_FROM_PART | REPTERM_DO_LT, NULL);
! (void)map_add(map_table, abbr_table, keys, rhs, rhs, noremap,
!   nowait, silent, mode, is_abbr, expr, sid, lnum, simplified);
  vim_free(keys_buf);
  }
  #endif
*** ../vim-8.2.0808/src/version.c   2020-05-22 13:33:58.207383937 +0200
--- src/version.c   2020-05-22 13:37:56.282565144 +0200
***
*** 748,749 
--- 748,751 
  {   /* Add new patch number below this line */
+ /**/
+ 809,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
157. You fum through a magazine, you first check to see if it has a web
 address.

 /// 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202005221140.04MBe10Q022921%40masaka.moolenaar.net.


Re: Patch 8.2.0807

2020-05-22 Fir de Conversatie Bram Moolenaar


Tony wrote:

> On Fri, May 22, 2020 at 1:11 PM Bram Moolenaar  wrote:
> >
> >
> > Patch 8.2.0807
> > Problem:Cannot easily restore a mapping.
> > Solution:   Add mapset().
> > Files:  runtime/doc/eval.txt, src/map.c, src/proto/map.pro, 
> > src/evalfunc.c
> > src/testdir/test_maparg.vim
> 
> Missing #ifdef ? I get a fatal error in Small and Tiny, as follows:
> 
> linux-2iyu:~/.build/vim/vim-hg/src/shadow-tiny # (make || echo 'exit
> status' $? ; date) 2>&1 |tee -a make.log
> gcc -c -I. -Iproto -DHAVE_CONFIG_H -O2 -fno-strength-reduce -Wall
> -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1-o objects/evalfunc.o
> evalfunc.c
> gcc -c -I. -Iproto -DHAVE_CONFIG_H -O2 -fno-strength-reduce -Wall
> -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1-o objects/map.o map.c
> map.c: In function ‘do_map’:
> map.c:842:58: error: ‘expr’ undeclared (first use in this function);
> did you mean ‘ex_z’?
>   if (map_add(map_table, abbr_table, keys, rhs, orig_rhs, expr,
>   ^~~~
>   ex_z

Ah, "expr" also depends on FEAT_EVAL, I'll fix that.

Note that it's not easy to restore a mapping exactly how it was done
before.  Watch out for anything that's not restored properly.

-- 
hundred-and-one symptoms of being an internet addict:
158. You get a tuner card so you can watch TV while surfing.

 /// 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202005221140.04MBe1jE022915%40masaka.moolenaar.net.


Patch 8.2.0808

2020-05-22 Fir de Conversatie Bram Moolenaar


Patch 8.2.0808
Problem:Not enough testing for the terminal window.
Solution:   Add more tests. (Yegappan Lakshmanan, closes #6069)  Fix memory
leak.
Files:  src/testdir/test_gui.vim, src/testdir/test_terminal.vim,
src/terminal.c


*** ../vim-8.2.0807/src/testdir/test_gui.vim2020-05-15 22:46:40.759917714 
+0200
--- src/testdir/test_gui.vim2020-05-22 13:26:35.22857 +0200
***
*** 850,857 
  " assume all the other systems have a cat command
  let cmd = 'cat'
endif
!   let cmd = ':silent !' . cmd . " test_gui.vim\\"
!   call feedkeys(cmd, 'xt')
" TODO: how to check that the command ran in a separate terminal?
" Maybe check for $TERM (dumb vs xterm) in the spawned shell?
let  = save_guioptions
--- 850,856 
  " assume all the other systems have a cat command
  let cmd = 'cat'
endif
!   exe "silent !" . cmd . " test_gui.vim"
" TODO: how to check that the command ran in a separate terminal?
" Maybe check for $TERM (dumb vs xterm) in the spawned shell?
let  = save_guioptions
*** ../vim-8.2.0807/src/testdir/test_terminal.vim   2020-05-21 
20:38:28.039879979 +0200
--- src/testdir/test_terminal.vim   2020-05-22 13:26:35.22857 +0200
***
*** 1220,1225 
--- 1220,1226 
call delete('Xtest.dump')
call assert_fails("call term_dumpwrite(buf, '')", 'E482:')
call assert_fails("call term_dumpwrite(buf, test_null_string())", 'E482:')
+   call test_garbagecollect_now()
call StopVimInTerminal(buf)
call term_wait(buf)
call assert_fails("call term_dumpwrite(buf, 'Xtest.dump')", 'E958:')
***
*** 1305,1310 
--- 1306,1321 
call assert_match('three four five', getline(3))
call assert_match('Undo', getline(45))
quit
+ 
+   " Diff two terminal dump files with different number of rows
+   " Swap the diffs
+   call term_dumpdiff('dumps/Test_popup_command_01.dump', 
'dumps/Test_winline_rnu.dump')
+   call assert_match('Test_popup_command_01.dump', getline(21))
+   call assert_match('Test_winline_rnu.dump', getline(42))
+   normal s
+   call assert_match('Test_winline_rnu.dump', getline(6))
+   call assert_match('Test_popup_command_01.dump', getline(27))
+   quit
  endfunc
  
  func Test_terminal_dumpdiff_options()
***
*** 1619,1624 
--- 1630,1636 
call assert_equal(colors, term_getansicolors(buf))
call StopShellInTerminal(buf)
call TermWait(buf)
+   call assert_equal([], term_getansicolors(buf))
  
exe buf . 'bwipe'
  endfunc
***
*** 1673,1681 
--- 1685,1695 
  
let colors[4] = 'Invalid'
call assert_fails('call term_setansicolors(buf, colors)', 'E474:')
+   call assert_fails('call term_setansicolors(buf, {})', 'E714:')
  
call StopShellInTerminal(buf)
call TermWait(buf)
+   call assert_equal(0, term_setansicolors(buf, []))
exe buf . 'bwipe'
  endfunc
  
***
*** 2029,2035 
call WaitForAssert({-> assert_equal('running,normal', term_getstatus(bnr))})
call feedkeys("A", 'xt')
call WaitForAssert({-> assert_equal('running', term_getstatus(bnr))})
!   call feedkeys("\N", 'xt')
call WaitForAssert({-> assert_equal('running,normal', term_getstatus(bnr))})
call feedkeys("I", 'xt')
call WaitForAssert({-> assert_equal('running', term_getstatus(bnr))})
--- 2043,2049 
call WaitForAssert({-> assert_equal('running,normal', term_getstatus(bnr))})
call feedkeys("A", 'xt')
call WaitForAssert({-> assert_equal('running', term_getstatus(bnr))})
!   call feedkeys("\\", 'xt')
call WaitForAssert({-> assert_equal('running,normal', term_getstatus(bnr))})
call feedkeys("I", 'xt')
call WaitForAssert({-> assert_equal('running', term_getstatus(bnr))})
***
*** 2066,2071 
--- 2080,2086 
call term_sendkeys(buf, ":set culopt=line\r")
call VerifyScreenDump(buf, 'Test_terminal_normal_3', {})
  
+   call assert_fails('call term_sendkeys(buf, [])', 'E730:')
call term_sendkeys(buf, "a:q!\:q\:q\")
call StopVimInTerminal(buf)
call delete('XtermNormal')
***
*** 2178,2194 
call StopShellInTerminal(buf)
  endfunc
  
  func Test_term_gettitle()
" term_gettitle() returns an empty string for a non-terminal buffer
" and for a non-existing buffer.
call assert_equal('', bufnr('%')->term_gettitle())
call assert_equal('', term_gettitle(bufnr('$') + 1))
  
!   if !has('title') ||  == 0 || empty(_ts)
  throw "Skipped: can't get/set title"
endif
  
!   let term = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile'])
if has('autoservername')
  call WaitForAssert({-> assert_match('^\[No Name\] - VIM\d\+$', 
term_gettitle(term)) })
  call term_sendkeys(term, ":e Xfoo\r")
--- 2193,2210 
call StopShellInTerminal(buf)
  endfunc
  
+ " Test for term_gettitle()
  func Test_term_gettitle()
" term_gettitle() returns an empty string for a non-terminal 

Re: Patch 8.2.0807

2020-05-22 Fir de Conversatie Tony Mechelynck
On Fri, May 22, 2020 at 1:11 PM Bram Moolenaar  wrote:
>
>
> Patch 8.2.0807
> Problem:Cannot easily restore a mapping.
> Solution:   Add mapset().
> Files:  runtime/doc/eval.txt, src/map.c, src/proto/map.pro, src/evalfunc.c
> src/testdir/test_maparg.vim

Missing #ifdef ? I get a fatal error in Small and Tiny, as follows:

linux-2iyu:~/.build/vim/vim-hg/src/shadow-tiny # (make || echo 'exit
status' $? ; date) 2>&1 |tee -a make.log
gcc -c -I. -Iproto -DHAVE_CONFIG_H -O2 -fno-strength-reduce -Wall
-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1-o objects/evalfunc.o
evalfunc.c
gcc -c -I. -Iproto -DHAVE_CONFIG_H -O2 -fno-strength-reduce -Wall
-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1-o objects/map.o map.c
map.c: In function ‘do_map’:
map.c:842:58: error: ‘expr’ undeclared (first use in this function);
did you mean ‘ex_z’?
  if (map_add(map_table, abbr_table, keys, rhs, orig_rhs, expr,
  ^~~~
  ex_z
map.c:842:58: note: each undeclared identifier is reported only once
for each function it appears in
make: *** [Makefile:3344: objects/map.o] Error 1
exit status 2
Fri 22 May 13:16:17 CEST 2020
linux-2iyu:~/.build/vim/vim-hg/src/shadow-tiny #



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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/CAJkCKXsT0KzT2t-yT7P%2BwEKvsakR%2BeNTqFF1ZYP2b%2BttKkOHiw%40mail.gmail.com.


Patch 8.2.0807

2020-05-22 Fir de Conversatie Bram Moolenaar


Patch 8.2.0807
Problem:Cannot easily restore a mapping.
Solution:   Add mapset().
Files:  runtime/doc/eval.txt, src/map.c, src/proto/map.pro, src/evalfunc.c
src/testdir/test_maparg.vim


*** ../vim-8.2.0806/runtime/doc/eval.txt2020-05-13 16:34:10.397723799 
+0200
--- runtime/doc/eval.txt2020-05-22 12:52:07.920142788 +0200
***
*** 2582,2587 
--- 2586,2593 
rhs of mapping {name} in mode {mode}
  mapcheck({name} [, {mode} [, {abbr}]])
String  check for mappings matching {name}
+ mapset({name}, {mode}, {abbr}, {dict}
+   nonerestore mapping from |maparg()| result
  match({expr}, {pat} [, {start} [, {count}]])
Number  position where {pat} matches in {expr}
  matchadd({group}, {pattern} [, {priority} [, {id} [, {dict}]]])
***
*** 6785,6790 
--- 6797,6803 
Can also be used as a |method|: >
mylist->map(expr2)
  
+ 
  maparg({name} [, {mode} [, {abbr} [, {dict}]]])   
*maparg()*
When {dict} is omitted or zero: Return the rhs of mapping
{name} in mode {mode}.  The returned String has special
***
*** 6835,6840 
--- 6848,6857 
  "lnum" The line number in "sid", zero if unknown.
  "nowait"   Do not wait for other, longer mappings.
 (|:map-|).
+ "simplified"
+ 
+   The dictionary can be used to restore a mapping with
+   |mapset()|.
  
The mappings local to the current buffer are checked first,
then the global mappings.
***
*** 6881,6886 
--- 6898,6915 
Can also be used as a |method|: >
GetKey()->mapcheck('n')
  
+ mapset({mode}, {abbr}, {dict})*mapset()*
+   Restore a mapping from a dictionary returned by |maparg()|.
+   {name}, {mode} and {abbr} should be the same as for the call
+   to |maparg()|.
+   {mode} is used to define the mode in which the mapping is set,
+   not the "mode" entry in {dict}.
+   Example for saving and restoring a mapping: >
+   let save_map = maparg('K', 'n', 0, 1)
+   nnoremap K somethingelse
+   ...
+   call mapset('n', 0, save_map)
+ <
  match({expr}, {pat} [, {start} [, {count}]])  *match()*
When {expr} is a |List| then this returns the index of the
first item where {pat} matches.  Each item is used as a
***
*** 7200,7210 
Returns an empty dictionary if the menu item is not found.
  
Examples: >
!   :echo maparg('Edit.Cut')
!   :echo maparg('File.Save', 'n')
  <
Can also be used as a |method|: >
!   GetMenuName()->maparg('v')
  
  
  < *min()*
--- 7233,7243 
Returns an empty dictionary if the menu item is not found.
  
Examples: >
!   :echo menu_info('Edit.Cut')
!   :echo menu_info('File.Save', 'n')
  <
Can also be used as a |method|: >
!   GetMenuName()->menu_info('v')
  
  
  < *min()*
***
*** 7757,7763 
GetExpr()->range()
  <
  
! rand([{expr}])*rand()*
Return a pseudo-random Number generated with an xoshiro128**
algorithm using seed {expr}.  The returned number is 32 bits,
also on 64 bits systems, for consistency.
--- 7790,7796 
GetExpr()->range()
  <
  
! rand([{expr}])*rand()* 
*random*
Return a pseudo-random Number generated with an xoshiro128**
algorithm using seed {expr}.  The returned number is 32 bits,
also on 64 bits systems, for consistency.
*** ../vim-8.2.0806/src/map.c   2020-04-30 22:29:36.626024141 +0200
--- src/map.c   2020-05-22 13:01:00.430155164 +0200
***
*** 204,209 
--- 204,289 
  out_flush();  // show one line at a time
  }
  
+ static int
+ map_add(
+   mapblock_T  **map_table,
+   mapblock_T  **abbr_table,
+   char_u  *keys,
+   char_u  *rhs,
+   char_u  *orig_rhs,
+   int expr,
+   int noremap,
+   int nowait,
+   int silent,
+   int mode,
+   int is_abbr,
+ #ifdef FEAT_EVAL
+   

Re: Patch 8.2.0805

2020-05-22 Fir de Conversatie Elimar Riesebieter
* Bram Moolenaar  [2020-05-21 20:39 +0200]:

> 
> Patch 8.2.0805
> Problem:Terminal key codes test fails on some systems.
> Solution:   Skip keypad 3 and 9. (Yegappan Lakshmanan, closes #6070)
> Files:  src/testdir/test_terminal.vim
> 

Thanks,

test_terminal.vim runs fine now.

Elimar
-- 
  Learned men are the cisterns of knowledge,
  not the fountainheads ;-)

-- 
-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20200522073225.5esqzmhj5baal26f%40toy.home.lxtec.de.