Sunday, December 6, 2015

Re: programmatically determine blockwise visual mode

Christian Brabandt wrote:

> Hi,
> let's say I have script, that wants to work on the last visually
> selected region, e.g. highlight it.
>
> Is there any way, to find out, whether the last block-wise selected
> region used '$' for selection (see :h v_$) or not? This matters, since
> when using the '$' in visual block mode, all lines up to the end will be
> selected, while when simply using the cursor to select the end point,
> only up to the column specified in the last line will be acted on.

Normally the col() function could do this, but it has code specifically
for this situation and drops the information.

We could add an optional argument to col() to return MAXCOL, but that
would be weird.

getpos() also can't do it, the "curswant" entry is only there for
getcurpos(). Adding getvispos() is weird too.

Still seems the extra argument to col() is the least worst solution.

--
"You mean there really is an answer?"
"Yes! But you're not going to like it!"
"Oh do please tell us!"
"You're really not going to like it!"
"but we MUST know - tell us"
"Alright, the answer is...."
"yes..."
"... is ..."
"yes... come on!"
"is 42!"
(Douglas Adams - The Hitchhiker's Guide to the Galaxy)

/// Bram Moolenaar -- Bram@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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: