Patch 8.0.1587

2018-03-06 Fir de Conversatie Bram Moolenaar

Patch 8.0.1587
Problem:inserting from the clipboard doesn't work literally
Solution:   When pasting from the * or + register always assume literally.
Files:  src/ops.c, src/proto/ops.pro, src/edit.c, src/ops.c,
src/testdir/test_paste.vim


*** ../vim-8.0.1586/src/ops.c   2018-03-04 18:07:04.268592346 +0100
--- src/ops.c   2018-03-06 19:49:23.179191594 +0100
***
*** 899,915 
   *
   * If regname is 0 and writing, use register 0
   * If regname is 0 and reading, use previous register
   */
! void
  get_yank_register(int regname, int writing)
  {
  int   i;
  
  y_append = FALSE;
  if ((regname == 0 || regname == '"') && !writing && y_previous != NULL)
  {
y_current = y_previous;
!   return;
  }
  i = regname;
  if (VIM_ISDIGIT(i))
--- 899,919 
   *
   * If regname is 0 and writing, use register 0
   * If regname is 0 and reading, use previous register
+  *
+  * Return TRUE when the register should be inserted literally (selection or
+  * clipboard).
   */
! int
  get_yank_register(int regname, int writing)
  {
  int   i;
+ int   ret = FALSE;
  
  y_append = FALSE;
  if ((regname == 0 || regname == '"') && !writing && y_previous != NULL)
  {
y_current = y_previous;
!   return ret;
  }
  i = regname;
  if (VIM_ISDIGIT(i))
***
*** 926,935 
--- 930,945 
  #ifdef FEAT_CLIPBOARD
  /* When selection is not available, use register 0 instead of '*' */
  else if (clip_star.available && regname == '*')
+ {
i = STAR_REGISTER;
+   ret = TRUE;
+ }
  /* When clipboard is not available, use register 0 instead of '+' */
  else if (clip_plus.available && regname == '+')
+ {
i = PLUS_REGISTER;
+   ret = TRUE;
+ }
  #endif
  #ifdef FEAT_DND
  else if (!writing && regname == '~')
***
*** 940,945 
--- 950,956 
  y_current = &(y_regs[i]);
  if (writing)  /* remember the register we write into for do_put() */
y_previous = y_current;
+ return ret;
  }
  
  #if defined(FEAT_CLIPBOARD) || defined(PROTO)
***
*** 1387,1398 
  int
  insert_reg(
  int   regname,
! int   literally)  /* insert literally, not as if typed */
  {
  long  i;
  int   retval = OK;
  char_u*arg;
  int   allocated;
  
  /*
   * It is possible to get into an endless loop by having CTRL-R a in
--- 1398,1410 
  int
  insert_reg(
  int   regname,
! int   literally_arg)  /* insert literally, not as if typed */
  {
  long  i;
  int   retval = OK;
  char_u*arg;
  int   allocated;
+ int   literally = literally_arg;
  
  /*
   * It is possible to get into an endless loop by having CTRL-R a in
***
*** 1423,1429 
  }
  else  /* name or number register */
  {
!   get_yank_register(regname, FALSE);
if (y_current->y_array == NULL)
retval = FAIL;
else
--- 1435,1442 
  }
  else  /* name or number register */
  {
!   if (get_yank_register(regname, FALSE))
!   literally = TRUE;
if (y_current->y_array == NULL)
retval = FAIL;
else
***
*** 1580,1591 
  int
  cmdline_paste_reg(
  int regname,
! int literally,/* Insert text literally instead of "as typed" */
  int remcr)/* don't add CR characters */
  {
  long  i;
  
! get_yank_register(regname, FALSE);
  if (y_current->y_array == NULL)
return FAIL;
  
--- 1593,1606 
  int
  cmdline_paste_reg(
  int regname,
! int literally_arg,/* Insert text literally instead of "as typed" 
*/
  int remcr)/* don't add CR characters */
  {
  long  i;
+ int   literally = literally_arg;
  
! if (get_yank_register(regname, FALSE))
!   literally = TRUE;
  if (y_current->y_array == NULL)
return FAIL;
  
*** ../vim-8.0.1586/src/proto/ops.pro   2017-03-12 20:37:16.836943099 +0100
--- src/proto/ops.pro   2018-03-06 19:38:28.075289523 +0100
***
*** 11,17 
  char_u *get_expr_line(void);
  char_u *get_expr_line_src(void);
  int valid_yank_reg(int regname, int writing);
! void get_yank_register(int regname, int writing);
  int may_get_selection(int regname);
  void *get_register(int name, int copy);
  void put_register(int name, void *reg);
--- 11,17 
  char_u *get_expr_line(void);
  char_u *get_expr_line_src(void);
  int valid_yank_reg(int regname, int writing);
! int get_yank_register(int regname, int writing);
  int may_get_selection(int regname);
  void *get_register(int name, int copy);
  void put_register(int name, 

Re: pasting terminal control chars

2018-03-06 Fir de Conversatie Christian Brabandt

On Di, 06 Mär 2018, Bram Moolenaar wrote:

> 
> Christian Brabandt wrote:
> 
> > On Di, 06 Mär 2018, Bram Moolenaar wrote:
> > 
> > > I cannot reproduce this in xterm or gnome-terminal.  Using Chrome as the
> > > browser.  With normal paste the Esc is inserted as a character.  When
> > > pasting with Shift pressed the Esc is stripped.
> > 
> > I tried with xterm/xfce-terminal and firefox and could reproduce. You 
> > must select the whole text with the mouse in the browser and use 
> > Edit->Copy to use the Primary clipboard. Then in Vim in insert mode, I 
> > used + and I could see the terminal flush because of changing mode.
> > 
> > After quitting Vim, I could see on the terminal, that an external 
> > command was executed.
> 
> Strange, there appears to be a difference between using the selection
> and the clipboard.  Hmm, I think that can be fixed.
> 
> Anyway, as what was otherwise suggested, the browser should not put
> unreadable codes into the clipboard, that is the root of the problem.

Yeah, most likely. Perhaps we should put a sentence of a warning in the 
documentation.

Best,
Christian
-- 
So schlecht ein Mann auch über die Frauen denken mag, es gibt doch
keine Frau, die über diesen Gegenstand nicht noch schlechter dächte
als er.
-- Nicolas Sébastien de Chamfort

-- 
-- 
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: pasting terminal control chars

2018-03-06 Fir de Conversatie Bram Moolenaar

Christian Brabandt wrote:

> On Di, 06 Mär 2018, Bram Moolenaar wrote:
> 
> > I cannot reproduce this in xterm or gnome-terminal.  Using Chrome as the
> > browser.  With normal paste the Esc is inserted as a character.  When
> > pasting with Shift pressed the Esc is stripped.
> 
> I tried with xterm/xfce-terminal and firefox and could reproduce. You 
> must select the whole text with the mouse in the browser and use 
> Edit->Copy to use the Primary clipboard. Then in Vim in insert mode, I 
> used + and I could see the terminal flush because of changing mode.
> 
> After quitting Vim, I could see on the terminal, that an external 
> command was executed.

Strange, there appears to be a difference between using the selection
and the clipboard.  Hmm, I think that can be fixed.

Anyway, as what was otherwise suggested, the browser should not put
unreadable codes into the clipboard, that is the root of the problem.

-- 
Never under any circumstances take a sleeping pill
and a laxative on the same night.

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

2018-03-06 Fir de Conversatie John Marriott


On 05-Mar.-2018 07:36, Bram Moolenaar wrote:

John Marriott wrote:


On 05-Mar.-2018 04:08, Bram Moolenaar wrote:

Patch 8.0.1564
Problem:Too many #ifdefs.
Solution:   Graduate the +autocmd feature. Takes away 450 #ifdefs and
  increases code size of tiny Vim by only 40 Kbyte.
Files:  src/buffer.c, src/diff.c, src/edit.c, src/eval.c, src/evalfunc.c,
  src/ex_cmds.c, src/ex_cmds2.c, src/ex_docmd.c, src/ex_getln.c,
  src/fileio.c, src/getchar.c, src/globals.h, src/gui.c,
  src/if_cscope.c, src/if_xcmdsrv.c, src/main.c, src/mbyte.c,
  src/memline.c, src/menu.c, src/misc1.c, src/gui_mac.c,
  src/misc2.c, src/move.c, src/netbeans.c, src/normal.c, src/ops.c,
  src/option.c, src/option.h, src/feature.h, src/vim.h,
  src/os_amiga.c, src/os_mswin.c, src/os_unix.c, src/os_win32.c,
  src/quickfix.c, src/screen.c, src/search.c, src/spell.c,
  src/structs.h, src/syntax.c, src/tag.c, src/term.c,
  src/terminal.c, src/ui.c, src/undo.c, src/userfunc.c,
  src/version.c, src/window.c



After this patch (and still with 8.0.1566), mingw64 throws this linker
error when building a GUI (with FEAT_MBYTE on but with FEAT_MBYTE_IME
and DYNAMIC_IME off):


Yeah, this is a bit of a puzzle.  I'll make a patch, please try again
then.


Hi Bram,

Patch 1567 fixes it for me.

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


Re: pasting terminal control chars

2018-03-06 Fir de Conversatie Christian Brabandt

On Di, 06 Mär 2018, Bram Moolenaar wrote:

> I cannot reproduce this in xterm or gnome-terminal.  Using Chrome as the
> browser.  With normal paste the Esc is inserted as a character.  When
> pasting with Shift pressed the Esc is stripped.

I tried with xterm/xfce-terminal and firefox and could reproduce. You 
must select the whole text with the mouse in the browser and use 
Edit->Copy to use the Primary clipboard. Then in Vim in insert mode, I 
used + and I could see the terminal flush because of changing mode.

After quitting Vim, I could see on the terminal, that an external 
command was executed.

Best,
Christian
-- 
Wenn zwei Menschen immer die gleichen Ansichten haben,
ist einer von ihnen überflüssig.

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

2018-03-06 Fir de Conversatie Bram Moolenaar

Patch 8.0.1586
Problem:Imactivatefunc does not work on non-GUI Mac.
Solution:   Fix logic in #ifdef.
Files:  src/vim.h


*** ../vim-8.0.1585/src/vim.h   2018-03-06 16:11:42.910436897 +0100
--- src/vim.h   2018-03-06 18:57:39.682362477 +0100
***
*** 2121,2128 
  # if defined(FEAT_MBYTE) && defined(FEAT_EVAL) \
&& (!defined(FEAT_GUI_W32) \
 || !(defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME))) \
!   && !defined(FEAT_GUI_MAC) \
!   && !defined(MACOS_CONVERT)
  /* Whether IME is supported by im_get_status() defined in mbyte.c.
   * For Win32 GUI it's in gui_w32.c when FEAT_MBYTE_IME or GLOBAL_IME is 
defined.
   * for Mac it is in gui_mac.c for the GUI or in os_mac_conv.c when
--- 2121,2127 
  # if defined(FEAT_MBYTE) && defined(FEAT_EVAL) \
&& (!defined(FEAT_GUI_W32) \
 || !(defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME))) \
!   && !(defined(FEAT_GUI_MAC) && defined(MACOS_CONVERT))
  /* Whether IME is supported by im_get_status() defined in mbyte.c.
   * For Win32 GUI it's in gui_w32.c when FEAT_MBYTE_IME or GLOBAL_IME is 
defined.
   * for Mac it is in gui_mac.c for the GUI or in os_mac_conv.c when
*** ../vim-8.0.1585/src/version.c   2018-03-06 18:19:58.984041839 +0100
--- src/version.c   2018-03-06 18:59:11.657801282 +0100
***
*** 768,769 
--- 768,771 
  {   /* Add new patch number below this line */
+ /**/
+ 1586,
  /**/

-- 
ALL:   A witch!  A witch!
WITCH: It's a fair cop.
ALL:   Burn her!  Burn her!  Let's make her into a ladder.
 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

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

2018-03-06 Fir de Conversatie Bram Moolenaar

Patch 8.0.1585
Problem:Enabling beval_term feature in Win32 GUI.
Solution:   Only enable beval_term in Win32 console.
Files:  src/feature.h


*** ../vim-8.0.1584/src/feature.h   2018-03-06 17:09:14.789600220 +0100
--- src/feature.h   2018-03-06 18:18:05.452727704 +0100
***
*** 1318,1324 
  /*
   * +balloon_eval_term Allow balloon expression evaluation in the terminal.
   */
! #if defined(FEAT_HUGE) && (defined(UNIX) || defined(WIN32)) && 
defined(FEAT_TIMERS)
  # define FEAT_BEVAL_TERM
  #endif
  
--- 1318,1325 
  /*
   * +balloon_eval_term Allow balloon expression evaluation in the terminal.
   */
! #if defined(FEAT_HUGE) && defined(FEAT_TIMERS) && \
!   (defined(UNIX) || (defined(WIN32) && !defined(FEAT_GUI_W32)))
  # define FEAT_BEVAL_TERM
  #endif
  
*** ../vim-8.0.1584/src/version.c   2018-03-06 17:54:56.929085292 +0100
--- src/version.c   2018-03-06 18:18:54.796429599 +0100
***
*** 768,769 
--- 768,771 
  {   /* Add new patch number below this line */
+ /**/
+ 1585,
  /**/

-- 
BEDEVERE:Why do you think she is a witch?
SECOND VILLAGER: She turned me into a newt.
BEDEVERE:A newt?
SECOND VILLAGER: (After looking at himself for some time) I got better.
 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

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

2018-03-06 Fir de Conversatie Bram Moolenaar

Patch 8.0.1584
Problem:Using C99 in Mac file gives compiler warning messages.
Solution:   Add #prama's to avoid the warnings. (Kazunobu Kuriyama)
Files:  src/os_macosx.m


*** ../vim-8.0.1583/src/os_macosx.m 2017-11-18 23:09:30.442768859 +0100
--- src/os_macosx.m 2018-03-06 17:53:40.381546052 +0100
***
*** 11,16 
--- 11,24 
   * os_macosx.m -- Mac specific things for Mac OS X.
   */
  
+ /* Suppress compiler warnings to non-C89 code. */
+ #if defined(__clang__) && defined(__STRICT_ANSI__)
+ # pragma clang diagnostic push
+ # pragma clang diagnostic ignored "-Wc99-extensions"
+ # pragma clang diagnostic push
+ # pragma clang diagnostic ignored "-Wdeclaration-after-statement"
+ #endif
+ 
  /* Avoid a conflict for the definition of Boolean between Mac header files and
   * X11 header files. */
  #define NO_X11_INCLUDES
***
*** 189,191 
--- 197,205 
  }
  
  #endif /* FEAT_CLIPBOARD */
+ 
+ /* Lift the compiler warning suppression. */
+ #if defined(__clang__) && defined(__STRICT_ANSI__)
+ # pragma clang diagnostic pop
+ # pragma clang diagnostic pop
+ #endif
*** ../vim-8.0.1583/src/version.c   2018-03-06 17:43:18.589288912 +0100
--- src/version.c   2018-03-06 17:53:29.145613684 +0100
***
*** 768,769 
--- 768,771 
  {   /* Add new patch number below this line */
+ /**/
+ 1584,
  /**/

-- 
CRONE:  Who sent you?
ARTHUR: The Knights Who Say GNU!
CRONE:  Aaaagh!  (she looks around in rear) No!  We have no licenses here.
   "Monty Python and the Holy editor wars" PYTHON (MONTY) SOFTWARE LTD

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

2018-03-06 Fir de Conversatie Bram Moolenaar

Wei Zhang wrote:

I added the terminal popup menu as just a simple way to select an
action.  Mainly for the terminal debugger.  I don't really want to spend
a lot of time on improving it.

> > > And on last thing, special character '&' can not be used in the TUI popup,
> > 
> > Yeah, it's hard to find a way to highlight it.  And then how do you type
> > the character?  Mappings may get in the way.  Alt key may not always
> > work.
> >  
> 
> It is not necessary to highlight special character, they can be distinguished 
> by parentheses.
> 
> :amenu PopUp.Cscope\ (&D)efinition  ...
> :amenu PopUp.Cscope\ (&S)ymbol   ...
> :amenu PopUp.Cscope\ (&C)allee   ...
> :amenu PopUp.Cscope\ (&A)ssigned   ...
> 
> They should look like:
> 
> Cscope (D)efinition
> Cscope (S)ymbol
> Cscope (C)allee
> Cscope (A)ssigned
> 
> or items can also be arranged by user like:
> 
> [D]  Cscope Definition
> [S]  Cscope Symbol
> [C]  Cscope Callee
> [A]  Cscope Assigned
> 
> Both of them are quite acceptable, just like some traditional mono
> color TUI tools .
> 
> So, highlighting is not necessary if it requires a lot of work.

It does require defining a menu specifically for the terminal, or the
same menu entry with different string to display in the GUI or in a
terminal.  This makes it more complex.

> What might be necessary is making GVim's ':popup' command display the
> TUI's text based popup menu instead of the native win32's popup menu
> (or a guioption for this ?).
> 
> Can I explain this a little ?
> 
> 1. GUI popup is only available for Win32 and GTK, but text based popup
> can run every where.

Only when the mouse is supported.  And it only works properly when mouse
dragging is supported.  Preferably also mouse movements (just made that
work for Win32).  Mouse support is not trivial, see term.c for all the
code for different mouse implementations.

> 2. Part of vim users use CTRL+[ as ESC, text based popup can be closed by 
> CTRL+[ while native GUI popup can't.
> 3. Native GUI ":popup" command sometimes behave in a strange way (also 
> mentioned in gui.txt) and different from TUI's popup menu.
> 
> Here is an example:
> 
> --- menutest.vim 
> silent! aunmenu ]test.*
> 
> let g:selected_index=-1
> 
> amenu  ]test.item\ 1  :let g:selected_index=1
> amenu  ]test.item\ 2  :let g:selected_index=2
> amenu  ]test.item\ 3  :let g:selected_index=3
> amenu  ]test.item\ 4  :let g:selected_index=4
> amenu  ]test.item\ 5  :let g:selected_index=5
> amenu  ]test.item\ 6  :let g:selected_index=6
> 
> function! MenuInputList()
> let g:selected_index=-1
> popup ]test
> echo "selected: ".g:selected_index
> return g:selected_index
> endfunc
> 
> -
> When MenuInputList() happens in TUI vim, you can see `g:selected_index` has 
> been changed after ":popup" command, it is definitely the right way.
> 
> But it is a different result in GVim, no matter what item is selected, the 
> echo command below will always print "selected: -1". After my investigation, 
> ":popup" command returns before actually executing the real menu command "let 
> g:selected_index=?". It seems that the real menu command has been queued in 
> win32 message buffer and will not be execute before ':popup' exits.
> 
> So, the echo command displays the unchanged g:selected_index in GVim.
> 
> But when I was trying the TUI's ":popup" command in the latest vim, it worked 
> great !! menu command (let g:selected_index=?) can be executed **BEFORE** 
> ":popup" command returns.
> 
> Executing menu command **BEFORE** ":popup" exiting is important because 
> following commands can get the result of selected item. if not, every 
> following command in the same function behave in the wrong way.
> 
> So, do you think it is necessary to execute menu command before ":popup" 
> returning ? or to replace GVim's ":popup" menu with the TUI's text based one ?

No, in the GUI you can't block on making a selection in the menu.  The
event loop must be processed.  At least it can't be done without a lot
of work.

You can use some kind of loop to check if the user made a selection.
Main problem is that you don't know when the user closed the menu
without making a selection.

-- 
This computer is so slow, it takes forever to execute and endless loop!

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

Patch 8.0.1583

2018-03-06 Fir de Conversatie Bram Moolenaar

Patch 8.0.1583
Problem:Using C99 comment.
Solution:   Use old style comment. (Kazunobu Kuriyama)
Files:  src/quickfix.c


*** ../vim-8.0.1582/src/quickfix.c  2018-03-05 12:42:38.390154116 +0100
--- src/quickfix.c  2018-03-06 17:39:31.886653602 +0100
***
*** 4099,4105 
  win_T *wp = NULL;
  qf_info_T *qi = &ql_info;
  char_u*au_name = NULL;
! int   save_qfid = 0;  // init for gcc
  int   res;
  
  switch (eap->cmdidx)
--- 4099,4105 
  win_T *wp = NULL;
  qf_info_T *qi = &ql_info;
  char_u*au_name = NULL;
! int   save_qfid = 0;  /* init for gcc */
  int   res;
  
  switch (eap->cmdidx)
*** ../vim-8.0.1582/src/version.c   2018-03-06 17:09:14.789600220 +0100
--- src/version.c   2018-03-06 17:41:25.241971228 +0100
***
*** 768,769 
--- 768,771 
  {   /* Add new patch number below this line */
+ /**/
+ 1583,
  /**/

-- 
It is too bad that the speed of light hasn't kept pace with the
changes in CPU speed and network bandwidth. -- 

 /// 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: pasting terminal control chars

2018-03-06 Fir de Conversatie Bram Moolenaar

Christian Brabandt wrote:

> Bram,
> There was a problem about pasting special terminal chars reported at
> http://seclists.org/oss-sec/2018/q1/213
> 
> Initially I thought that bracketed-paste mode will prevent such things, 
> but it seems this still works. Is there anything Vim can do to prevent 
> such things (at least when pasting in bracketed paste mode)?
> 
> Here is a copy of the beginning of the message (until the Vim poc):
> 
>  http://seclists.org/oss-sec/2018/q1/213 
> Hello,
> 
> When pasting characters into several terminal emulators, control
> characters are allowed. This turns to be a security problem, due to the
> fact that when pasting these characters into terminal text editors, such
> as vi/vim, emacs, nano, etc., remote code execution is possible.
> 
> This is supposed to be fixed in recent versions of VTE [3], which means
> VTE-based terminal emulators should be safe, but the problem is that
> most distros are shipping older versions and remain vulnerable.
> 
> Here's a list of terminal emulators I tested this where it worked. Some
> came by default in my distro (debian), others were installed via
> apt-get. This should also work on other distros:
> 
> 
> LXTerminal
> rxvt
> urxvt
> putty
> gnome-terminal
> Konsole
> Guake
> Yakuake
> tilda
> Terminator
> xfce4-terminal
> Terminology
> ROXTerm
> sakura
> lilyterm
> Eterm
> aterm
> mrxvt
> pterm
> 
> 
> Please, update VTE and check if the below still works. For the others
> that aren't based on VTE, CVEs should be assigned to each of them. Can
> someone help me figure out which ones are based on VTE and those that
> aren't?
> 
> To reproduce using vi/vim, create an html with the following command:
> 
> $ printf 'something;:!ida' > poc.html
> 
> Open the poc.html in a browser, select and copy the text that is
> presented, and paste it into vi/vim in insert mode. The command "id"
> should then be executed.
> 
> 
> This works because pasting "" is allowed, wich is the "escape". By
> pressing "escape" in insert mode, it is possible to go back to default
> mode, and by using the exclamation mark (!) it is possible to execute
> arbitrary commands.
> 
> [...]
> 

I cannot reproduce this in xterm or gnome-terminal.  Using Chrome as the
browser.  With normal paste the Esc is inserted as a character.  When
pasting with Shift pressed the Esc is stripped.

-- 
   A village.  Sound of chanting of Latin canon, punctuated by short, sharp
   cracks.  It comes nearer.  We see it is a line of MONKS ala SEVENTH SEAL
   flagellation scene, chanting and banging themselves on the foreheads with
   wooden boards.
 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

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

2018-03-06 Fir de Conversatie Bram Moolenaar

Kazunobu Kuriyama wrote:

> 2018-03-05 20:43 GMT+09:00 Bram Moolenaar :
> 
> >
> > Patch 8.0.1569
> > Problem:Warning for uninitialized variable from gcc.
> > Solution:   Initialize the variable.
> > Files:  src/quickfix.c
> >
> >
> > *** ../vim-8.0.1568/src/quickfix.c  2018-03-04 18:07:04.276592296
> > +0100
> > --- src/quickfix.c  2018-03-05 12:41:09.402675093 +0100
> > ***
> > *** 4099,4105 
> >   win_T *wp = NULL;
> >   qf_info_T *qi = &ql_info;
> >   char_u*au_name = NULL;
> > ! int   save_qfid;
> >   int   res;
> >
> >   switch (eap->cmdidx)
> > --- 4099,4105 
> >   win_T *wp = NULL;
> >   qf_info_T *qi = &ql_info;
> >   char_u*au_name = NULL;
> > ! int   save_qfid = 0;  // init for gcc
> >   int   res;
> >
> >   switch (eap->cmdidx)
> > *** ../vim-8.0.1568/src/version.c   2018-03-05 10:54:49.416071960 +0100
> > --- src/version.c   2018-03-05 12:41:53.838414951 +0100
> > ***
> > *** 768,769 
> > --- 768,771 
> >   {   /* Add new patch number below this line */
> > + /**/
> > + 1569,
> >   /**/
> >
> 
> According to :h style-compiler, // comments are not permitted in favor of
> C89.

My mistake, thanks for noticing.

> In conjunction with that, os_macosx.m doesn't conform to C89, either.
> Although it could be possible to make it meet C89, there've been good
> reasons not to do so (Just like C++, it preferable for Objective-C to defer
> variable/object declarations until they are actually used and initialize
> variables/objects thoroughly when they are declared).  Personally, I think
> it's better to keep it as-is and rather permit it not to conform to C89.
> For that, suppressing compiler warnings issued when the file is compiled
> with -ansi, -std=c89, -std=c90 or __STRICT_ANSI__,  is a good way to make
> the intention clear.
> 
> The attached patch addresses those two different, yet closely related,
> issues.

I'll include this too, thanks.

-- 
FIRST VILLAGER: We have found a witch.  May we burn her?
 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

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

2018-03-06 Fir de Conversatie Wei Zhang
> Executing menu command **BEFORE** ":popup" exiting is important because 
> following commands can get the result of selected item. if not, every 
> following command in the same function behave in the wrong way.


Once, I was trying to call ":popup" in an imap  .. function because I 
need a popup menu in insert mode which contains some items like:

- Insert &Date
- Insert &Time
- Insert &Comment block
- -
- Insert Emoji &Smile
- Insert Emoji &Wrench
.

Each menu item will just set a global variable to a given number, and commands 
after ":popup" will know what item has been selected and do some complex work. 

This will help me a lot without leaving insert mode. 

But it is impossible to get the result after ":popup" . So, I have no idea 
about what to return in my imap  function.

Most vim users are using UltiSnip, to many snip keywords to be remember and 
they are easy to be forgotten. UltiSnip uses inputlist() to enable user choose 
snippets if they have no idea about what snippets they can input.

But selecting snippets in insert mode with inputlist() is awful, A popup window 
in insert mode can emulate inputlist() and let user choose the most often used 
snippets. 

More friendly to inputlist(), but it is impossible to do such thing in GVim, 
because the following command can't get the result of ":popup" command.

--
Popup menus are friendly to new users, an enhanced popup menu is also very 
helpful to men with bad memory like me. I always forget some keymaps if I don't 
use them for two weeks.

Every time I read "index.txt" I can learn something new and very helpful, then 
I want put them in a popup menu and when I share my .vimrc to someone who 
haven't read this they can use this menu to discover what they can do 
immediately.

Do you think the these cases above can be a good reason to enhance popup menu 
and replace GVim's ":popup" with terminal vim's ":popup" ? or to have an new 
guioption to disable native Win32 popup window ??

-- 
-- 
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: pasting terminal control chars

2018-03-06 Fir de Conversatie James McCoy
On Tue, Mar 6, 2018, 10:50 Christian Brabandt  wrote:

> Bram,
> There was a problem about pasting special terminal chars reported at
> http://seclists.org/oss-sec/2018/q1/213
>
> Initially I thought that bracketed-paste mode will prevent such things,
> but it seems this still works. Is there anything Vim can do to prevent
> such things (at least when pasting in bracketed paste mode)?
>

This reminded me of a similar bug I had seen reported in Debian against
rxvt-unicode ~3 years ago.  Upstream's response[0] seems fairly accurate
IMO.

[0]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=787628#15

The browser shouldn't be copying data the user can't see, rather than
making the terminal second guess what the user is pasting.

Cheers,
James

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

2018-03-06 Fir de Conversatie Bram Moolenaar

Patch 8.0.1582
Problem:In the MS-Windows console mouse movement is not used.
Solution:   Pass mouse movement events when useful.
Files:  src/os_win32.c, src/proto/os_win32.pro, src/feature.h


*** ../vim-8.0.1581/src/os_win32.c  2018-03-04 18:07:04.276592296 +0100
--- src/os_win32.c  2018-03-06 17:05:38.730025520 +0100
***
*** 1164,1169 
--- 1164,1181 
  SetConsoleMode(g_hConIn, cmodein);
  }
  
+ 
+ #if defined(FEAT_BEVAL_TERM) || defined(PROTO)
+ /*
+  * Called when 'balloonevalterm' changed.
+  */
+ void
+ mch_bevalterm_changed(void)
+ {
+ mch_setmouse(g_fMouseActive);
+ }
+ #endif
+ 
  /*
   * Decode a MOUSE_EVENT.  If it's a valid event, return MOUSE_LEFT,
   * MOUSE_MIDDLE, or MOUSE_RIGHT for a click; MOUSE_DRAG for a mouse
***
*** 1243,1249 
  
  if (pmer->dwEventFlags == MOUSE_MOVED)
  {
!   /* ignore MOUSE_MOVED events if (x, y) hasn't changed.  (We get these
 * events even when the mouse moves only within a char cell.) */
if (s_xOldMouse == g_xMouse && s_yOldMouse == g_yMouse)
return FALSE;
--- 1255,1261 
  
  if (pmer->dwEventFlags == MOUSE_MOVED)
  {
!   /* Ignore MOUSE_MOVED events if (x, y) hasn't changed.  (We get these
 * events even when the mouse moves only within a char cell.) */
if (s_xOldMouse == g_xMouse && s_yOldMouse == g_yMouse)
return FALSE;
***
*** 1252,1262 
  /* If no buttons are pressed... */
  if ((pmer->dwButtonState & ((1 << cButtons) - 1)) == 0)
  {
/* If the last thing returned was MOUSE_RELEASE, ignore this */
if (s_fReleased)
!   return FALSE;
  
-   nButton = MOUSE_RELEASE;
s_fReleased = TRUE;
  }
  else/* one or more buttons pressed */
--- 1264,1283 
  /* If no buttons are pressed... */
  if ((pmer->dwButtonState & ((1 << cButtons) - 1)) == 0)
  {
+   nButton = MOUSE_RELEASE;
+ 
/* If the last thing returned was MOUSE_RELEASE, ignore this */
if (s_fReleased)
!   {
! #ifdef FEAT_BEVAL_TERM
!   /* do return mouse move events when we want them */
!   if (p_bevalterm)
!   nButton = MOUSE_DRAG;
!   else
! #endif
!   return FALSE;
!   }
  
s_fReleased = TRUE;
  }
  else/* one or more buttons pressed */
*** ../vim-8.0.1581/src/proto/os_win32.pro  2018-02-22 21:06:44.558819084 
+0100
--- src/proto/os_win32.pro  2018-03-06 15:54:19.952723508 +0100
***
*** 6,11 
--- 6,12 
  void dyn_libintl_end(void);
  void PlatformId(void);
  void mch_setmouse(int on);
+ void mch_bevalterm_changed(void);
  void mch_update_cursor(void);
  int mch_char_avail(void);
  int mch_check_messages(void);
*** ../vim-8.0.1581/src/feature.h   2018-03-06 15:06:15.314321664 +0100
--- src/feature.h   2018-03-06 15:03:02.503485392 +0100
***
*** 1318,1324 
  /*
   * +balloon_eval_term Allow balloon expression evaluation in the terminal.
   */
! #if defined(FEAT_HUGE) && defined(UNIX) && defined(FEAT_TIMERS)
  # define FEAT_BEVAL_TERM
  #endif
  
--- 1318,1324 
  /*
   * +balloon_eval_term Allow balloon expression evaluation in the terminal.
   */
! #if defined(FEAT_HUGE) && (defined(UNIX) || defined(WIN32)) && 
defined(FEAT_TIMERS)
  # define FEAT_BEVAL_TERM
  #endif
  
*** ../vim-8.0.1581/src/version.c   2018-03-06 16:11:42.910436897 +0100
--- src/version.c   2018-03-06 17:08:28.993876466 +0100
***
*** 768,769 
--- 768,771 
  {   /* Add new patch number below this line */
+ /**/
+ 1582,
  /**/

-- 
Hacker: Someone skilled in computer programming (good guy).
Cracker: A hacker that uses his skills to crack software (bad guy).

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


pasting terminal control chars

2018-03-06 Fir de Conversatie Christian Brabandt
Bram,
There was a problem about pasting special terminal chars reported at
http://seclists.org/oss-sec/2018/q1/213

Initially I thought that bracketed-paste mode will prevent such things, 
but it seems this still works. Is there anything Vim can do to prevent 
such things (at least when pasting in bracketed paste mode)?

Here is a copy of the beginning of the message (until the Vim poc):

 http://seclists.org/oss-sec/2018/q1/213 
Hello,

When pasting characters into several terminal emulators, control
characters are allowed. This turns to be a security problem, due to the
fact that when pasting these characters into terminal text editors, such
as vi/vim, emacs, nano, etc., remote code execution is possible.

This is supposed to be fixed in recent versions of VTE [3], which means
VTE-based terminal emulators should be safe, but the problem is that
most distros are shipping older versions and remain vulnerable.

Here's a list of terminal emulators I tested this where it worked. Some
came by default in my distro (debian), others were installed via
apt-get. This should also work on other distros:


LXTerminal
rxvt
urxvt
putty
gnome-terminal
Konsole
Guake
Yakuake
tilda
Terminator
xfce4-terminal
Terminology
ROXTerm
sakura
lilyterm
Eterm
aterm
mrxvt
pterm


Please, update VTE and check if the below still works. For the others
that aren't based on VTE, CVEs should be assigned to each of them. Can
someone help me figure out which ones are based on VTE and those that
aren't?

To reproduce using vi/vim, create an html with the following command:

$ printf 'something;:!ida' > poc.html

Open the poc.html in a browser, select and copy the text that is
presented, and paste it into vi/vim in insert mode. The command "id"
should then be executed.


This works because pasting "" is allowed, wich is the "escape". By
pressing "escape" in insert mode, it is possible to go back to default
mode, and by using the exclamation mark (!) it is possible to execute
arbitrary commands.

[...]



Best,
Christian

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

2018-03-06 Fir de Conversatie Bram Moolenaar

Patch 8.0.1581
Problem:Cannot build Win32 GUI without +eval.
Solution:   Define HAVE_INPUT_METHOD without +eval. (Ken Takata)
Files:  src/vim.h


*** ../vim-8.0.1580/src/vim.h   2018-03-04 21:35:54.952059810 +0100
--- src/vim.h   2018-03-06 16:09:21.623289435 +0100
***
*** 2119,2133 
  #endif
  
  # if defined(FEAT_MBYTE) && defined(FEAT_EVAL) \
!   && ((!defined(FEAT_GUI_W32) \
 || !(defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME))) \
!|| (defined(MACOS_CONVERT) && !defined(FEAT_GUI_MAC)))
! /* Whether IME is supported by im_get_status() defined in mbyte.c. */
  # define IME_WITHOUT_XIM
  #endif
  
  #if defined(FEAT_MBYTE) && (defined(FEAT_XIM) \
|| defined(IME_WITHOUT_XIM) \
|| defined(FEAT_GUI_MAC))
  /* im_set_active() is available */
  # define HAVE_INPUT_METHOD
--- 2119,2139 
  #endif
  
  # if defined(FEAT_MBYTE) && defined(FEAT_EVAL) \
!   && (!defined(FEAT_GUI_W32) \
 || !(defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME))) \
!   && !defined(FEAT_GUI_MAC) \
!   && !defined(MACOS_CONVERT)
! /* Whether IME is supported by im_get_status() defined in mbyte.c.
!  * For Win32 GUI it's in gui_w32.c when FEAT_MBYTE_IME or GLOBAL_IME is 
defined.
!  * for Mac it is in gui_mac.c for the GUI or in os_mac_conv.c when
!  * MACOS_CONVERT is defined. */
  # define IME_WITHOUT_XIM
  #endif
  
  #if defined(FEAT_MBYTE) && (defined(FEAT_XIM) \
|| defined(IME_WITHOUT_XIM) \
+   || (defined(FEAT_GUI_W32) \
+   && (defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME))) \
|| defined(FEAT_GUI_MAC))
  /* im_set_active() is available */
  # define HAVE_INPUT_METHOD
