Feature sug.: Keep leading Zeros, or non-octal calculation mode

2010-07-08 Fir de Conversatie Kurt Mielke
Keep leading zeros

The Ctrl-a/Ctrl-x, has a feature of assuming octal when a number begins with
'0'. I suggest this this feature, so :se klz change the behaviour, and
ctrl-a/x only operates on decimal numbers.

So ctrl-a on '007' now turns into '008', Two more gives you '010'.

I realize this does mean that ctrl-x not always reverses ctrl-a as
ctrl-a+ctrl-x on '99' leaves you with '099'.

The feature is very useful operating on file names like track009.mp3, and I
have never used octal numbers, even when writting assembler it was always
decimal or hex.

Enclosed is a patch that implements the :se klz, I am not sure how
attachments works on this list, so it is also available from here:
http://lyn.dk/klz.patch

/Kurt Mielke

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


klz.patch
Description: Binary data


Re: Feature sug.: Keep leading Zeros, or non-octal calculation mode

2010-07-08 Fir de Conversatie Ingo Karkat
On 08-Jul-2010 11:15, Kurt Mielke wrote:
 Keep leading zeros
 
 The Ctrl-a/Ctrl-x, has a feature of assuming octal when a number begins
 with '0'. I suggest this this feature, so :se klz change the behaviour,
 and ctrl-a/x only operates on decimal numbers.
 
 So ctrl-a on '007' now turns into '008', Two more gives you '010'.

Isn't most of it already solved by :set nrformats-=octal? Cp :help 
'nrformats'.

 I realize this does mean that ctrl-x not always reverses ctrl-a as
 ctrl-a+ctrl-x on '99' leaves you with '099'.

This would be the only difference to existing behavior, but typically those
numbers have a lot of leading 0-padding, so the case where CTRL-X reduces the
width would be rare, and I think it's best handled by manually correcting it
rather than have a new global option.

-- regards, ingo

PS: Don't feel too bad, Vim has so many options; I myself only learned many
through lurking on this list and on the Vim Tips Wiki ;-)

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


unexpected screen redraw in complete function

2010-07-08 Fir de Conversatie KKde
Hi dev,

I have written my own user defined complete function(written
completely in vim scripting only, no other lang's used). In complete
function, one part of code finds the line no of opening parenthesis of
a function.
I have used the below code to do that.

let line=1
while ( line != 0)
let line = searchpair('(', '', ')', 'bW',
'synIDattr(synID(line(.), col(.), 1), name) =~ cComment')
endwhile

The problem with the above code is searchpair function is very slow.
It takes 6-7 seconds to match the opening parenthesis (Note: opening
parenthesis not farther than 10-15 lines).

I posted in vim_use groups to find effective way of matching
parenthesis ( link :http://groups.google.co.in/group/vim_use/
browse_thread/thread/f44b76248fef00ce)

It was suggested that I use normal % command. Now time to find the
opening parenthesis is reduced to 0.1 sec. But the main problem here
is just before the popup of complete function shows up, screen
flickers a bit.  Sometimes the popup menu isn't showed or sometimes it
is showed at the wrong line other than the cursor. The behavior is
unpredictable. This is irritating me :(



First of all, why searchpair function is damn slow and normal %
command is faster.
And why screen flickers or cursor line is disturbed in complete
function? (as per help manual, the complete function is allowed to
move the cursor)
Can you please suggest what can be done here?

Thanks for your time and help.

Regards,
kkde



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


Re: Patch for updated swedish spell files

2010-07-08 Fir de Conversatie Bram Moolenaar

Mattias Winther wrote:

 I've been busy doing other stuff, but it seems that the new files
 still haven't been included in trunk, so I strongly suspect I should
 do something more in order to get that to happen... Anyone got any
 pointers? Once I have the process down, I figured I'd take a stab at
 updating some more languages as well, but before they actually get
 included, that doesn't seem to do much good. =3D) Just let me know what
 to do!

Updates currently go in the vim73 branch.  But I don't think we have
Swedish spell files, there is no runtime/spell/se directory.

If you want to have files included, please send them to me.

-- 
Error:015 - Unable to exit Windows.  Try the door.

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\download, build and distribute -- http://www.A-A-P.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


[Bug] Cumulative display from :substitute

2010-07-08 Fir de Conversatie Tony Mechelynck
After several :s commands (and some other commands) I see the following 
below my bottom statusline:


1 more line6substitutions on 4 lines2 substitutions on 2 lines2 
substitutions on 2 lines7 substitutions on 4 lines


Other commands make it disappear, and the next subtitute recalls what 
the previous one displayed and appends to it.


gvim 73a 573da4dac306 (Wed Jul 07 18:26:28 2010 +0200) Huge GTK2/Gnome2


Best regards,
Tony.
--
President Reagan has noted that there are too many economic pundits and
forecasters and has decided on an excess prophets tax.

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


Re: [Bug] Cumulative display from :substitute

2010-07-08 Fir de Conversatie Bram Moolenaar

Tony Mechelynck wrote:

 After several :s commands (and some other commands) I see the following 
 below my bottom statusline:
 
 1 more line6substitutions on 4 lines2 substitutions on 2 lines2 
 substitutions on 2 lines7 substitutions on 4 lines
 
 Other commands make it disappear, and the next subtitute recalls what 
 the previous one displayed and appends to it.
 
 gvim 73a 573da4dac306 (Wed Jul 07 18:26:28 2010 +0200) Huge GTK2/Gnome2

I can reproduce it.

-- 
This is an airconditioned room, do not open Windows.

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\download, build and distribute -- http://www.A-A-P.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


Re: Documentation bug in :help /\]

2010-07-08 Fir de Conversatie Bram Moolenaar

Ben Fritz wrote:

 I stumbled on this earlier this week.
 
 :help /\] says:
 
   - To include a literal ']', '^', '-' or '\' in the collection, put a
 backslash before it: [xyz\]], [\^xyz], [xy\-z] and [xyz\\].
 ...
 For '-' you can also make it the first or last character: [-xyz],
 [^-xyz] or [xyz-].  For '\' you can also let it be followed by
 any character that's not in ^]-\bertn.
 
 I think that last sentence should be:
 
 For '\' you can also let it be followed by any character that's
 not in ^]-\bertndoxuU.

