Christian Brabandt wrote:

> On Di, 24 Jun 2014, Christian Brabandt wrote:
> 
> > On Di, 24 Jun 2014, Axel Bender wrote:
> > 
> > > Does anyone know a UTF-8-aware (respecting $LC_ALL and/or $LANGUAGE) sort 
> > > tool for Windows (GNUWin32's doesn't work), preferably a working GNU sort 
> > > that does the job? [OFF-TOPIC]
> > 
> > Cygwin, Msys, Interix? Not sure, but not sure, which one does support 
> > UTF-8. I can't believe GNUWin32 doesn't support UTF-8.
> > 
> > > It would be a nice idea [NO LONGER OFF-TOPIC] to add the possibility to 
> > > add sort columns (like in GNU's --key=<field>.<char>) to vim's :sort 
> > > command. Doing so would the first problem above obsolete...
> > 
> > It should be possible, to Script something using viml. Perhaps some of 
> > the Viml librariesāļ™ provide such a possibility already?
> 
> While being at the topic of :sort, I noticed there seems to be a bug 
> with :sort, that it will try to sort, even when there would be nothing 
> to sort.
> 
> Using the example from Axel, and do :sort! r /foobar/
> You'll notice, Vim will randomly sort your buffer. So here is a patch, 
> that skips sorting, if the RE doesn't match anything (this might also be 
> caused by an illegal pattern) and will therefore not randomly change 
> your buffer. So here is a patch.

Sounds like a good idea.

It's not obvious that skip_sort is only incremented once inside the
loop.  Perhaps set a flag and increment at the end?

> +    /* pattern did not match in any line, skip sorting */
> +    if (skip_sort == eap->line2)
> +     goto sortend;

I don't think this works when eap->line1 is not 1, sorting a range of
lines.


-- 
I still remember when I gave up Smoking, Drinking and Sex.  It was the
most *horrifying* hour of my life!

 /// Bram Moolenaar -- [email protected] -- 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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui