On Tue, 6 Nov 2018 at 18:16, Peter Stephenson wrote: > > On Tue, 2018-11-06 at 18:08 +0100, Sebastian Gniazdowski wrote: > > I now see that testing the running of zle widgets is in general > > difficult, even with zpty. > > For sure. zpty just doesn't provide a robust enough platform, at least > in its current state. This is true for the job control tests, too, with > the asymmetric messages popping up. > > I've been groping for suggestions but haven't really got any directions. I've managed to test region_highlight altered in zle widget, triggered by zpty -w zsh $'\C-a', with zpty-zshell running without +Z (i.e. no disabling of Zle). Use of Zle means that test's commands will be echoed back, but it doesn't look bad, e.g.: zpty_start zpty_input 'rh_widget() { BUFFER="true"; region_highlight+=( "0 4 fg=#040810" ); }' nl zpty_input 'zle -N rh_widget' nl zpty_input 'bindkey "\C-a" rh_widget' nl zpty_input $'\C-a' zpty_line 6 # 3 lines echoed back + 3 empty lines zpty_line 1 p # o is for "preserve" – to keep colour escapes converting them to regular strings zpty_stop 0:basic region_highlight with true-color (hex-triplets) >rh_widget() { BUFFER="true"; region_highlight+=( "0 4 fg=#040810" ); } >zle -N rh_widget >bindkey "\C-a" rh_widget >0m38;2;4;8;16mtrue39m >exit Complete ztst-file is attached. Is there a chance it will be added to upstream? -- Sebastian Gniazdowski News: https://twitter.com/ZdharmaI IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin Blog: http://zdharma.org