Patch 8.0.1733

2018-04-17 Fir de Conversatie Bram Moolenaar

Patch 8.0.1733
Problem:Incomplete testing for completion fix. (Lifepillar)
Solution:   Add a test with CTRL-P.
Files:  src/testdir/test_popup.vim


*** ../vim-8.0.1732/src/testdir/test_popup.vim  2018-04-17 22:14:27.456314045 
+0200
--- src/testdir/test_popup.vim  2018-04-17 23:28:25.365199933 +0200
***
*** 824,827 
--- 824,837 
bwipe!
  endfunc
  
+ func Test_popup_complete_backwards_ctrl_p()
+   new
+   call setline(1, ['Post', 'Port', 'Po'])
+   let expected=['Post', 'Port', 'Port']
+   call cursor(3,2)
+   call feedkeys("A\\rt\", 'tx')
+   call assert_equal(expected, getline(1,'$'))
+   bwipe!
+ endfunc
+ 
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.0.1732/src/version.c   2018-04-17 23:24:02.350755880 +0200
--- src/version.c   2018-04-17 23:29:33.616776521 +0200
***
*** 764,765 
--- 764,767 
  {   /* Add new patch number below this line */
+ /**/
+ 1733,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
213. Your kids start referring to you as "that guy in front of the monitor."

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

2018-04-17 Fir de Conversatie Bram Moolenaar

John Marriott wrote:

> On 17-Apr.-2018 00:38, Mike Williams wrote:
> > Hi
> >
> > On 16/04/2018 14:16, Bram Moolenaar wrote:
> >>
> >> I wrote:
> >>
> >>> Patch 8.0.1723
> >>> Problem:    Using one item array size declaration is misleading.
> >>> Solution:   Instead of using "[1]" and actually using a larger 
> >>> array, use
> >>>  "[]".  This is to verify that this C99 feature works 
> >>> for all
> >>>  compilers.
> >>> Files:  src/structs.h, src/getchar.c
> >>
> >> If you notice a prolem because of this patch, please speak up!
> >> Also if it's just a compiler warning.  We want to know if this C99
> >> feature works for everybody.
> >
> After this patch (8.0.1723), HP-UX throws this error:
> 
> Starting make in the src directory.
> If there are problems, cd to the src directory and run make there
>    cd src && make first
>    cc -c -I. -Iproto -DHAVE_CONFIG_H   -O2  -o objects/arabic.o arabic.c
> cc: "structs.h", line 514: error 1578: Size of struct or union member is 
> unknown.
> *** Error exit code 1
> 
> Stop.
> *** Error exit code 1
> 
> Stop.
> 
> 
> It looks like HP-UX compiler doesn't like flexible arrays.

Disappointing...

This document suggests it was added at some point:
https://support.hpe.com/hpsc/doc/public/display?docId=emr_na-c02670372

Apparently it was added with version B.11.11.16.
What version are you using?
Is there any way to upgrade?

-- 
hundred-and-one symptoms of being an internet addict:
211. Your husband leaves you...taking the computer with him and you
 call him crying, and beg him to bring the computer back.

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

2018-04-17 Fir de Conversatie Bram Moolenaar

Patch 8.0.1732
Problem:Crash when terminal API call deletes the buffer.
Solution:   Lock the buffer while calling a function. (closes #2813)
Files:  src/buffer.c, src/terminal.c, src/testdir/test_terminal.vim,
src/testdir/test_autocmd.vim


*** ../vim-8.0.1731/src/buffer.c2018-04-10 18:47:16.085527102 +0200
--- src/buffer.c2018-04-17 23:00:25.000925193 +0200
***
*** 417,422 
--- 417,424 
hash_remove(_hashtab, hi);
  }
  
+ static char *e_buflocked = N_("E937: Attempt to delete a buffer that is in 
use");
+ 
  /*
   * Close the link to a buffer.
   * "action" is used when there is no longer a window for the buffer.
***
*** 476,483 
--- 478,492 
if (term_job_running(buf->b_term))
{
if (wipe_buf || unload_buf)
+   {
+   if (buf->b_locked)
+   {
+   EMSG(_(e_buflocked));
+   return;
+   }
/* Wiping out or unloading a terminal buffer kills the job. */
free_terminal(buf);
+   }
else
{
/* The job keeps running, hide the buffer. */
***
*** 499,505 
   * halfway a command that relies on it). Unloading is allowed. */
  if (buf->b_locked > 0 && (del_buf || wipe_buf))
  {
!   EMSG(_("E937: Attempt to delete a buffer that is in use"));
return;
  }
  
--- 508,514 
   * halfway a command that relies on it). Unloading is allowed. */
  if (buf->b_locked > 0 && (del_buf || wipe_buf))
  {
!   EMSG(_(e_buflocked));
return;
  }
  
***
*** 1356,1361 
--- 1365,1376 
int forward;
bufref_T bufref;
  
+   if (buf->b_locked)
+   {
+   EMSG(_(e_buflocked));
+   return FAIL;
+   }
+ 
set_bufref(, buf);
  
/* When unloading or deleting a buffer that's already unloaded and
*** ../vim-8.0.1731/src/terminal.c  2018-04-15 23:45:12.974388434 +0200
--- src/terminal.c  2018-04-17 23:08:38.129246906 +0200
***
*** 46,51 
--- 46,54 
   *   switch to GUI, shell stops working. Scrollback seems wrong, command
   *   running in shell is still running.
   * - GUI: when using tabs, focus in terminal, click on tab does not work.
+  * - handle_moverect() scrolls one line at a time.  Postpone scrolling, count
+  *   the number of lines, until a redraw happens.  Then if scrolling many 
lines
+  *   a redraw is faster.
   * - Copy text in the vterm to the Vim buffer once in a while, so that
   *   completion works.
   * - Redrawing is slow with Athena and Motif.  Also other GUI? (Ramel Eshed)
***
*** 3433,3438 
--- 3436,3445 
{
char_u  *cmd = get_tv_string(>li_tv);
  
+   /* Make sure an invoked command doesn't delete the buffer (and the
+* terminal) under our fingers. */
+   ++term->tl_buffer->b_locked;
+ 
item = item->li_next;
if (item == NULL)
ch_log(channel, "Missing argument for %s", cmd);
***
*** 3442,3447 
--- 3449,3455 
handle_call_command(term, channel, item);
else
ch_log(channel, "Invalid command received: %s", cmd);
+   --term->tl_buffer->b_locked;
}
  }
  else
