Ben Schmidt wrote: > >>> So, what about executing > >>> 1000@@ > >>> as > >>> @@999@@ > >>> > >>> (where in turn 999@@ is executed as > >>> @@998@@ > >>> and so on ... and 2@@ as > >>> @@1@@ > >>> and 1@@ as > >>> @@ > >>> )? > >> > >> I like the idea. Hadn't thought of using recursion when I wrote about > >> the issue earlier, but yes, of course, that's an obvious and simple way > >> to implement it. Putting together a patch would only take a couple of > >> minutes. > >> > >> What do you think, Bram? I don't think anything could really > >> meaningfully make use of the current behaviour, so even though > >> technically it would break backward compatibility it wouldn't break > >> anything useful. > > > > You can't rely on the register not changing in the first @@, thus the > > following 999@@ may do something completely different. Won't work. > > Well, yes, but you could make 1000@a stuff @a999@a into the buffer and > avoid that problem.
No, the first @a may still change the "a register, thus it will work differently. > If you mean the contents of the register changing, that was the point of > the suggestion. The contention is that if a macro changes the register > in which it is stored, it is expected that the change will take effect > immediately after that run of the macro, not after a counted number of > runs have completed. I think that's fair enough, because it's strange to > think @a@a should work differently to 2@a and hard to imagine where the > current behaviour would be useful (i.e. having only the 'last' change of > the register take effect). This is functionality inherited from Vi, and I like to keep them work exactly like in Vi. Some macros might rely on the details, such as 2@a working different from @a@a. If the problem is that 1000@@ takes too much memory, then there are other solutions that are not visible to the user. E.g., instead of allocating 1000 times the memory, only allocate twice and keep feeding a copy of the register into it. It's more work to implement though. -- Q: What's a light-year? A: One-third less calories than a regular year. /// 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
