Subject: Re: zle -U "$selected" doesn't handle (some?) multibyte characters
From: Bart Schaefer <[email-masked]>
To: Zsh hackers list <[email-masked]>
Date: Sun, 10 Jan 2016 12:51:49 -0800
List-Id: Zsh Workers List <zsh-workers.zsh.org>

On Jan 10, 12:38pm, Sebastian Gniazdowski wrote:
}
} Is there any alternative to zle -U, to support older Zshells?

There's not really an alternative to "zle -U" because of the way the
input stack works, but with some effort you can work around the
metafication problem.  You need to define a new key sequence for each
metafied character (similar to the way insert-composed-char works)
and substitute those into the string before pushing it with "zle -U".

If the only reason you need zle -U is for delayed-action self-insert
(no movement/command widgets involved), then you can define a widget
that manages a stack (array param) of values to be appended onto
LBUFFER, and each time you "zle -U" the key bound to that widget you
also put a new value on the stack array.

There might also be a way to work "bindkey -s" in there so that you
can "execute" the value from the top of the stack instead of just
appending it to LBUFFER, but I'm not going to try to figure that out.