Addresses issue #19049.
When a visual selection is reversed (the cursor is at the start of the selection), getpos() and setpos() operate inconsistently on the visual marks '< and '>.
When setmark_pos() in src/mark.c sets visual marks, it assigns to vi_start or vi_end without checking their relative order. This is in contrast to getmark_buf_fnum() which returns based on relative order.
This patch applies the logic found in getmark_buf_fnum() to setmark_pos() so that vim function setpos() updates the leftmost/rightmost marks on '< and '> respectively.
https://github.com/vim/vim/pull/19070
(1 file)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@numEricL pushed 2 commits.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
There is another typo "reltaive"
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@chrisbra commented on this pull request.
> @@ -4879,6 +4879,10 @@ getpos({expr}) *getpos()*
within the line. To get the character position in the line,
use |getcharpos()|.
+ The visual marks '< and '> refer to the beginning and end of
+ the visual selection relative to the buffer. Note that this
+ differs from |setpos()|, where they are reltaive to the cursor.
⬇️ Suggested change
- differs from |setpos()|, where they are reltaive to the cursor. + differs from |setpos()|, where they are relative to the cursor.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Likely too many downstream breaks would result from ensuring consistency, instead clarify behavior in docs.
I agree it is a backwards incompatible change, but I think we should still change this for consistency reasons. I can merge the documentation update now, but I think we should fix this after the 9.2 release.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
thanks, I tried to make it a bit clearer and have added a few more help text references and also fixed a typo while at it.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()