*** ../vim-8.0.1731/src/testdir/test_terminal.vim   2018-04-15 
23:45:12.978388406 +0200
--- src/testdir/test_terminal.vim   2018-04-17 23:07:37.537691498 +0200
***
*** 1287,1292 
--- 1287,1316 
call delete('Xlog')
  endfunc
  
+ let s:caught_e937 = 0
+ 
+ func Tapi_Delete(bufnum, arg)
+   try
+ execute 'bdelete!' a:bufnum
+   catch /E937:/
+ let s:caught_e937 = 1
+   endtry
+ endfunc
+ 
+ func Test_terminal_api_call_fail_delete()
+   if !CanRunVimInTerminal()
+ return
+   endif
+ 
+   call WriteApiCall('Tapi_Delete')
+   let buf = RunVimInTerminal('-S Xscript', {})
+   call WaitFor({-> s:caught_e937 == 1})
+ 
+   call StopVimInTerminal(buf)
+   call delete('Xscript')
+   call ch_logfile('', '')
+ endfunc
+ 
  func Test_terminal_ansicolors_default()
let colors = [
\ '#00', '#e0',
*** ../vim-8.0.1731/src/testdir/test_autocmd.vim2018-03-29 
17:40:42.607415702 +0200
--- src/testdir/test_autocmd.vim2018-04-17 23:21:01.779868180 +0200
***
*** 119,125 
  exe 'autocmd BufUnload  ' . (lastbuf + 1) . 'bwipeout!'
augroup END
  
!   call assert_fails('edit bb.txt', 'E937:')
  
autocmd! test_autocmd_bufunload
augroup! test_autocmd_bufunload
--- 119,127 
  exe 'autocmd BufUnload  ' . (lastbuf + 1) . 'bwipeout!'
augroup END
  
!   " Todo: check for E937 generated first
!   " call assert_fails('edit bb.txt', 'E937:')
!   call assert_fails('edit bb.txt', 'E517:')
  
autocmd! test_autocmd_bufunload
augroup! test_autocmd_bufunload

Re: Patch 8.0.1723

2018-04-17 Fir de Conversatie Cesar Romani

On 16/04/2018 08:16 a.m., Bram Moolenaar wrote:
>
> [...]
> If you notice a problem because of this patch, please speak up!
> Also if it's just a compiler warning.  We want to know if this C99
> feature works for everybody.

I'm using mingw-w64 on Windows 7, gcc 7.2.0, and I don't get any
warnings related to the C99 feature, but I get these warnings:


undo.c: In function 'u_save_cursor':
undo.c:270:6: warning: assuming signed overflow does not occur when 
assuming that (X - c) > X is always false [-Wstrict-overflow]

 if (top > curbuf->b_ml.ml_line_count
 
  || top >= bot
  ^

[...]
userfunc.c: In function 'get_funccal_local_ht':
userfunc.c:3594:2: warning: assuming signed overflow does not occur when 
assuming that (X + c) < X is always false [-Wstrict-overflow]

  for (i = 0; i < debug_backtrace_level; i++)
  ^~~
userfunc.c: In function 'get_funccal_local_var':
userfunc.c:3594:2: warning: assuming signed overflow does not occur when 
assuming that (X + c) < X is always false [-Wstrict-overflow]

  for (i = 0; i < debug_backtrace_level; i++)
  ^~~
userfunc.c: In function 'get_funccal_args_ht':
userfunc.c:3594:2: warning: assuming signed overflow does not occur when 
assuming that (X + c) < X is always false [-Wstrict-overflow]

  for (i = 0; i < debug_backtrace_level; i++)
  ^~~
userfunc.c: In function 'get_funccal_args_var':
userfunc.c:3594:2: warning: assuming signed overflow does not occur when 
assuming that (X + c) < X is always false [-Wstrict-overflow]

  for (i = 0; i < debug_backtrace_level; i++)

[...]
gui_dwrite.cpp: In member function 'HRESULT 
DWriteContext::SetDrawingMode(DrawingMode)':
gui_dwrite.cpp:950:10: warning: comparison between signed and unsigned 
integer expressions [-Wsign-compare]

   if (hr == D2DERR_RECREATE_TARGET)


--
Cesar

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

2018-04-17 Fir de Conversatie Bram Moolenaar

Patch 8.0.1731
Problem:Characters deleted on completion. (Adrià Farrés)
Solution:   Also check the last item for the ORIGINAL_TEXT flag. (Christian
Brabandt, closes #1645)
Files:  src/edit.c, src/testdir/test_popup.vim


*** ../vim-8.0.1730/src/edit.c  2018-03-06 12:10:43.693795133 +0100
--- src/edit.c  2018-04-17 22:06:40.619544998 +0200
***
*** 3656,3662 
  {
  char_u*p;
  
! /* Replace the original text entry. */
  if (compl_first_match->cp_flags & ORIGINAL_TEXT)  /* safety check */
  {
p = vim_strsave(str);
--- 3656,3664 
  {
  char_u*p;
  
! /* Replace the original text entry.
!  * The ORIGINAL_TEXT flag is either at the first item or might possibly be
!  * at the last item for backward completion */
  if (compl_first_match->cp_flags & ORIGINAL_TEXT)  /* safety check */
  {
p = vim_strsave(str);
***
*** 3666,3671 
--- 3668,3683 
compl_first_match->cp_str = p;
}
  }
+ else if (compl_first_match->cp_prev != NULL
+   && (compl_first_match->cp_prev->cp_flags & ORIGINAL_TEXT))
+ {
+p = vim_strsave(str);
+if (p != NULL)
+{
+vim_free(compl_first_match->cp_prev->cp_str);
+compl_first_match->cp_prev->cp_str = p;
+}
+ }
  }
  
  /*
*** ../vim-8.0.1730/src/testdir/test_popup.vim  2018-03-06 13:22:42.815870215 
+0100
--- src/testdir/test_popup.vim  2018-04-17 22:04:43.128367641 +0200
***
*** 814,818 
--- 814,827 
call delete('Xtest')
  endfunc
  
+ func Test_popup_complete_backwards()
+   new
+   call setline(1, ['Post', 'Port', 'Po'])
+   let expected=['Post', 'Port', 'Port']
+   call cursor(3,2)
+   call feedkeys("A\". repeat("\", 3). "rt\", 'tx')
+   call assert_equal(expected, getline(1,'$'))
+   bwipe!
+ endfunc
  
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.0.1730/src/version.c   2018-04-17 22:02:17.589386346 +0200
--- src/version.c   2018-04-17 22:08:22.734829865 +0200
***
*** 764,765 
--- 764,767 
  {   /* Add new patch number below this line */
+ /**/
+ 1731,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
210. When you get a divorce, you don't care about who gets the children,
 but discuss endlessly who can use the email address.

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

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

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


Patch 8.0.1730

2018-04-17 Fir de Conversatie Bram Moolenaar

Patch 8.0.1730
Problem:No configure check for the used C99 features.
Solution:   Add a compilation check.  Tentatively document C99 features.
Files:  src/configure.ac, src/auto/configure, runtime/doc/develop.txt


*** ../vim-8.0.1729/src/configure.ac2018-04-15 16:03:12.771985437 +0200
--- src/configure.ac2018-04-17 21:56:08.855964875 +0200
***
*** 29,34 
--- 29,57 
  AC_HEADER_STDC
  AC_HEADER_SYS_WAIT
  
+ dnl Check that the C99 features that Vim uses are supported:
+ dnl - // commands
+ dnl - comma after last enum item
+ dnl - "long long int" and "long long unsigned"
+ dnl - flexible array member
+ AC_MSG_CHECKING(if the compiler can handle Vim code)
+ AC_TRY_COMPILE([#include ], [
+   struct with_flexible_member {
+ int count;  // comment
+ char text[]; // another comment
+   };
+   enum {
+ one,
+ two,
+ three,
+   };
+   long long int a = 1;
+   long long unsigned b = 2;
+   printf("a %lld and a %llu", a, b);
+   ],
+ AC_MSG_RESULT(yes),
+ AC_MSG_ERROR([compiler does not work properly - see auto/config.log]))
+ 
  dnl Check for the flag that fails if stuff are missing.
  
  AC_MSG_CHECKING(--enable-fail-if-missing argument)
*** ../vim-8.0.1729/src/auto/configure  2018-04-15 16:03:12.775985408 +0200
--- src/auto/configure  2018-04-17 21:56:11.619945565 +0200
***
*** 4179,4184 
--- 4179,4218 
  fi
  
  
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the compiler can handle 
Vim code" >&5
+ $as_echo_n "checking if the compiler can handle Vim code... " >&6; }
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ #include 
+ int
+ main ()
+ {
+ 
+   struct with_flexible_member {
+ int count;  // comment
+ char text[]; // another comment
+   };
+   enum {
+ one,
+ two,
+ three,
+   };
+   long long int a = 1;
+   long long unsigned b = 2;
+   printf("a %lld and a %llu", a, b);
+ 
+   ;
+   return 0;
+ }
+ _ACEOF
+ if ac_fn_c_try_compile "$LINENO"; then :
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+ $as_echo "yes" >&6; }
+ else
+   as_fn_error $? "compiler does not work properly - see auto/config.log" 
"$LINENO" 5
+ fi
+ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ 
  
  { $as_echo "$as_me:${as_lineno-$LINENO}: checking --enable-fail-if-missing 
argument" >&5
  $as_echo_n "checking --enable-fail-if-missing argument... " >&6; }
*** ../vim-8.0.1729/runtime/doc/develop.txt 2016-09-12 12:45:25.0 
+0200
--- runtime/doc/develop.txt 2018-04-17 21:59:20.214627248 +0200
***
*** 143,151 
  
  VIM IS... NOT *design-not*
  
! - Vim is not a shell or an Operating System.  You will not be able to run a
!   shell inside Vim or use it to control a debugger.  This should work the
!   other way around: Use Vim as a component from a shell or in an IDE.
A satirical way to say this: "Unlike Emacs, Vim does not attempt to include
everything but the kitchen sink, but some people say that you can clean one
with it.  ;-)"
--- 143,152 
  
  VIM IS... NOT *design-not*
  
! - Vim is not a shell or an Operating System.  It does provide a terminal
!   window, in which you can run a shell or debugger.  E.g. to be able to do
!   this over an ssh connection.  But if you don't need a text editor with that
!   it is out of scope (use something like screen or tmux instead).
A satirical way to say this: "Unlike Emacs, Vim does not attempt to include
everything but the kitchen sink, but some people say that you can clean one
with it.  ;-)"
***
*** 177,192 
  5. Make a patch with "git diff".  You can also create a pull request on
 github, but it's the diff that matters.
  6. Make a note about what changed, preferably mentioning the problem and the
