Loading ...
Sorry, an error occurred while loading the content.

66603Re: [patch] implement undo in :s_flags

Expand Messages
  • Christian Brabandt
    Oct 1, 2012
    • 0 Attachment
      On Sun, September 30, 2012 15:41, Andy Wokula wrote:
      > Am 30.09.2012 14:42, schrieb Bram Moolenaar:
      >> Christian Brabandt wrote:
      >>> Bram,
      >>> attached patch implements undo when doing :s/.../.../gc
      >>> This has been requested recently in
      >>> https://groups.google.com/group/vim_dev/msg/9930ef0f86421814
      >>> And I think, I saw a request like this on the sf.net bug tracker, but I
      >>> can't find it right now. Additionally, I also added using Ctrl-L for
      >>> redrawing the screen as I found this useful.
      >> Yeah, this is useful. But also tricky, if the undo is done wrong then
      >> the text may get messed up. Can you think of situations where something
      >> could go wrong? And it would be nice to have tests for that.
      > What about a replacement function that edits text?
      > com! InsaneSubst :%s/\w\+/\=InsaneEdit(submatch(0))/
      > func! InsaneEdit(str)
      > $put = a:str
      > return '('. a:str. ')'
      > endfunc

      This works, although I would personally don't think this is very
      reasonable. :%s will not consider the newly added lines (it determines
      the range before starting the command) and I have seen strange effects
      when doing a replacement and the function changes the text directly
      (e.g. E315 ml_get: invalid lnum...)


      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
    • Show all 7 messages in this topic