Patch 8.0.0273

2017-01-30 Fir de Conversatie Bram Moolenaar

Patch 8.0.0273
Problem:Dead code detected by Coverity when not using gnome.
Solution:   Rearrange the #ifdefs to avoid dead code.
Files:  src/gui_gtk_x11.c


*** ../vim-8.0.0272/src/gui_gtk_x11.c   2017-01-09 20:30:23.898717562 +0100
--- src/gui_gtk_x11.c   2017-01-30 22:45:03.999637769 +0100
***
*** 3171,3179 
  static int
  get_item_dimensions(GtkWidget *widget, GtkOrientation orientation)
  {
  GtkOrientation item_orientation = GTK_ORIENTATION_HORIZONTAL;
  
- # ifdef FEAT_GUI_GNOME
  if (using_gnome && widget != NULL)
  {
GtkWidget *parent;
--- 3171,3179 
  static int
  get_item_dimensions(GtkWidget *widget, GtkOrientation orientation)
  {
+ # ifdef FEAT_GUI_GNOME
  GtkOrientation item_orientation = GTK_ORIENTATION_HORIZONTAL;
  
  if (using_gnome && widget != NULL)
  {
GtkWidget *parent;
***
*** 3192,3198 
--- 3192,3201 
item_orientation = bonobo_dock_item_get_orientation(dockitem);
}
  }
+ # else
+ #  define item_orientation GTK_ORIENTATION_HORIZONTAL
  # endif
+ 
  # if GTK_CHECK_VERSION(3,0,0)
  if (widget != NULL
&& item_orientation == orientation
***
*** 3210,3224 
--- 3213,3235 
  
gtk_widget_get_allocation(widget, );
  
+ #  ifdef FEAT_GUI_GNOME
if (orientation == GTK_ORIENTATION_HORIZONTAL)
return allocation.height;
else
return allocation.width;
+ #  else
+   return allocation.height;
+ #endif
  # else
+ #  ifdef FEAT_GUI_GNOME
if (orientation == GTK_ORIENTATION_HORIZONTAL)
return widget->allocation.height;
else
return widget->allocation.width;
+ #  else
+   return widget->allocation.height;
+ #  endif
  # endif
  }
  return 0;
*** ../vim-8.0.0272/src/version.c   2017-01-30 22:00:56.625028477 +0100
--- src/version.c   2017-01-30 22:56:11.995257184 +0100
***
*** 766,767 
--- 766,769 
  {   /* Add new patch number below this line */
+ /**/
+ 273,
  /**/

-- 
   [Autumn changed into Winter ... Winter changed into Spring ...  Spring
   changed back into Autumn and Autumn gave Winter and Spring a miss and
   went straight on into Summer ...  Until one day ...]
 "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/vim] Scheme highlighting is not R7RS-compliant (#1424)

2017-01-30 Fir de Conversatie Charles E Campbell
vim-dev ML wrote:
> Hi Chris and Koz,
>
> I'm the author of that plugin and owner of the mysterious website, and
> just wanted to say I'd be happy to submit the files. I will want to take
> some time to clean them up and make sure they work on a stock Vim first,
> but once that's done I assume I can simply post them to this list, is
> that right?
>
> My one concern is about maintenance. I've chipped away at the plugin
> over time and tweak it as I find things that aren't quite right, and I'm
> sure I'll find more in the future. Are you happy for periodical updates
> to be posted as well?
>
Hello, Evan:

No need to post your updates to the list; instead, email them directly
to b...@moolenaar.net.

Regards,
Chip Campbell

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

2017-01-30 Fir de Conversatie Bram Moolenaar

Rob Foehl wrote:

> On Sat, 21 Jan 2017, Bram Moolenaar wrote:
> 
> > Patch 8.0.0210
> > Problem:Vim does not support bracketed paste, as implemented by xterm 
> > and
> >other terminals.
> > Solution:   Add t_BE, t_BD, t_PS and t_PE.
> 
> Thanks for this, nice to see native support in Vim.  Minor typo fix below.

Thanks.

> I'm a little confused by this part in normal.c:
> 
> +   case K_PS:  /* bracketed paste works like "a"ppend */
> 
>  pastes work like insert, as does insert mode  -- 
> shouldn't these be consistent?

When Vim deals with the paste we know the mouse position, thus one can
point to a character to insert before, or after the last character to
append.  With bracketed paste we don't know the mouse position, we only
have the cursor position.  I think appending is the most common.
However, this makes it impossible to insert before the first column.  We
could make it so that it inserts before the first column and otherwise
appends.  This then makes it impossible to append after the first
character, but that's probably the best compromise.


-- 
TALL KNIGHT: We are now no longer the Knights Who Say Ni!
ONE KNIGHT:  Ni!
OTHERS:  Sh!
ONE KNIGHT:  (whispers) Sorry.
 "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.0272

2017-01-30 Fir de Conversatie Bram Moolenaar

Patch 8.0.0272
Problem:Crash on exit is not detected when running tests.
Solution:   Remove the dash before the command. (Dominique Pelle, closes
#1425)
Files:  src/testdir/Makefile


*** ../vim-8.0.0271/src/testdir/Makefile2016-09-11 14:36:25.0 
+0200
--- src/testdir/Makefile2017-01-30 21:58:00.162197112 +0100
***
*** 78,84 
# 200 msec is sufficient, but only modern sleep supports a fraction of
# a second, fall back to a second if it fails.
@-/bin/sh -c "sleep .2 > /dev/null 2>&1 || sleep 1"
!   -$(RUN_VIM) $*.in
  
# For flaky tests retry one time.  No tests at the moment.
#@/bin/sh -c "if test -f test.out -a $* = test61; then \
--- 78,84 
# 200 msec is sufficient, but only modern sleep supports a fraction of
# a second, fall back to a second if it fails.
@-/bin/sh -c "sleep .2 > /dev/null 2>&1 || sleep 1"
!   $(RUN_VIM) $*.in
  
# For flaky tests retry one time.  No tests at the moment.
#@/bin/sh -c "if test -f test.out -a $* = test61; then \
***
*** 108,114 
# 200 msec is sufficient, but only modern sleep supports a fraction of
# a second, fall back to a second if it fails.
@-/bin/sh -c "sleep .2 > /dev/null 2>&1 || sleep 1"
!   -$(RUN_VIM) $*.in
@/bin/sh -c "if test -f benchmark.out; then cat benchmark.out; fi"
  
  nolog:
--- 108,114 
# 200 msec is sufficient, but only modern sleep supports a fraction of
# a second, fall back to a second if it fails.
@-/bin/sh -c "sleep .2 > /dev/null 2>&1 || sleep 1"
!   $(RUN_VIM) $*.in
@/bin/sh -c "if test -f benchmark.out; then cat benchmark.out; fi"
  
  nolog:
*** ../vim-8.0.0271/src/version.c   2017-01-29 23:26:12.926595799 +0100
--- src/version.c   2017-01-30 21:59:15.401698767 +0100
***
*** 766,767 
--- 766,769 
  {   /* Add new patch number below this line */
+ /**/
+ 272,
  /**/

-- 
Vi beats Emacs to death, and then again!
http://linuxtoday.com/stories/5764.html

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

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

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


Re: [vim/vim] Correct syntax in lstlisting w/out g:tex_verbspell (#1417)

2017-01-30 Fir de Conversatie Charles E Campbell
Martin Ueding wrote:
>
> In my setup of Vim, |verbatim| environments get highlighted just fine.
> The |lstlisting| environments do not have any special syntax
> highlighting. Characters like |$| or |_| screw up the syntax
> highlighting of all the following LaTeX code although they are not
> supposed to be interpreted as LaTeX.
>
> From the source it seems that support for |lstlisting| is built-in, but
> for some reason only when |g:tex_verbspell| is available and enabled.
> The only difference between the two blocks seems to be the
> |contains=@Spell|, so I have just copied the |lstlisting| line to the
> other branch.
>
Actually, the correct thing to do here is to remove lstlisting entirely
from syntax/tex.vim.  Its defined via a package, and package syntax
should not be supported inside syntax/tex.vim.

To get lstlisting highlighted correctly, see:
http://www.drchip.org/astronaut/vim/index.html#LATEXPKGS .

Regards,
Chip Campbell

-- 
-- 
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 v2] syntax: Add command to control how foldlevel is computed for a line

2017-01-30 Fir de Conversatie Brad King
On 10/17/2016 04:45 PM, Bram Moolenaar wrote:
>> :syntax foldlevel [start | minimum]
> 
> Thanks.  I suppose that's the best way to do it.

Here is a revised patch series that now includes tests for the new command.
It also updates runtime/syntax/vim.vim to highlight the command syntax.

Thanks,
-Brad

-- 
-- 
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 5892ea62008d11ad24c07d875c8c4cefa5503c64 Mon Sep 17 00:00:00 2001
Message-Id: <5892ea62008d11ad24c07d875c8c4cefa5503c64.1485803991.git.brad.k...@kitware.com>
From: Brad King 
Date: Sun, 22 Jan 2017 22:31:35 -0500
Subject: [PATCH v2 1/3] syntax: Add command to control how foldlevel is
 computed for a line

With `foldmethod=syntax` the foldlevel of a line is computed based
on syntax items on the line.  Previously we always used the level
of the syntax item containing the start of the line.  This works
well in cases such as:

if (...) {
  ...
}
else if (...) {
  ...
}
else {
  ...
}

which folds like this:

+---  3 lines: if (...) {---
+---  3 lines: else if (...) {--
+---  3 lines: else {---

However, the code:

if (...) {
  ...
} else if (...) {
  ...
} else {
  ...
}

folds like this:

+---  7 lines: if (...) {---

We can make the latter case fold like this:

+---  2 lines: if (...) {---
+---  2 lines: } else if (...) {
+---  3 lines: } else {-

by choosing on each line the lowest fold level that is followed
by a higher fold level.

Add a syntax command

:syntax foldlevel [start | minimum]

to choose between these two methods of computing the foldlevel of
a line.
---
 runtime/doc/syntax.txt  | 19 +++
 src/structs.h   |  5 +++
 src/syntax.c| 64 ++---
 src/testdir/test_syntax.vim | 77 -
 4 files changed, 160 insertions(+), 5 deletions(-)

diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt
index e300983f0..c2804ecd9 100644
--- a/runtime/doc/syntax.txt
+++ b/runtime/doc/syntax.txt
@@ -3482,6 +3482,23 @@ DEFINING CASE		*:syn-case* *E390*
 :sy[ntax] case
 	Show either "syntax case match" or "syntax case ignore" (translated).
 
+DEFINING FOLDLEVEL	*:syn-foldlevel*
+
+:sy[ntax] foldlevel [start | minimum]
+	This defines how the foldlevel of a line is computed when using
+	foldmethod=syntax (see |fold-syntax| and |:syn-fold|):
+
+	start:		Use level of item containing start of line.
+	minimum:	Use lowest local-minimum level of items on line.
+
+	The default is 'start'.  Use 'minimum' to search a line horizontally
+	for the lowest level contained on the line that is followed by a
+	higher level.  This produces more natural folds when syntax items
+	may close and open horizontally within a line.
+
+	{not meaningful when Vim was compiled without |+folding| feature}
+
+
 SPELL CHECKING		*:syn-spell*
 
 :sy[ntax] spell [toplevel | notoplevel | default]
@@ -3945,6 +3962,8 @@ This will make each {} block form one fold.
 The fold will start on the line where the item starts, and end where the item
 ends.  If the start and end are within the same line, there is no fold.
 The 'foldnestmax' option limits the nesting of syntax folds.
+See |:syn-foldlevel| to control how the foldlevel of a line is computed
+from its syntax items.
 {not available when Vim was compiled without |+folding| feature}
 
 
diff --git a/src/structs.h b/src/structs.h
index af0a6fd2b..97f30bb56 100644
--- a/src/structs.h
+++ b/src/structs.h
@@ -1736,6 +1736,10 @@ typedef struct list_stack_S
 #define SYNSPL_TOP	1	/* spell check toplevel text */
 #define SYNSPL_NOTOP	2	/* don't spell check toplevel text */
 
+/* values for b_syn_foldlevel: how to compute foldlevel on a line */
+#define SYNFLD_START	0	/* use level of item at start of line */
+#define SYNFLD_MINIMUM	1	/* use lowest local minimum level on line */
+
 /* avoid #ifdefs for when b_spell is not available */
 #ifdef FEAT_SPELL
 # define B_SPELL(buf)  ((buf)->b_spell)
@@ -1787,6 +1791,7 @@ typedef struct {
 hashtab_T	b_keywtab_ic;		/* idem, ignore case */
 int		b_syn_error;		/* TRUE when error occurred in HL */
 int		b_syn_ic;		/* ignore case for :syn cmds */
+int		b_syn_foldlevel;	/* how to compute foldlevel on a line */
 int		b_syn_spell;		/* SYNSPL_ values */
 garray_T	b_syn_patterns;		

Re: XPM syntax suggestion for termguicolors

2017-01-30 Fir de Conversatie Jemma Nelson
Sorry!

I forgot to mention; I emailed the maintainers listed in both the XPM and XPM2 
syntax files on Jan 10th.

Steve Wall (maintainer of XPM2)'s email bounced, and Ronald Schild has not yet 
replied.

--Jemma

On Monday, January 30, 2017 at 2:28:40 AM UTC-8, Christian Brabandt wrote:
> Hi Jemma!
> 
> On So, 29 Jan 2017, Jemma Nelson wrote:
> 
> > The XPM(2) syntax files that ship with vim currently do special 
> > highlighting when `has("gui_running")` - it colorizes the display according 
> > to the colors of the image.
> > 
> > Now that vim supports truecolor in the terminal, I'd like to see that same 
> > support used when `termguicolors` is set.
> > 
> > I've attached a diff that Works On My Machine (TM).
> > 
> > 
> > I'm very new to this, so please let me know if you need anything from me.
> 
> Please try to reach out for the current maintainer. Thanks.
> 
> 
> Best,
> Christian
> -- 
> Man muß mit seinen Feinden leben, da man ja nicht jedermann zum
> Freund haben kann.
>   -- Alexis de Tocqueville

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

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


Re: [vim/vim] Feature Request: mode() returns Insert sub-mode (#1397)

2017-01-30 Fir de Conversatie Yegappan Lakshmanan
Hi,

On Mon, Jan 23, 2017 at 9:02 AM, Zhen-Huan (Kenny) Hu
 wrote:
> else if (ins_compl_active())
>
> buf[1] = pum_visible() ? 'C' : 'c';
>
> Does this 'C' vs. 'c' mean whether a completion was successful? I don't
> think pum_visible() alone is able to determine this accurately since it
> depends on whether the user have completeopt=menuone to have a menu if there
> is only one match. I'd rather not distinguish it in mode() and let it return
> 'ic' if ins_compl_active() no matther whether pum_visible().
>

I am attaching a patch to the mode() function that returns 'ic' or 'ix'
or 'Rc' or 'Rx' depending on the insert completion mode. I have also
added a test for the mode() function.

The idea from Hirohito to add a separate function to get more
information about the insert mode completion can be addressed in a
separate patch.

- Yegappan

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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 58a61f2..40e8a79 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -5848,8 +5848,12 @@ mode([expr]) Return a string that indicates the 
current mode.
S   Select by line
CTRL-S  Select blockwise
i   Insert
+   ic  Insert mode completion |compl-generic|
+   ix  Insert mode |i_CTRL-X| completion
R   Replace |R|
+   Rc  Replace mode completion |compl-generic|
Rv  Virtual Replace |gR|
+   Rx  Replace mode |i_CTRL-X| completion
c   Command-line
cv  Vim Ex mode |gQ|
ce  Normal Ex mode |Q|
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 7f433a5..8f90fc1 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -7783,10 +7783,18 @@ f_mode(typval_T *argvars, typval_T *rettv)
}
else
 #endif
-   if (State & REPLACE_FLAG)
-   buf[0] = 'R';
-   else
-   buf[0] = 'i';
+   {
+   if (State & REPLACE_FLAG)
+   buf[0] = 'R';
+   else
+   buf[0] = 'i';
+#ifdef FEAT_INS_EXPAND
+   if (ins_compl_active())
+   buf[1] = 'c';
+   else if (ctrl_x_mode == 1)
+   buf[1] = 'x';
+#endif
+   }
 }
 else if (State & CMDLINE)
 {
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index 38f7723..e12bc6c 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -304,4 +304,42 @@ func Test_toupper()
   call assert_equal("Ⱥ Ⱦ", toupper("ⱥ ⱦ"))
 endfunc
 
+" Tests for the mode() function
+let saved_modes = ''
+func! Save_mode()
+  let g:saved_modes .= mode(1) . " "
+  return ''
+endfunc
 
+func! Test_mode()
+  new
+  call append(0, ["Blue Ball Black", "Brown Band Bowl", ""])
+
+  inoremap  =Save_mode()
+
+  normal! 3G
+  exe "normal i\\"
+  exe "normal i\uBa\\\u"
+  exe "normal iBro\\\u"
+  exe "normal iBa\\\u"
+  exe "normal iBau"
+  exe "normal iBrou"
+  exe "normal iBro\u"
+  exe "normal iCom\\\u"
+  exe "normal iComu"
+
+  exe "normal RBa\\\u"
+  exe "normal RBro\\\u"
+  exe "normal RBa\\\u"
+  exe "normal RBau"
+  exe "normal RBrou"
+  exe "normal RBro\u"
+  exe "normal RCom\\\u"
+  exe "normal RComu"
+
+  call assert_equal("i ic ic ix ic ic ic ic ic Rc Rc Rx Rc Rc Rc Rc Rc ",
+ \ g:saved_modes)
+
+  enew! | close
+  iunmap 
+endfunc


Re: XPM syntax suggestion for termguicolors

2017-01-30 Fir de Conversatie Christian Brabandt
Hi Jemma!

On So, 29 Jan 2017, Jemma Nelson wrote:

> The XPM(2) syntax files that ship with vim currently do special highlighting 
> when `has("gui_running")` - it colorizes the display according to the colors 
> of the image.
> 
> Now that vim supports truecolor in the terminal, I'd like to see that same 
> support used when `termguicolors` is set.
> 
> I've attached a diff that Works On My Machine (TM).
> 
> 
> I'm very new to this, so please let me know if you need anything from me.

Please try to reach out for the current maintainer. Thanks.


Best,
Christian
-- 
Man muß mit seinen Feinden leben, da man ja nicht jedermann zum
Freund haben kann.
-- Alexis de Tocqueville

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