*** ../vim-8.0.1580/src/version.c   2018-03-06 15:06:15.314321664 +0100
--- src/version.c   2018-03-06 16:01:18.498200752 +0100
***
*** 768,769 
--- 768,771 
  {   /* Add new patch number below this line */
+ /**/
+ 1581,
  /**/

-- 
|

Ceci n'est pas une pipe.

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

2018-03-06 Fir de Conversatie Wei Zhang
> > And on last thing, special character '&' can not be used in the TUI popup,
> 
> Yeah, it's hard to find a way to highlight it.  And then how do you type
> the character?  Mappings may get in the way.  Alt key may not always
> work.
>  

It is not necessary to highlight special character, they can be distinguished 
by parentheses.

:amenu PopUp.Cscope\ (&D)efinition  ...
:amenu PopUp.Cscope\ (&S)ymbol   ...
:amenu PopUp.Cscope\ (&C)allee   ...
:amenu PopUp.Cscope\ (&A)ssigned   ...

They should look like:

Cscope (D)efinition
Cscope (S)ymbol
Cscope (C)allee
Cscope (A)ssigned

or items can also be arranged by user like:

[D]  Cscope Definition
[S]  Cscope Symbol
[C]  Cscope Callee
[A]  Cscope Assigned

Both of them are quite acceptable, just like some traditional mono color TUI 
tools .

So, highlighting is not necessary if it requires a lot of work.

What might be necessary is making GVim's ':popup' command display the TUI's 
text based popup menu instead of the native win32's popup menu (or a guioption 
for this ?).

