Detecting `undo` and `redo` from TextChanged

2018-04-16 Thread Jason Felice
The plugin I'm working on updates the buffer after every change and uses
:undojoin.  Unfortunately, sometimes the change *is* an undo, in which
case, :undojoin kills the history.  What's the best way to detect whether
the operation is an undo or redo for this purpose?

The only thoughts I have are to  nmap u and  (ick), or to somehow
check the number returned by getchangelist()... although I
getchangelist('%')[1] doesn't seem to ever return the current change, as
far as I can tell.

Thanks,
-Jason

-- 
-- 
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Two spaces after punctuation and SpellCap issues

2018-04-16 Thread Bram Moolenaar

Tim Chase wrote:

> To reproduce:
> 
>   $ vim -u NONE
>   :syntax on
>   :set spell cpo+=J
> 
> to let vim know I always put two spaces after a sentence.  However,
> if I enter text like
> 
>   Call Bob re. the faucet.
> 
> or
> 
>   Take Main St. the whole way down.
> 
> vim's syntax highlighting flags "the" in SpellCap as if it's
> expecting the "." to mark the end of the sentence and require "the"
> to be capitalized (as "z=" provides as its top suggestion).
> 
> My understanding is that the cpo+=J should require two spaces for it
> to be considered a sentence, but it looks like it's ignoring this
> flag when engaging the SpellCap group (which seems to think it's at
> the end of a sentence).

That 'cpo' flag is not related to spell checking.  The spell checking
relies on recognizing the abbreviation.  I don't see "the" after "St."
highlighted for that reason.

> Am I missing something or is this possibly a bug?

Let's call it a feature request.

Note that this won't cover everything, esp. a dot at the end of the line
would normally not have spaces after it, thus Vim can't know whether
it's the end of a sentence or not.

-- 
hundred-and-one symptoms of being an internet addict:
202. You're amazed to find out Spam is a food.

 /// 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_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is ANSI C support still needed?

2018-04-16 Thread Bram Moolenaar

David Demelier wrote:

> On Sun, 2018-04-15 at 12:43 +0200, Bram Moolenaar wrote:
> > For a long time Vim code was made to be compiled with ANSI C (also
> > known
> > as C89 and ISO C90).  This means it can also be compiled on very old
> > systems.  And since it wasn't too much work to support it, that was
> > the
> > choice.
> 
> C99 being 19 years old should be the default for a while. To me, I
> don't see any reason to support C89 nowadays. Even MS has finally added
> C99 in recent VisualStudio versions ;)

It's this "in recent VisualStudio" that worries me.  So C99 support was
lacking for many years, and even now some things are "optional".

Users may be stuck with an older compiler for many reasons.  Sticking
with C89 is putting the level too low, but requiring a full C99 compiler
is too much.

We cannot rely on all compilers to support all C99 features.
We will have to pick the ones that we can use.

I'll make some patches to introduce C99 features, so that we can check
what actually works.

-- 
hundred-and-one symptoms of being an internet addict:
194. Your business cards contain your e-mail and home page 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_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is ANSI C support still needed?

2018-04-16 Thread David Demelier
On Sun, 2018-04-15 at 12:43 +0200, Bram Moolenaar wrote:
> For a long time Vim code was made to be compiled with ANSI C (also
> known
> as C89 and ISO C90).  This means it can also be compiled on very old
> systems.  And since it wasn't too much work to support it, that was
> the
> choice.
> 

C99 being 19 years old should be the default for a while. To me, I
don't see any reason to support C89 nowadays. Even MS has finally added
C99 in recent VisualStudio versions ;)

Regards,

-- 
David

-- 
-- 
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.