!solution.  Send an email to the vim-dev maillist with an explanation and
 include the diff. Or create a pull request on github.
  
  
  C COMPILER*style-compiler*
  
  The minimal C compiler version supported is C89, also known as ANSI C.
! Later standards don't add much and C89 is the widest supported.
  
! One restriction that this implies: no // comments, only /* comments */.
  
  
  USE OF COMMON FUNCTIONS   
*style-functions*
--- 178,233 
  5. Make a patch with "git diff".  You can also create a pull request on
 github, but it's the diff that matters.
  6. Make a note about what changed, preferably mentioning the problem and the
!solution.  Send an email to the |vim-dev| maillist with an explanation and
 include the diff. Or create a pull request on github.
  
  
  C COMPILER*style-compiler*
  
  The minimal C compiler version supported is C89, also known as ANSI C.
! Later standards, such as C99, are not widely supported, or at least 

Re: Patch 8.0.1723

2018-04-17 Fir de Conversatie John Marriott


On 17-Apr.-2018 00:38, Mike Williams wrote:

Hi

On 16/04/2018 14:16, Bram Moolenaar wrote:


I wrote:


Patch 8.0.1723
Problem:    Using one item array size declaration is misleading.
Solution:   Instead of using "[1]" and actually using a larger 
array, use
 "[]".  This is to verify that this C99 feature works 