Can I explain this a little ?

1. GUI popup is only available for Win32 and GTK, but text based popup can run 
every where.
2. Part of vim users use CTRL+[ as ESC, text based popup can be closed by 
CTRL+[ while native GUI popup can't.
3. Native GUI ":popup" command sometimes behave in a strange way (also 
mentioned in gui.txt) and different from TUI's popup menu.

Here is an example:

--- menutest.vim 
silent! aunmenu ]test.*

let g:selected_index=-1

amenu  ]test.item\ 1  :let g:selected_index=1
amenu  ]test.item\ 2  :let g:selected_index=2
amenu  ]test.item\ 3  :let g:selected_index=3
amenu  ]test.item\ 4  :let g:selected_index=4
amenu  ]test.item\ 5  :let g:selected_index=5
amenu  ]test.item\ 6  :let g:selected_index=6

function! MenuInputList()
let g:selected_index=-1
popup ]test
echo "selected: ".g:selected_index
return g:selected_index
endfunc

-
When MenuInputList() happens in TUI vim, you can see `g:selected_index` has 
been changed after ":popup" command, it is definitely the right way.

But it is a different result in GVim, no matter what item is selected, the echo 
command below will always print "selected: -1". After my investigation, 
":popup" command returns before actually executing the real menu command "let 
g:selected_index=?". It seems that the real menu command has been queued in 
win32 message buffer and will not be execute before ':popup' exits.

