I have attached a demonstration script. If you edit then source it in a new Vim instance you will get "0 0" then "1 1" echoed into the message history, but it should be "1 1" then "2 2".
If you change the \test mapping to have a preceding <c-c> in the rhs, you get the expected output, which is "1 1" then "2 2". On Tue, Feb 1, 2022 at 4:13 AM Bram Moolenaar <[email protected]> wrote: > > Christian J. Robinson wrote: > > > I have several visual mappings that could benefit from <ScriptCmd> but > they > > call functions that rely on the `< and `> marks to be properly set, and > > <ScriptCmd> doesn't make sure they are "current" so the marks from a > > previous visual selection are used. > > > > If I prefix the <ScriptCmd> with <C-C> the marks update. > > > > It took me a while to figure this out as the behavior was so strange to > me > > (and my mappings/functions are fairly complex). > > I don't understand what you mean. The <ScriptCmd> mapping doesn't do > anything with the '< and '> marks. And I don't see how CTRL-C does > anything but end Visual mode. > > The idea with <ScriptCmd> is that it can be used in any mode and returns > to that mode after doing its work. > > -- > Never under any circumstances take a sleeping pill > and a laxative on the same night. > > /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net > \\\ > /// > \\\ > \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ > /// > \\\ help me help AIDS victims -- http://ICCF-Holland.org > /// > -- Christian J. Robinson <[email protected]> -- -- 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]. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/CAK14FZKzVR-ByeRQVPobWkJw%3DhsWM%2B93KxzULUXKiUMrSYxb3w%40mail.gmail.com.
scriptcmd_visual_bug.vim
Description: Binary data