for all

 compilers.
Files:  src/structs.h, src/getchar.c


If you notice a prolem because of this patch, please speak up!
Also if it's just a compiler warning.  We want to know if this C99
feature works for everybody.



After this patch (8.0.1723), HP-UX throws this error:

Starting make in the src directory.
If there are problems, cd to the src directory and run make there
  cd src && make first
  cc -c -I. -Iproto -DHAVE_CONFIG_H   -O2  -o objects/arabic.o arabic.c
cc: "structs.h", line 514: error 1578: Size of struct or union member is 
unknown.

*** Error exit code 1

Stop.
*** Error exit code 1

Stop.


It looks like HP-UX compiler doesn't like flexible arrays.
Cheers
John

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

--- 
You received this message because you are subscribed to the Google Groups "vim_dev" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Patch 8.0.1728

2018-04-17 Fir de Conversatie Bram Moolenaar

Patch 8.0.1728
Problem:Condition always false, useless code.
Solution:   Remove the code. (Nikolai Pavlov, closes #2808)
Files:  src/message.c


*** ../vim-8.0.1727/src/message.c   2018-02-10 18:45:21.068822158 +0100
--- src/message.c   2018-04-16 18:43:51.194379866 +0200
***
*** 1703,1710 
{
c = TO_SPECIAL(str[1], str[2]);
str += 2;
-   if (c == KS_ZERO)   /* display  as ^@ or  */
-   c = NUL;
}
if (IS_SPECIAL(c) || modifiers) /* special key */
special = TRUE;
--- 1703,1708 
*** ../vim-8.0.1727/src/version.c   2018-04-16 18:04:45.031723006 +0200
--- src/version.c   2018-04-17 20:11:27.840514384 +0200
***
*** 764,765 
--- 764,767 
  {   /* Add new patch number below this line */
+ /**/
+ 1728,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
204. You're being audited because you mailed your tax return to the IRC.

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