I'll correct that.  Thanks.

 Unless there is some reason to exclude the translation codes:
 
   \d123   decimal number of character
   \o40octal number of character up to 0377
   \x20hexadecimal number of character up to 0xff
   \u20AC  hex. number of multibyte character up to 0x
   \U1234  hex. number of multibyte character up to 0x

-- 
The software said it requires Windows 95 or better, so I installed Linux.

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\download, build and distribute -- http://www.A-A-P.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


[patch] fixed memory leak (unlikely to happen)

2010-07-08 Fir de Conversatie Dominique Pellé
Hi

Following code in src/normal.c is wrong, since it calls 'vim_free(buf)'
which does nothing since it's inside 'if (buf == NULL)':

src/normal.c:

!!5565  buf = (char_u *)vim_realloc(buf, STRLEN(buf) + STRLEN(p) + 1);
!!5566  if (buf == NULL)
  5567  {
!!5568  vim_free(buf);
  5569  vim_free(p);
  5570  return;
  5571  }

Although unlikely to happen, it leaks memory since realloc() does
not free 'buf' if it fails.

Attached patch fixes it.

Regards
-- Dominique

-- 
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
diff -r 3331756e4232 src/normal.c
--- a/src/normal.c	Thu Jul 08 22:27:55 2010 +0200
+++ b/src/normal.c	Thu Jul 08 22:39:02 2010 +0200
@@ -5410,6 +5410,7 @@
 {
 char_u	*ptr = NULL;
 char_u	*buf;
+char_u	*realloc_buf;
 char_u	*p;
 char_u	*kp;		/* value of 'keywordprg' */
 int		kp_help;	/* 'keywordprg' is :help */
@@ -5562,13 +5563,14 @@
 	vim_free(buf);
 	return;
 	}
-	buf = (char_u *)vim_realloc(buf, STRLEN(buf) + STRLEN(p) + 1);
-	if (buf == NULL)
+	realloc_buf = (char_u *)vim_realloc(buf, STRLEN(buf) + STRLEN(p) + 1);
+	if (realloc_buf == NULL)
 	{
 	vim_free(buf);
 	vim_free(p);
 	return;
 	}
+	buf = realloc_buf;
 	STRCAT(buf, p);
 	vim_free(p);
 }


Memory leak

2010-07-08 Fir de Conversatie Dimitar DIMITROV
valgrind --leak-check=full --show-reachable=yes gvim