So, the echo command displays the unchanged g:selected_index in GVim.

But when I was trying the TUI's ":popup" command in the latest vim, it worked 
great !! menu command (let g:selected_index=?) can be executed **BEFORE** 
":popup" command returns.

Executing menu command **BEFORE** ":popup" exiting is important because 
following commands can get the result of selected item. if not, every following 
command in the same function behave in the wrong way.

So, do you think it is necessary to execute menu command before ":popup" 
returning ? or to replace GVim's ":popup" menu with the TUI's text based one ?

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

2018-03-06 Fir de Conversatie Kazunobu Kuriyama
2018-03-05 20:43 GMT+09:00 Bram Moolenaar :

>
> Patch 8.0.1569
> Problem:Warning for uninitialized variable from gcc.
> Solution:   Initialize the variable.
> Files:  src/quickfix.c
>
>
> *** ../vim-8.0.1568/src/quickfix.c  2018-03-04 18:07:04.276592296
> +0100
> --- src/quickfix.c  2018-03-05 12:41:09.402675093 +0100
> ***
> *** 4099,4105 
>   win_T *wp = NULL;
>   qf_info_T *qi = &ql_info;
>   char_u*au_name = NULL;
> ! int   save_qfid;
>   int   res;
>
>   switch (eap->cmdidx)
> --- 4099,4105 
>   win_T *wp = NULL;
>   qf_info_T *qi = &ql_info;
>   char_u*au_name = NULL;
> ! int   save_qfid = 0;  // init for gcc
>   int   res;
>
>   switch (eap->cmdidx)
> *** ../vim-8.0.1568/src/version.c   2018-03-05 10:54:49.416071960 +0100
> --- src/version.c   2018-03-05 12:41:53.838414951 +0100
> ***
> *** 768,769 
> --- 768,771 
>   {   /* Add new patch number below this line */
> + /**/
> + 1569,
>   /**/
>

According to :h style-compiler, // comments are not permitted in favor of
C89.

In conjunction with that, os_macosx.m doesn't conform to C89, either.
Although it could be possible to make it meet C89, there've been good
reasons not to do so (Just like C++, it preferable for Objective-C to defer
variable/object declarations until they are actually used and initialize
variables/objects thoroughly when they are declared).  Personally, I think
it's better to keep it as-is and rather permit it not to conform to C89.
For that, suppressing compiler warnings issued when the file is compiled
with -ansi, -std=c89, -std=c90 or __STRICT_ANSI__,  is a good way to make
the intention clear.

The attached patch addresses those two different, yet closely related,
issues.

Best regards,
Kazunobu Kuriyama


> --
> Why I like vim:
> > I like VIM because, when I ask a question in this newsgroup, I get a
> > one-line answer.  With xemacs, I get a 1Kb lisp script with bugs in it
> ;-)
>
>  /// 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.
>

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


