Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: highlight pasted text



On Jul 23, 10:06pm, Bart Schaefer wrote:
}
}    zle yank
}    zle -R
}    zle read-command && zle $REPLY

That doesn't work with yank-pop, sadly, but can anyone point out a
problem with this tiny patch?


diff --git a/Src/Zle/iwidgets.list b/Src/Zle/iwidgets.list
index ebcf317..657e4ef 100644
--- a/Src/Zle/iwidgets.list
+++ b/Src/Zle/iwidgets.list
@@ -94,7 +94,7 @@
 "quoted-insert", quotedinsert, ZLE_MENUCMP | ZLE_KEEPSUFFIX
 "quote-line", quoteline, 0
 "quote-region", quoteregion, 0
-"read-command", readcommand, 0
+"read-command", readcommand, ZLE_NOTCOMMAND
 "recursive-edit", recursiveedit, ZLE_MENUCMP | ZLE_KEEPSUFFIX | ZLE_LASTCOL
 "redisplay", redisplay, ZLE_MENUCMP | ZLE_KEEPSUFFIX | ZLE_LASTCOL
 "redo", redo, ZLE_KEEPSUFFIX


Then you can do:

    zle yank
    zle -R
    while zle read-command
    do
      # This looks odd but "zle $REPLY" might change $REPLY
      # so we have to test it before doing anything else
      if [[ $REPLY = (.|)yank-pop ]]
      then
        zle $REPLY
      else
        zle $REPLY
        break
      fi
    done

Alternately,

    zle yank
    zle -R
    zle recursive-edit

Of course that requires an extra accept-line to escape from the
recursive-edit.  You could fix that with some fancy keymap stuff
passed with -K to recursive-edit, see Functions/Zle/keymap+widget
for possible inspiration.



Messages sorted by: Reverse Date, Date, Thread, Author