help / color / mirror / code / Atom feed
* Re-reading history from ZLE
@ 2022-08-24 15:20 martin f krafft
  2022-08-24 21:16 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: martin f krafft @ 2022-08-24 15:20 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 1140 bytes --]


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?


@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@madduck.net

[-- Attachment #2: Type: text/html, Size: 2491 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-24 21:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-24 15:20 Re-reading history from ZLE martin f krafft
2022-08-24 21:16 ` Bart Schaefer

Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).