c89-compliance.diff
Description: Binary data


Patch 8.0.1580

2018-03-06 Fir de Conversatie Bram Moolenaar

Patch 8.0.1580
Problem:FEAT_CURSORBIND and FEAT_SCROLLBIND are unused.
Solution:   Delete them.
Files:  src/feature.h


*** ../vim-8.0.1579/src/feature.h   2018-03-04 18:07:04.272592321 +0100
--- src/feature.h   2018-03-06 15:03:02.503485392 +0100
***
*** 696,715 
  #endif
  
  /*
-  * +scrollbindsynchronization of split windows
-  */
- #if defined(FEAT_NORMAL)
- # define FEAT_SCROLLBIND
- #endif
- 
- /*
-  * +cursorbindsynchronization of split windows
-  */
- #if defined(FEAT_NORMAL)
- # define FEAT_CURSORBIND
- #endif
- 
- /*
   * +menu  ":menu" command
   */
  #ifdef FEAT_NORMAL
--- 696,701 
*** ../vim-8.0.1579/src/version.c   2018-03-06 14:22:54.442045488 +0100
--- src/version.c   2018-03-06 15:05:12.562700342 +0100
***
*** 768,769 
--- 768,771 
  {   /* Add new patch number below this line */
+ /**/
+ 1580,
  /**/

-- 
Eye have a spelling checker, it came with my PC;
It plainly marks four my revue mistakes I cannot sea.
I've run this poem threw it, I'm sure your please to no,
It's letter perfect in it's weigh, my checker tolled me sew!

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

2018-03-06 Fir de Conversatie Bram Moolenaar

Patch 8.0.1579
Problem:Virtual replace test fails in GUI.
Solution:   Don't save key options if they were not set.
Files:  src/testdir/test_visual.vim


*** ../vim-8.0.1578/src/testdir/test_visual.vim 2018-03-06 13:17:19.793809675 
+0100
--- src/testdir/test_visual.vim 2018-03-06 14:18:55.303490584 +0100
***
*** 157,164 
  
  " Test Virtual replace mode.
  func Test_virtual_replace()
!   let save_t_kD = &t_kD
!   let save_t_kb = &t_kb
exe "set t_kD=\x7f t_kb=\x08"
enew!
exe "normal a\nabcdefghi\njk\tlmn\nopq  rst\n\uvwxyz"
--- 157,168 
  
  " Test Virtual replace mode.
  func Test_virtual_replace()
!   if exists('&t_kD')
! let save_t_kD = &t_kD
!   endif
!   if exists('&t_kb')
! let save_t_kb = &t_kb
!   endif
exe "set t_kD=\x7f t_kb=\x08"
enew!
exe "normal a\nabcdefghi\njk\tlmn\nopq  rst\n\uvwxyz"
***
*** 189,196 
  \ 'AB IJKLMNO QRst'], getline(12, 13))
enew!
set noai bs&vim
!   let &t_kD = save_t_kD
!   let &t_kb = save_t_kb
  endfunc
  
  " Test Virtual replace mode.
--- 193,204 
  \ 'AB IJKLMNO QRst'], getline(12, 13))
enew!
set noai bs&vim
!   if exists('save_t_kD')
! let &t_kD = save_t_kD
!   endif
!   if exists('save_t_kb')
! let &t_kb = save_t_kb
!   endif
  endfunc
  
  " Test Virtual replace mode.
