Bugs in visual mode marks?
Has something changed recently in the way Visual mode marks are handled? I have a couple of functions using '<, '> and the like and they have started misbehaving recently. Today, I checked the value of getpos("'>") after selecting some text, and got: [0, 15, 2147483647, 0] This using Vim 9.0.493 on an M1 Mac. I am investigating the problem, but I am curious to know whether it is a known (and perhaps solved) issue. Thanks, Life. -- -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/tgvgj4%24udl%241%40ciao.gmane.io.
Re: Bugs in visual mode marks?
On 2022-09-27, Lifepillar wrote: > Today, I checked the value of getpos("'>") after selecting some text, > and got: > > [0, 15, 2147483647, 0] Now I have seen that the large number is expected. I will try to make a reproducible example of my issue. Life. -- -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/tgvh19%24udl%242%40ciao.gmane.io.
Re: Bugs in visual mode marks?
Source this script: vim9script def g:Select(): list const lnum1 = getpos("'<")[1] const lnum2 = getpos("'>")[1] return getline(lnum1, lnum2) enddef vnoremap x echo Select() Then select some line(s) and type \x. What I would expect (and what I think Vim used to do up to recently, unless I am missing something) is that the *currently* selected lines are echoed. Instead, the *previously* selected lines are printed. Can you reproduce it? Is it a bug? Tested with Vim 9.0.611. Thanks, Life. -- -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/tgvj5t%24rbc%241%40ciao.gmane.io.
Re: Bugs in visual mode marks?
вт, 27 сент. 2022 г., 22:33 Lifepillar : > Source this script: > > vim9script > > def g:Select(): list > const lnum1 = getpos("'<")[1] > const lnum2 = getpos("'>")[1] > return getline(lnum1, lnum2) > enddef > > vnoremap x echo Select() > > Then select some line(s) and type \x. What I would expect (and what > I think Vim used to do up to recently, unless I am missing something) is > that the *currently* selected lines are echoed. Instead, the > *previously* selected lines are printed. Can you reproduce it? Is it > a bug? > > Tested with Vim 9.0.611. > > Thanks, > Life. > > -- > -- > 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. > To view this discussion on the web visit > https://groups.google.com/d/msgid/vim_use/tgvj5t%24rbc%241%40ciao.gmane.io > . > You're using cmd token that doesn't switch the modes. The effect is that as long as you're in visual mode the < and > marks are not updated. This is the way how it works and always worked. Call getpos("v") instead, or change cmd to colon. See also :h line() Kind regards, Matvey > -- -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAFsTB%2B%2BqLqZEYY2_9rJA7BCBceS7XcieiL2aXK-7JZQgJT0P0w%40mail.gmail.com.
Re: Bugs in visual mode marks?
On 2022-09-27, M wrote: > You're using cmd token that doesn't switch the modes. The effect is that as > long as you're in visual mode the < and > marks are not updated. This is > the way how it works and always worked. Aha, that's it! In fact, I have switched to use when I have migrated to Vim 9 script. Somehow I thought it was a substitute for :, but there are other differences. Thanks, Life -- -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/tgvl7o%24621%241%40ciao.gmane.io.