From: martin f krafft <madduck@madduck.net>
To: zsh-workers@zsh.org
Subject: Re-reading history from ZLE
Date: Wed, 24 Aug 2022 17:20:23 +0200 [thread overview]
Message-ID: <YwZBtx8LANojlJ1o@lotus.rw.madduck.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 1140 bytes --]
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@madduck.net
[-- Attachment #2: Type: text/html, Size: 2491 bytes --]
next reply other threads:[~2022-08-24 15:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-24 15:20 martin f krafft [this message]
2022-08-24 21:16 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YwZBtx8LANojlJ1o@lotus.rw.madduck.net \
--to=madduck@madduck.net \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
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).