James McCoy wrote:
> According to “:help 'formatexpr'”,
>
> The expression is also evaluated when 'textwidth' is set and adding
> text beyond that limit.
>
> However, even when 'formatoptions' doesn't contain "a", one can see that
> a set 'formatexpr' is called every time a character is typed, regardless
> of whether 'textwidth' is exceeded. In fact, most of the (rather few)
> uses of 'formatexpr' which explicitly handle insert-mode reformatting
> have added the check that the help claims to already be doing.
>
> In order to reduce the amount of boilerplate in scripts and conform
> better to the help, the attached patch performs this check for the user.
> Note, 'formatexpr' will still be called if the cursor is < 'textwidth'
> but other conditions necessitate formatting (like the "a" formatoption).
Perhaps we need to update the documentation. The problem is that
computing virtcol is expensive. It should at least use the cached value
w_virtcol, if it's valid.
I also think that if we have this check for using 'formatexpr', then it
should also be used for the internal formatting.
--
ARTHUR: Right! Knights! Forward!
ARTHUR leads a charge toward the castle. Various shots of them battling on,
despite being hit by a variety of farm animals.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// 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.