*** ../vim-8.0.1578/src/version.c   2018-03-06 13:22:42.819870191 +0100
--- src/version.c   2018-03-06 14:21:45.758460430 +0100
***
*** 768,769 
--- 768,771 
  {   /* Add new patch number below this line */
+ /**/
+ 1579,
  /**/

-- 
"Beware of bugs in the above code; I have only proved
it correct, not tried it." -- Donald Knuth

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

2018-03-06 Fir de Conversatie Christian Brabandt

On Di, 06 Mär 2018, Bram Moolenaar wrote:

> 
> Patch 8.0.1577
> Problem:Virtual replace test fails on MS-Windows.
> Solution:   Make adding a termcap entry work for a builtin terminal.
> Restore terminal keys in a better way.
> Files:  src/term.c, src/testdir/test_visual.vim

Not much better I fear:

https://ci.appveyor.com/project/chrisbra/vim/build/5039/job/ocaha6mjuo32oa7g
,
| From test_visual.vim:
| Found errors in Test_virtual_replace():
| Caught exception in Test_virtual_replace(): Vim(let):E113: Unknown option: 
t_kD @ function RunTheTest[38]..Test_virtual_replace, line 1
| TEST FAILURE
| NMAKE : fatal error U1077: 'if' : return code '0x1'
| Stop.
| Command exited with code 2
`

Best,
Christian
-- 
Alle unsere Streitigkeiten entstehen daraus, daß einer dem anderen
seine Meinung aufzwingen will.
-- Mahatma Gandhi

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

2018-03-06 Fir de Conversatie Bram Moolenaar

Patch 8.0.1578
Problem:No test for :popup in terminal.
Solution:   Add a screen dump test.
Files:  src/testdir/test_popup.vim,
src/testdir/dumps/Test_popup_command_01.dump,
src/testdir/dumps/Test_popup_command_02.dump,
src/testdir/dumps/Test_popup_command_03.dump


*** ../vim-8.0.1577/src/testdir/test_popup.vim  2018-02-24 21:25:25.198496653 
+0100
--- src/testdir/test_popup.vim  2018-03-06 12:39:51.187360166 +0100
***
*** 786,789 
--- 786,818 
call delete('Xtest')
  endfunc
  
+ func Test_popup_command()
+   if !CanRunVimInTerminal() || !has('menu')
+ return
+   endif
+ 
+   call writefile([
+   \ 'one two three four five',
+   \ 'and one two Xthree four five',
+   \ 'one more two three four five',
+   \ ], 'Xtest')
+   let buf = RunVimInTerminal('Xtest', {})
+   call term_sendkeys(buf, ":source $VIMRUNTIME/menu.vim\")
+   call term_sendkeys(buf, "/X\:popup PopUp\")
+   call VerifyScreenDump(buf, 'Test_popup_command_01', {})
+ 
+   " Select a word
+   call term_sendkeys(buf, "jj")
+   call VerifyScreenDump(buf, 'Test_popup_command_02', {})
+ 
+   " Select a word
+   call term_sendkeys(buf, "j\")
+   call VerifyScreenDump(buf, 'Test_popup_command_03', {})
+ 
+   call term_sendkeys(buf, "\")
+   call StopVimInTerminal(buf)
+   call delete('Xtest')
+ endfunc
+ 
+ 
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.0.1577/src/testdir/dumps/Test_popup_command_01.dump
2018-03-06 13:21:48.840194219 +0100
--- src/testdir/dumps/Test_popup_command_01.dump2018-03-06 
12:37:42.848140298 +0100
***
*** 0 
--- 1,20 
+ |o+0&#ff0|n|e| |t|w|o| |t|h|r|e@1| |f|o|u|r| |f|i|v|e| @51
+ |a|n|d| |o|n|e| |t|w|o| |X|t|h|r|e@1| |f|o|u|r| |f|i|v|e| @46
+ |o|n|e| |m|o|r|e| |t|w| +0#001#ffd7ff255|U|n|d|o| @12| 
+0#000#ff0@45
+ |~+0#4040ff13&| @9| +0#001#ffd7ff255@17| +0#4040ff13#ff0@45
+ |~| @9| +0#001#ffd7ff255|P|a|s|t|e| @11| +0#4040ff13#ff0@45
+ |~| @9| +0#001#ffd7ff255@17| +0#4040ff13#ff0@45
+ |~| @9| +0#001#ffd7ff255|S|e|l|e|c|t| |W|o|r|d| @5| +0#4040ff13#ff0@45
+ |~| @9| +0#001#ffd7ff255|S|e|l|e|c|t| |S|e|n|t|e|n|c|e| @1| 
+0#4040ff13#ff0@45
+ |~| @9| +0#001#ffd7ff255|S|e|l|e|c|t| |P|a|r|a|g|r|a|p|h| | 
+0#4040ff13#ff0@45
+ |~| @9| +0#001#ffd7ff255|S|e|l|e|c|t| |L|i|n|e| @5| +0#4040ff13#ff0@45
+ |~| @9| +0#001#ffd7ff255|S|e|l|e|c|t| |B|l|o|c|k| @4| 
+0#4040ff13#ff0@45
+ |~| @9| +0#001#ffd7ff255|S|e|l|e|c|t| |A|l@1| @6| +0#4040ff13#ff0@45
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |:+0#000&|p|o|p|u|p| |P|o|p|U|p| @34|:| @8> @17
*** ../vim-8.0.1577/src/testdir/dumps/Test_popup_command_02.dump
2018-03-06 13:21:48.848194171 +0100
--- src/testdir/dumps/Test_popup_command_02.dump2018-03-06 
12:40:09.355249767 +0100
***
*** 0 
--- 1,20 
+ |o+0&#ff0|n|e| |t|w|o| |t|h|r|e@1| |f|o|u|r| |f|i|v|e| @51
+ |a|n|d| |o|n|e| |t|w|o| >X|t|h|r|e@1| |f|o|u|r| |f|i|v|e| @46
+ |o|n|e| |m|o|r|e| |t|w| +0#001#ffd7ff255|U|n|d|o| @12| 
+0#000#ff0@45
+ |~+0#4040ff13&| @9| +0#001#ffd7ff255@17| +0#4040ff13#ff0@45
+ |~| @9| +0#001#e0e0e08|P|a|s|t|e| @11| +0#4040ff13#ff0@45
+ |~| @9| +0#001#ffd7ff255@17| +0#4040ff13#ff0@45
+ |~| @9| +0#001#ffd7ff255|S|e|l|e|c|t| |W|o|r|d| @5| +0#4040ff13#ff0@45
+ |~| @9| +0#001#ffd7ff255|S|e|l|e|c|t| |S|e|n|t|e|n|c|e| @1| 
+0#4040ff13#ff0@45
+ |~| @9| +0#001#ffd7ff255|S|e|l|e|c|t| |P|a|r|a|g|r|a|p|h| | 
+0#4040ff13#ff0@45
+ |~| @9| +0#001#ffd7ff255|S|e|l|e|c|t| |L|i|n|e| @5| +0#4040ff13#ff0@45
+ |~| @9| +0#001#ffd7ff255|S|e|l|e|c|t| |B|l|o|c|k| @4| 
+0#4040ff13#ff0@45
+ |~| @9| +0#001#ffd7ff255|S|e|l|e|c|t| |A|l@1| @6| +0#4040ff13#ff0@45
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |:+0#000&|p|o|p|u|p| |P|o|p|U|p| @34|:| @8| @17
*** ../vim-8.0.1577/src/testdir/dumps/Test_popup_command_03.dump
2018-03-06 13:21:48.852194148 +0100
--- src/testdir/dumps/Test_popup_command_03.dump2018-03-06 
12:40:10.487242888 +0100
***
*** 0 
--- 1,20 
+ |o+0&#ff0|n|e| |t|w|o| |t|h|r|e@1| |f|o|u|r| |f|i|v|e| @51
+ |a|n|d| |o|n|e| |t|w|o| |X+0&#e0e0e08|t|h|r|e@1> +0&#ff0|f|o|u|r| 
|f|i|v|e| @46
+ |o|n|e| |m|o|r|e| |t|w|o| |t|h|r|e@1| |f|o|u|r| |f|i|v|e| @46
+ |~+0#4040ff13&| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |-+2#000&@1| |V|I|S|U|A|L| |-@1| +0&&@34|7| @8|2|,|1|9| @9|A|l@1| 
*** ../vim-8.0.1577/src/version.c   2018-03-06 13:17:19.793809675 +0100
--- src/version.c   2018-03-06 13:21:29.644309454 +0100
***
*** 768,769 
--- 768,771 
  {   /* Add new patch number below this line */
+ /**/
+ 1578,
  /**/

-- 
Mrs Abbott: I'm a paediatrician.
 Basil: Feet?
Mrs 

Patch 8.0.1577

2018-03-06 Fir de Conversatie Bram Moolenaar

Patch 8.0.1577
Problem:Virtual replace test fails on MS-Windows.
Solution:   Make adding a termcap entry work for a builtin terminal.
Restore terminal keys in a better way.
Files:  src/term.c, src/testdir/test_visual.vim


*** ../vim-8.0.1576/src/term.c  2018-03-05 22:43:05.523985559 +0100
--- src/term.c  2018-03-06 13:04:07.950568724 +0100
***
*** 2278,2283 
--- 2278,2284 
if (termp->bt_string != NULL)   /* found it */
{
key = TERMCAP2KEY(name[0], name[1]);
+   ++termp;
while (termp->bt_entry != (int)KS_NAME)
{
if ((int)termp->bt_entry == key)
*** ../vim-8.0.1576/src/testdir/test_visual.vim 2018-03-06 12:10:43.697795109 
+0100
--- src/testdir/test_visual.vim 2018-03-06 13:15:43.366388840 +0100
***
*** 157,162 
--- 157,164 
  
  " Test Virtual replace mode.
  func Test_virtual_replace()
+   let save_t_kD = &t_kD
+   let save_t_kb = &t_kb
exe "set t_kD=\x7f t_kb=\x08"
enew!
exe "normal a\nabcdefghi\njk\tlmn\nopq  rst\n\uvwxyz"
***
*** 186,192 
call assert_equal(['AB..CDEFGHI.Jkl',
  \ 'AB IJKLMNO QRst'], getline(12, 13))
enew!
!   set noai bs&vim t_kD&vim t_kb&vim
  endfunc
  
  " Test Virtual replace mode.
--- 188,196 
call assert_equal(['AB..CDEFGHI.Jkl',
  \ 'AB IJKLMNO QRst'], getline(12, 13))
enew!
!   set noai bs&vim
!   let &t_kD = save_t_kD
!   let &t_kb = save_t_kb
  endfunc
  
  " Test Virtual replace mode.
*** ../vim-8.0.1576/src/version.c   2018-03-06 12:25:51.780385338 +0100
--- src/version.c   2018-03-06 13:16:51.905977166 +0100
***
*** 768,769 
--- 768,771 
  {   /* Add new patch number below this line */
+ /**/
+ 1577,
  /**/

-- 
BLACK KNIGHT: I'm invincible!
ARTHUR:   You're a looney.
 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// 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] Problem with deleting linebreaks in virtual replace mode

2018-03-06 Fir de Conversatie Bram Moolenaar

Christian Brabandt wrote:

> > > On Mo, 12 Feb 2018, Bram Moolenaar wrote:
> > > > Not sure this is true.  If two lines are added after orig_line_count was
> > > > set, and one line gets deleted, then orig_line_count should not change.
> > > > If the total number of lines decreases below orig_line_count then
> > > > orig_line_count does need to be adjusted.  Hmm, something like that,
> > > > need some actual scenarios to check what really happens.
> > > 
> > > [writing more tests]
> > > 
> > > > Please do.  And please add comments to those global variables, so that
> > > > it's clear what they mean exactly (not just what they are used for).
> > > > I'm trying to do this for all these state variables (as far as I can
> > > > understand them, insert completion is another area where it's not 100%
> > > > clear).
> > > > 
> > > 
> > > It's been a bit late, but here is an updated patch, that checks that 
> > > orig_line_count is still valid in virtual replace mode and adds a couple 
> > > of more tests.
> > > 
> > > I think I addressed all of your points above.
> > 
> > Thanks!  Running the test without the change in edit.c causes a crash.
> > Nice fix.
> 
> Looks like the test broke on Windows:
> https://ci.appveyor.com/project/chrisbra/vim/build/5036/job/c6ixm79w9pcbgdeg#L1528
> ,
> | From test_visual.vim:
> | Found errors in Test_virtual_replace():
> | Caught exception in Test_virtual_replace(): Vim(set):E522: Not found in 
> termcap: t_kD&vim  @ function RunTheTest[38]..Test_virtual_replace, line 30
> | TEST FAILURE 
> | NMAKE : fatal error U1077: 'if' : return code '0x1'
> | Stop.
> | Command exited with code 2
> `
> 
> I guess t_kD should only be reset on non Windows builds then.

That should work...  Ah, turns out the code to find a builtin termcap
entry never actually worked.  It works on Unix because it uses the
external entry.

-- 
ARTHUR: What are you going to do. bleed on me?
 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// 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] Problem with deleting linebreaks in virtual replace mode

2018-03-06 Fir de Conversatie Christian Brabandt

On Di, 06 Mär 2018, Bram Moolenaar wrote:

> 
> Christian Brabandt wrote:
> 
> > On Mo, 12 Feb 2018, Bram Moolenaar wrote:
> > > Not sure this is true.  If two lines are added after orig_line_count was
> > > set, and one line gets deleted, then orig_line_count should not change.
> > > If the total number of lines decreases below orig_line_count then
> > > orig_line_count does need to be adjusted.  Hmm, something like that,
> > > need some actual scenarios to check what really happens.
> > 
> > [writing more tests]
> > 
> > > Please do.  And please add comments to those global variables, so that
> > > it's clear what they mean exactly (not just what they are used for).
> > > I'm trying to do this for all these state variables (as far as I can
> > > understand them, insert completion is another area where it's not 100%
> > > clear).
> > > 
> > 
> > It's been a bit late, but here is an updated patch, that checks that 
> > orig_line_count is still valid in virtual replace mode and adds a couple 
> > of more tests.
> > 
> > I think I addressed all of your points above.
> 
> Thanks!  Running the test without the change in edit.c causes a crash.
> Nice fix.

