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

Re-reading history from ZLE



Body

Folks,

If a user widget modifies the history, e.g. appends a line using print -s, then the current ZLE instance does not find out about it: history expansion won't have access to it, and the up-history command doesn't "find" it.

% _test_hist() {  
    print -s "echo foo"  
    zle -M "The last line of history is now 'echo foo'  
    zle reset-prompt  
  }
% zle -N _test_hist  
% bindkey '\et' _test_hist  

  # now hit esc-t  
% _  
The last line of history is now 'echo foo'  

The cursor is indicated by the underscore. If I execute up-history, I get the bindkey command line. !$ will contain "_test_hist". Curiously, !! will run echo foo. I suspect this is due to those being different ways to access history for historical reasons, but it's an inconsistency nonetheless.

Is there a reason why reset-prompt shouldn't re-initialise ZLE's understanding of history?

Thanks,

--
@martinkrafft | https://matrix.to/#/#madduck:madduck.net  
 
"the worst part of being old is remembering when you was young."  
                              -- alvin straight (the straight story)  
 
spamtraps: madduck.bogus@xxxxxxxxxxx  


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