1. cc, then a,a,a,a,a,a,a,a,a,a,a,
2. /\(\(\s*\w\+\s*\)\+,\)\{1,20}
3. :h\{
4. Close gvim

==3987== LEAK SUMMARY:
==3987==definitely lost: 12,986 bytes in 47 blocks.
==3987==indirectly lost: 28,332 bytes in 1,403 blocks.
==3987==  possibly lost: 349,216 bytes in 498 blocks.
==3987==still reachable: 3,245,978 bytes in 47,532 blocks.
==3987== suppressed: 0 bytes in 0 blocks.

VIM - Vi IMproved 7.1 (2007 May 12, compiled Oct 17 2008 18:04:59)
Included patches: 1-314
Compiled by james...@debian.org
Huge version with GTK2 GUI.  Features included (+) or not (-):
+arabic +autocmd +balloon_eval +browse ++builtin_terms +byte_offset +cindent 
+clientserver +clipboard +cmdline_compl
 +cmdline_hist +cmdline_info +comments +cryptv +cscope +cursorshape 
+dialog_con_gui +diff +digraphs +dnd -ebcdic
+emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path +find_in_path 
+folding -footer +fork() +gettext
-hangul_input +iconv +insert_expand +jumplist +keymap +langmap +libcall 
+linebreak +lispindent +listcmds +localmap
+menu +mksession +modify_fname +mouse +mouseshape +mouse_dec +mouse_gpm 
-mouse_jsbterm +mouse_netterm +mouse_xterm
+multi_byte +multi_lang -mzscheme +netbeans_intg -osfiletype +path_extra +perl 
+postscript +printer +profile +python
 +quickfix +reltime +rightleft +ruby +scrollbind +signs +smartindent -sniff 
+statusline -sun_workshop +syntax
+tag_binary +tag_old_static -tag_any_white +tcl +terminfo +termresponse 
+textobjects +title +toolbar +user_commands
+vertsplit +virtualedit +visual +visualextra +viminfo +vreplace +wildignore 
+wildmenu +windows +writebackup +X11
-xfontset +xim +xsmp_interact +xterm_clipboard -xterm_save
   system vimrc file: $VIM/vimrc
 user vimrc file: $HOME/.vimrc
  user exrc file: $HOME/.exrc
  system gvimrc file: $VIM/gvimrc
user gvimrc file: $HOME/.gvimrc
system menu file: $VIMRUNTIME/menu.vim
  fall-back for $VIM: /usr/share/vim
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  
-I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/
usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 
-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/pixman-1 
-g 
-O2 -O2 -g -Wall-D_REENTRANT -D_
GNU_SOURCE -DDEBIAN  -I/usr/local/include -D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64  -I/usr/lib/perl/5.10/CORE  -I/u
sr/include/python2.5 -pthread -I/usr/include/tcl8.4  -D_REENTRANT=1  
-D_THREAD_SAFE=1  -D_LARGEFILE64_SOURCE=1  -I/us
r/lib/ruby/1.8/i486-linux
Linking: gcc   -L.  -rdynamic -Wl,-export-dynamic  -Wl,-E  -Wl,--as-needed 
-L/usr/local/lib -o vim   -lgtk-x11-2.0 -l
gdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lpango-1.0 -lcairo 
-lgobject-2.0 -lgmodule-2.0 -lglib-2.0
-lXt -lncurses -lselinux  -lacl -lgpm -Wl,-E  -L/usr/local/lib  
-L/usr/lib/perl/5.10/CORE -lperl -L/usr/lib/python2.5
/config -lpython2.5 -lutil -Xlinker -export-dynamic -Wl,-O1 
-Wl,-Bsymbolic-functions -L/usr/lib -ltcl8.4 -lieee -lrub
y1.8 -lm



  

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


Memory leak

2010-07-08 Fir de Conversatie Dimitar DIMITROV
1. f1
2. 3yy`]
3. 5yy`]

==4008== LEAK SUMMARY:
==4008==definitely lost: 37,350 bytes in 116 blocks.
==4008==indirectly lost: 28,332 bytes in 1,403 blocks.
==4008==  possibly lost: 319,554 bytes in 469 blocks.
==4008==still reachable: 2,425,077 bytes in 30,351 blocks.
==4008== suppressed: 0 bytes in 0 blocks.

VIM - Vi IMproved 7.1 (2007 May 12, compiled Oct 17 2008 18:04:59)
Included patches: 1-314
Compiled by james...@debian.org
Huge version with GTK2 GUI.  Features included (+) or not (-):
+arabic +autocmd +balloon_eval +browse ++builtin_terms +byte_offset +cindent 
+clientserver +clipboard +cmdline_compl
 +cmdline_hist +cmdline_info +comments +cryptv +cscope +cursorshape 
+dialog_con_gui +diff +digraphs +dnd -ebcdic
+emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path +find_in_path 
+folding -footer +fork() +gettext
-hangul_input +iconv +insert_expand +jumplist +keymap +langmap +libcall 
+linebreak +lispindent +listcmds +localmap
+menu +mksession +modify_fname +mouse +mouseshape +mouse_dec +mouse_gpm 
-mouse_jsbterm +mouse_netterm +mouse_xterm
+multi_byte +multi_lang -mzscheme +netbeans_intg -osfiletype +path_extra +perl 
+postscript +printer +profile +python
 +quickfix +reltime +rightleft +ruby +scrollbind +signs +smartindent -sniff 
+statusline -sun_workshop +syntax
+tag_binary +tag_old_static -tag_any_white +tcl +terminfo +termresponse 
+textobjects +title +toolbar +user_commands
+vertsplit +virtualedit +visual +visualextra +viminfo +vreplace +wildignore 
+wildmenu +windows +writebackup +X11
-xfontset +xim +xsmp_interact +xterm_clipboard -xterm_save
   system vimrc file: $VIM/vimrc
 user vimrc file: $HOME/.vimrc
  user exrc file: $HOME/.exrc
  system gvimrc file: $VIM/gvimrc