Looks like the test broke on Windows:
https://ci.appveyor.com/project/chrisbra/vim/build/5036/job/c6ixm79w9pcbgdeg#L1528
,
| From test_visual.vim:
| Found errors in Test_virtual_replace():
| Caught exception in Test_virtual_replace(): Vim(set):E522: Not found in 
termcap: t_kD&vim  @ function RunTheTest[38]..Test_virtual_replace, line 30
| TEST FAILURE 
| NMAKE : fatal error U1077: 'if' : return code '0x1'
| Stop.
| Command exited with code 2
`

I guess t_kD should only be reset on non Windows builds then.

Best,
Christian
-- 
Ist man in kleinen Dingen nicht geduldig, bringt man die großen
Vorhaben zum Scheitern.
-- Konfuzius (551-479 v. Chr.)

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

2018-03-06 Fir de Conversatie Bram Moolenaar

Patch 8.0.1576
Problem:Perl VIM::Buffers() does not find every buffer.
Solution:   Also find unlisted buffer by number or name. (Chris Weyl,
closes #2692)
Files:  src/if_perl.xs


*** ../vim-8.0.1575/src/if_perl.xs  2017-10-24 21:49:32.234837736 +0200
--- src/if_perl.xs  2018-03-06 12:22:50.945463780 +0100
***
*** 1558,1564 
  
pat = (char_u *)SvPV(sv, len);
++emsg_off;
!   b = buflist_findpat(pat, pat+len, FALSE, FALSE, FALSE);
--emsg_off;
}
  
--- 1558,1564 
  
pat = (char_u *)SvPV(sv, len);
++emsg_off;
!   b = buflist_findpat(pat, pat + len, TRUE, FALSE, FALSE);
--emsg_off;
}
  
*** ../vim-8.0.1575/src/version.c   2018-03-06 12:10:43.697795109 +0100
--- src/version.c   2018-03-06 12:25:34.316489486 +0100
***
*** 768,769 
--- 768,771 
  {   /* Add new patch number below this line */
+ /**/
+ 1576,
  /**/

-- 
ARTHUR:   You are indeed brave Sir knight, but the fight is mine.
BLACK KNIGHT: Had enough?
ARTHUR:   You stupid bastard.  You havn't got any arms left.
 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

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

2018-03-06 Fir de Conversatie Bram Moolenaar

Christian Brabandt wrote:

> On Fr, 02 Mär 2018, Bram Moolenaar wrote:
> 
> > 
> > Well, vim.org is down again.  We have had direct responses from
> > SourceForge, thus it's not like they don't care.  They try hard to make
> > it work, but it still doesn't.
> > 
> > I think it is time we seriously look into the alternative: moving to
> > osdn.net.  I would like to have two volunteers who take the current
> > website and make it work on OSDN.  Then we can check that it actually
> > works there.
> > 
> > The website looks old (it is old), but let's not try to redesign it at
> > the same time, since that will take an unknown amount of time.  Thus it
> > would mean taking the existing PHP code, setup the database, and
> > whatever else is needed to configure it.
> > 
> > Skills required:
> > - Experience with PHP and MySQL stuff.
> > - Have time available now (and preferably later for maintenance).
> > - Trustworthy, be responsible with users private data.
> > 
> > I would prefer at least person we know well from Vim work.
> > 
> > Please respond to this thread if you are interested.
> 
> Nobody responded yet, so let me offer my time.
> 
> I haven't worked with php and mysql for a couple of years, but I think I 
> should be able to get it work. I should be able to spend some time in 
> the evenings for this.

Thanks Christian!  Let's discuss details in another thread.

-- 
BLACK KNIGHT: None shall pass.
ARTHUR:   I have no quarrel with you, brave Sir knight, but I must cross
  this bridge.
BLACK KNIGHT: Then you shall die.
 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// 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] Problem with deleting linebreaks in virtual replace mode

2018-03-06 Fir de Conversatie Bram Moolenaar

Christian Brabandt wrote:

> On Mo, 12 Feb 2018, Bram Moolenaar wrote:
> > Not sure this is true.  If two lines are added after orig_line_count was
> > set, and one line gets deleted, then orig_line_count should not change.
> > If the total number of lines decreases below orig_line_count then
> > orig_line_count does need to be adjusted.  Hmm, something like that,
> > need some actual scenarios to check what really happens.
> 
> [writing more tests]
> 
> > Please do.  And please add comments to those global variables, so that
> > it's clear what they mean exactly (not just what they are used for).
> > I'm trying to do this for all these state variables (as far as I can
> > understand them, insert completion is another area where it's not 100%
> > clear).
> > 
> 
> It's been a bit late, but here is an updated patch, that checks that 
> orig_line_count is still valid in virtual replace mode and adds a couple 
> of more tests.
> 
> I think I addressed all of your points above.

Thanks!  Running the test without the change in edit.c causes a crash.
Nice fix.


-- 
DENNIS: Look,  strange women lying on their backs in ponds handing out
swords ... that's no basis for a system of government.  Supreme
executive power derives from a mandate from the masses, not from some
farcical aquatic ceremony.
 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

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

2018-03-06 Fir de Conversatie Bram Moolenaar

Patch 8.0.1575
Problem:Crash when using virtual replace.
Solution:   Adjust orig_line_count.  Add more tests. (Christian Brabandt)
Files:  src/edit.c, src/testdir/test_visual.vim


*** ../vim-8.0.1574/src/edit.c  2018-03-04 20:14:08.240064393 +0100
--- src/edit.c  2018-03-06 12:05:11.051771382 +0100
***
*** 8907,8913 
--- 8907,8923 
|| do_join(2, FALSE, TRUE, FALSE, FALSE) == FAIL)
vim_beep(BO_BS);
else
+   {
curwin->w_cursor.col = temp;
+ #ifdef FEAT_VREPLACE
+   /* Adjust orig_line_count in case more lines have been deleted than
+* have been added. That makes sure, that open_line() later
+* can access all buffer lines correctly */
+   if (State & VREPLACE_FLAG &&
+   orig_line_count > curbuf->b_ml.ml_line_count)
+   orig_line_count = curbuf->b_ml.ml_line_count;
+ #endif
+   }
  }
  else if (del_char(FALSE) == FAIL)  /* delete char under cursor */
vim_beep(BO_BS);
*** ../vim-8.0.1574/src/testdir/test_visual.vim 2017-10-26 20:20:27.321598241 
+0200
--- src/testdir/test_visual.vim 2018-03-06 12:10:35.169845781 +0100
***
*** 70,82 
exe "normal \"
catch /^Vim\%((\a\+)\)\=:E315/
echom 'Snap! E315 error!'
!   let g:msg='Snap! E315 error!'
endtry
  endfunc
  
  func Test_visual_mode_reset()
enew
!   let g:msg="Everything's fine."
enew
setl buftype=nofile
call append(line('$'), 'Delete this line.')
--- 70,82 
exe "normal \"
catch /^Vim\%((\a\+)\)\=:E315/
echom 'Snap! E315 error!'
!   let g:msg = 'Snap! E315 error!'
endtry
  endfunc
  
  func Test_visual_mode_reset()
enew
!   let g:msg = "Everything's fine."
enew
setl buftype=nofile
call append(line('$'), 'Delete this line.')
***
*** 186,189 
--- 186,244 
call assert_equal(['AB..CDEFGHI.Jkl',
  \ 'AB IJKLMNO QRst'], getline(12, 13))
enew!
+   set noai bs&vim t_kD&vim t_kb&vim
+ endfunc
+ 
+ " Test Virtual replace mode.
+ func Test_virtual_replace2()
+   enew!
+   set bs=2
+   exe "normal a\nabcdefghi\njk\tlmn\nopq  rst\n\uvwxyz"
+   call cursor(1,1)
+   " Test 1: Test that del deletes the newline
+   exe "normal gR0\ 1\nA\nBCDEFGHIJ\n\tKL\nMNO\nPQR"
+   call assert_equal(['0 1',
+ \ 'A',
+ \ 'BCDEFGHIJ',
+ \ '   KL',
+ \ 'MNO',
+ \ 'PQR',
+ \ ], getline(1, 6))
+   " Test 2:
+   " a newline is not deleted, if no newline has been added in virtual replace 
mode
+   %d_
+   call setline(1, ['abcd', 'efgh', 'ijkl'])
+   call cursor(2,1)
+   exe "norm! gR1234\5\\\"
+   call assert_equal(['abcd',
+ \ '123h',
+ \ 'ijkl'], getline(1, '$'))
+   " Test 3:
+   " a newline is deleted, if a newline has been inserted before in virtual 
replace mode
+   %d_
+   call setline(1, ['abcd', 'efgh', 'ijkl'])
+   call cursor(2,1)
+   exe "norm! gR1234\\56\\\"
+   call assert_equal(['abcd',
+ \ '1234',
+ \ 'ijkl'], getline(1, '$'))
+   " Test 4:
+   " delete add a newline, delete it, add it again and check undo
+   %d_
+   call setline(1, ['abcd', 'efgh', 'ijkl'])
+   call cursor(2,1)
+   " break undo sequence explicitly
+   let &ul = &ul
+   exe "norm! gR1234\\\56\"
+   let &ul = &ul
+   call assert_equal(['abcd',
+ \ '123456',
+ \ ''], getline(1, '$'))
+   norm! u
+   call assert_equal(['abcd',
+ \ 'efgh',
+ \ 'ijkl'], getline(1, '$'))
+   " clean up
+   %d_
+   set bs&vim
  endfunc
*** ../vim-8.0.1574/src/version.c   2018-03-06 11:43:00.327652783 +0100
--- src/version.c   2018-03-06 12:06:14.187396329 +0100
***
*** 768,769 
--- 768,771 
  {   /* Add new patch number below this line */
+ /**/
+ 1575,
  /**/

-- 
Hanson's Treatment of Time:
There are never enough hours in a day, but always too
many days before Saturday.

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

2018-03-06 Fir de Conversatie Bram Moolenaar

Patch 8.0.1574
Problem:Show cursor in wrong place when using popup menu. (Wei Zhang)
Solution:   Force updating the cursor position.  Fix skipping over unused
entries.
Files:  src/screen.c, src/proto/screen.pro, src/popupmnu.c


*** ../vim-8.0.1573/src/screen.c2018-03-04 18:07:04.280592270 +0100
--- src/screen.c2018-03-06 11:24:27.946250978 +0100
***
*** 9471,9477 
  void
  setcursor(void)
  {
! if (redrawing())
  {
validate_cursor();
windgoto(W_WINROW(curwin) + curwin->w_wrow,
--- 9471,9487 
  void
  setcursor(void)
  {
! setcursor_mayforce(FALSE);
! }
! 
! /*
!  * Set cursor to its position in the current window.
!  * When "force" is TRUE also when not redrawing.
!  */
! void
! setcursor_mayforce(int force)
! {
! if (force || redrawing())
  {
validate_cursor();
windgoto(W_WINROW(curwin) + curwin->w_wrow,
*** ../vim-8.0.1573/src/proto/screen.pro2017-09-13 22:11:31.761200612 
+0200
--- src/proto/screen.pro2018-03-06 11:25:34.393856094 +0100
***
*** 44,49 
--- 44,50 
  void screen_start(void);
  void windgoto(int row, int col);
  void setcursor(void);
+ void setcursor_mayforce(int force);
  int win_ins_lines(win_T *wp, int row, int line_count, int invalid, int 
mayclear);
  int win_del_lines(win_T *wp, int row, int line_count, int invalid, int 
mayclear, int clear_attr);
  int screen_ins_lines(int off, int row, int line_count, int end, int 
clear_attr, win_T *wp);
*** ../vim-8.0.1573/src/popupmnu.c  2018-03-05 21:06:19.763252514 +0100
--- src/popupmnu.c  2018-03-06 11:31:53.835600769 +0100
***
*** 1104,1117 
   * Execute the currently selected popup menu item.
   */
  static void
! pum_execute_menu(vimmenu_T *menu)
  {
  vimmenu_T   *mp;
  int   idx = 0;
  exarg_T   ea;
  
  for (mp = menu->children; mp != NULL; mp = mp->next)
!   if (idx++ == pum_selected)
{
vim_memset(&ea, 0, sizeof(ea));
execute_menu(&ea, mp);
--- 1104,1117 
   * Execute the currently selected popup menu item.
   */
  static void
! pum_execute_menu(vimmenu_T *menu, int mode)
  {
  vimmenu_T   *mp;
  int   idx = 0;
  exarg_T   ea;
  
  for (mp = menu->children; mp != NULL; mp = mp->next)
!   if ((mp->modes & mp->enabled & mode) && idx++ == pum_selected)
{
vim_memset(&ea, 0, sizeof(ea));
execute_menu(&ea, mp);
***
*** 1171,1177 
int c;
  
pum_redraw();
!   setcursor();
out_flush();
  
c = vgetc();
--- 1171,1177 
int c;
  
pum_redraw();
!   setcursor_mayforce(TRUE);
out_flush();
  
c = vgetc();
***
*** 1180,1186 
else if (c == CAR || c == NL)
{
/* enter: select current item, if any, and close */
!   pum_execute_menu(menu);
break;
}
else if (c == 'k' || c == K_UP || c == K_MOUSEUP)
--- 1180,1186 
else if (c == CAR || c == NL)
{
/* enter: select current item, if any, and close */
!   pum_execute_menu(menu, mode);
break;
}
else if (c == 'k' || c == K_UP || c == K_MOUSEUP)
***
*** 1221,1227 
pum_select_mouse_pos();
if (pum_selected >= 0)
{
!   pum_execute_menu(menu);
break;
}
if (c == K_LEFTMOUSE || c == K_LEFTMOUSE_NM)
--- 1221,1227 
pum_select_mouse_pos();
if (pum_selected >= 0)
{
!   pum_execute_menu(menu, mode);
break;
}
if (c == K_LEFTMOUSE || c == K_LEFTMOUSE_NM)
*** ../vim-8.0.1573/src/version.c   2018-03-05 22:43:05.523985559 +0100
--- src/version.c   2018-03-06 11:25:17.845954436 +0100
***
*** 768,769 
--- 768,771 
  {   /* Add new patch number below this line */
+ /**/
+ 1574,
  /**/

-- 
OLD WOMAN: Well, how did you become king, then?
ARTHUR: The Lady of the Lake, her arm clad in the purest shimmering samite,
held Excalibur aloft from the bosom of the water to signify by Divine
Providence ...  that I, Arthur, was to carry Excalibur ...  That is
why I am your king!
 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

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

Re: Patch 8.0.1570

2018-03-06 Fir de Conversatie Bram Moolenaar

Wei Zhang wrote:

> Thanks a lot, I always can't remember my keymaps and need to check the
> vimrc again and again when I forget some. popup windows will help me
> and other newbees.
> 
> An issue has been found during my test: 
> 
> When you are navigating the items in the popup with arrow keys, you
> can see the cursor is visible and locate just behind the current
> selected item.
> 
> I suppose cursor should be invisible when popup window is in-use ??

I noticed this too.  Found that the cursor isn't positioned because when
the pum is displayed redrawing is disabled.

We can't force the cursor off while waiting for a character.  Also, some
operations apply to the cursor position, thus it's good when we see
where it is.

> And on last thing, special character '&' can not be used in the TUI popup,

Yeah, it's hard to find a way to highlight it.  And then how do you type
the character?  Mappings may get in the way.  Alt key may not always
work.
 
> :amenu PopUp.Cscope\ &Definition  :cs find g =expand("")
> :amenu PopUp.Cscope\ &Symbol:cs find s =expand("")
> :amenu PopUp.Cscope\ &Callee:cs find c =expand("")
> :amenu PopUp.Cscope\ &Assigned:cs find a =expand("")
> 
> I always forget cscope commands, so, it's necessary for me to put them into a 
> popup menu and give each item a shortcut by using '&'.
> 
> This shortcuts can be used on gvim but it doesn't work in TUI now.

Yes, and I think that's OK.

-- 
ARTHUR:Be quiet!  I order you to shut up.
OLD WOMAN: Order, eh -- who does he think he is?
ARTHUR:I am your king!
OLD WOMAN: Well, I didn't vote for you.
 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

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

2018-03-06 Fir de Conversatie Christian Brabandt

On Fr, 02 Mär 2018, Bram Moolenaar wrote:

> 
> Well, vim.org is down again.  We have had direct responses from
> SourceForge, thus it's not like they don't care.  They try hard to make
> it work, but it still doesn't.
> 
> I think it is time we seriously look into the alternative: moving to
> osdn.net.  I would like to have two volunteers who take the current
> website and make it work on OSDN.  Then we can check that it actually
> works there.
> 
> The website looks old (it is old), but let's not try to redesign it at
> the same time, since that will take an unknown amount of time.  Thus it
> would mean taking the existing PHP code, setup the database, and
> whatever else is needed to configure it.
> 
> Skills required:
> - Experience with PHP and MySQL stuff.
> - Have time available now (and preferably later for maintenance).
> - Trustworthy, be responsible with users private data.
> 
> I would prefer at least person we know well from Vim work.
> 
> Please respond to this thread if you are interested.

Nobody responded yet, so let me offer my time.

I haven't worked with php and mysql for a couple of years, but I think I 
should be able to get it work. I should be able to spend some time in 
the evenings for this.

Best,
Christian
-- 
Wenn man über 60 ist und es tut einem früh beim Aufwachen nichts weh,
dann ist man tot.

-- 
-- 
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] Problem with deleting linebreaks in virtual replace mode

2018-03-06 Fir de Conversatie Christian Brabandt
Bram,

On Mo, 12 Feb 2018, Bram Moolenaar wrote:
> Not sure this is true.  If two lines are added after orig_line_count was
> set, and one line gets deleted, then orig_line_count should not change.
> If the total number of lines decreases below orig_line_count then
> orig_line_count does need to be adjusted.  Hmm, something like that,
> need some actual scenarios to check what really happens.

[writing more tests]

> Please do.  And please add comments to those global variables, so that
> it's clear what they mean exactly (not just what they are used for).
> I'm trying to do this for all these state variables (as far as I can
> understand them, insert completion is another area where it's not 100%
> clear).
> 

It's been a bit late, but here is an updated patch, that checks that 
orig_line_count is still valid in virtual replace mode and adds a couple 
of more tests.

I think I addressed all of your points above.

Best,
Christian

-- 
-- 
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.
From 2be2208af1656782fdefe1847dc4cd529b1cebc0 Mon Sep 17 00:00:00 2001
From: Christian Brabandt 
Date: Tue, 13 Feb 2018 18:15:38 +0100
Subject: [PATCH] Fix virtual replace when deleting linebreaks

Currently, when one deletes linebreaks in virtual replace mode, one
might get the error message "ml_get: invalid lnum", because Vim tries to
access line number orig_line_count which isn't valid anymore.

So therefore make sure, that when deleting linebreaks orig_line_count is
actually still valid.

Add a couple of more tests to make sure the behaviour works correctly in
virtual line break
---
 src/edit.c  | 10 +
 src/testdir/test_visual.vim | 55 +
 2 files changed, 65 insertions(+)

diff --git a/src/edit.c b/src/edit.c
index 47227d34b..f920167c2 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -8927,7 +8927,17 @@ ins_del(void)
 		|| do_join(2, FALSE, TRUE, FALSE, FALSE) == FAIL)
 	vim_beep(BO_BS);
 	else
+	{
 	curwin->w_cursor.col = temp;
+#ifdef FEAT_VREPLACE
+	/* Adjust orig_line_count in case more lines have been deleted than
+	 * have been added. That makes sure, that open_line() later
+	 * can access all buffer lines correctly */
+	if (State & VREPLACE_FLAG &&
+		orig_line_count > curbuf->b_ml.ml_line_count)
+		orig_line_count = curbuf->b_ml.ml_line_count;
+#endif
+	}
 }
 else if (del_char(FALSE) == FAIL)  /* delete char under cursor */
 	vim_beep(BO_BS);
diff --git a/src/testdir/test_visual.vim b/src/testdir/test_visual.vim
index 4287a9e49..eb1c568b6 100644
--- a/src/testdir/test_visual.vim
+++ b/src/testdir/test_visual.vim
@@ -186,4 +186,59 @@ func Test_virtual_replace()
   call assert_equal(['AB..CDEFGHI.Jkl',
 	  \ 'AB	IJKLMNO	QRst'], getline(12, 13))
   enew!
+  set noai bs&vim t_kD&vim t_kb&vim
+endfunc
+
+" Test Virtual replace mode.
+func Test_virtual_replace2()
+  enew!
+  set bs=2
+  exe "normal a\nabcdefghi\njk\tlmn\nopq	rst\n\uvwxyz"
+  call cursor(1,1)
+  " Test 1: Test that del deletes the newline
+  exe "normal gR0\ 1\nA\nBCDEFGHIJ\n\tKL\nMNO\nPQR"
+  call assert_equal(['0 1',
+	  \ 'A',
+	  \ 'BCDEFGHIJ',
+	  \ '	KL',
+	  \ 'MNO',
+	  \ 'PQR',
+	  \ ], getline(1, 6))
+  " Test 2:
+  " a newline is not deleted, if no newline has been added in virtual replace mode
+  %d_
+  call setline(1, ['abcd', 'efgh', 'ijkl'])
+  call cursor(2,1)
+  exe "norm! gR1234\5\\\"
+  call assert_equal(['abcd',
+\ '123h',
+\ 'ijkl'], getline(1, '$'))
+  " Test 3:
+  " a newline is deleted, if a newline has been inserted before in virtual replace mode
+  %d_
+  call setline(1, ['abcd', 'efgh', 'ijkl'])
+  call cursor(2,1)
+  exe "norm! gR1234\\56\\\"
+  call assert_equal(['abcd',
+\ '1234',
+\ 'ijkl'], getline(1, '$'))
+  " Test 4:
+  " delete add a newline, delete it, add it again and check undo
+  %d_
+  call setline(1, ['abcd', 'efgh', 'ijkl'])
+  call cursor(2,1)
+  " break undo sequence explicitly
+  let &ul=&ul
+  exe "norm! gR1234\\\56\"
+  let &ul=&ul
+  call assert_equal(['abcd',
+\ '123456',
+\ ''], getline(1, '$'))
+  norm! u
+  call assert_equal(['abcd',
+\ 'efgh',
+\ 'ijkl'], getline(1, '$'))
+  " clean up
+  %d_
+  set bs&vim
 endfunc
-- 
2.14.1