user gvimrc file: $HOME/.gvimrc
system menu file: $VIMRUNTIME/menu.vim
  fall-back for $VIM: /usr/share/vim
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  
-I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/
usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 
-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/pixman-1 
-g 
-O2 -O2 -g -Wall-D_REENTRANT -D_
GNU_SOURCE -DDEBIAN  -I/usr/local/include -D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64  -I/usr/lib/perl/5.10/CORE  -I/u
sr/include/python2.5 -pthread -I/usr/include/tcl8.4  -D_REENTRANT=1  
-D_THREAD_SAFE=1  -D_LARGEFILE64_SOURCE=1  -I/us
r/lib/ruby/1.8/i486-linux
Linking: gcc   -L.  -rdynamic -Wl,-export-dynamic  -Wl,-E  -Wl,--as-needed 
-L/usr/local/lib -o vim   -lgtk-x11-2.0 -l
gdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lpango-1.0 -lcairo 
-lgobject-2.0 -lgmodule-2.0 -lglib-2.0
-lXt -lncurses -lselinux  -lacl -lgpm -Wl,-E  -L/usr/local/lib  
-L/usr/lib/perl/5.10/CORE -lperl -L/usr/lib/python2.5
/config -lpython2.5 -lutil -Xlinker -export-dynamic -Wl,-O1 
-Wl,-Bsymbolic-functions -L/usr/lib -ltcl8.4 -lieee -lrub
y1.8 -lm



  

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


Re: Memory leak

2010-07-08 Fir de Conversatie Tony Mechelynck

On 09/07/10 00:26, Dimitar DIMITROV wrote:

valgrind --leak-check=full --show-reachable=yes gvim

1. cc, then a,a,a,a,a,a,a,a,a,a,a,
2. /\(\(\s*\w\+\s*\)\+,\)\{1,20}
3. :h\{
4. Close gvim

==3987== LEAK SUMMARY:
==3987== definitely lost: 12,986 bytes in 47 blocks.
==3987== indirectly lost: 28,332 bytes in 1,403 blocks.
==3987== possibly lost: 349,216 bytes in 498 blocks.
==3987== still reachable: 3,245,978 bytes in 47,532 blocks.
==3987== suppressed: 0 bytes in 0 blocks.

VIM - Vi IMproved 7.1 (2007 May 12, compiled Oct 17 2008 18:04:59)
Included patches: 1-314

[...]

On 09/07/10 00:29, Dimitar DIMITROV wrote:
 1. f1
 2. 3yy`]
 3. 5yy`]

 ==4008== LEAK SUMMARY:
 ==4008== definitely lost: 37,350 bytes in 116 blocks.
 ==4008== indirectly lost: 28,332 bytes in 1,403 blocks.
 ==4008== possibly lost: 319,554 bytes in 469 blocks.
 ==4008== still reachable: 2,425,077 bytes in 30,351 blocks.
 ==4008== suppressed: 0 bytes in 0 blocks.

 VIM - Vi IMproved 7.1 (2007 May 12, compiled Oct 17 2008 18:04:59)
 Included patches: 1-314
[...]

7.1, even 7.1.314, is not the latest version. Among the 445 patches 
already published for the _next_ version (7.2), more than a few were 
leak fixes, see http://ftp.vim.org/pub/vim/patches/7.2/README


If you want to usefully contribute memory leak reports, please use the 
latest version, either the latest stable version (currently 7.2.445) or 
the bleeding-edge development version (7.3a, available only over 
Mercurial, not as a bz2 archive).


See:
http://vim.wikia.com/wiki/Getting_the_Vim_source_with_Mercurial (7.2 or 
7.3a)

http://users.skynet.be/antoine.mechelynck/vim/compunix.htm (compiling)

On Debian, you should be able to use apt-get to get the dependencies 
of the vim-x11 package (or of whatever it is called on that distro).



Best regards,
Tony.
--
For every credibility gap, there is a gullibility fill.
-- R. Clopton

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


Re: Memory leak

2010-07-08 Fir de Conversatie Matt Wozniski
On Thu, Jul 8, 2010 at 6:55 PM, Tony Mechelynck wrote:

 If you want to usefully contribute memory leak reports, please use the
 latest version, either the latest stable version (currently 7.2.445) or the
 bleeding-edge development version (7.3a, available only over Mercurial, not
 as a bz2 archive).
...
 On Debian, you should be able to use apt-get to get the dependencies of
 the vim-x11 package (or of whatever it is called on that distro).

Indeed.  apt-get build-dep vim-gnome

~Matt

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