Bug 32639

Summary: broken last-argument history
Product: Sisyphus Reporter: Michael Shigorin <mike>
Component: zshAssignee: Fr. Br. George <george>
Status: ASSIGNED --- QA Contact: qa-sisyphus
Severity: minor    
Priority: P3 CC: arseny, george
Version: unstable   
Hardware: all   
OS: Linux   

Description Michael Shigorin 2016-10-20 20:53:34 MSK
$ grep '()
[pressed Enter too early, typing mistake]
quote> 
[pressed Ctrl-C]
$ grep '()' 
[pressed Alt-. thrice to recall the last argument of a preceding command]
$ grep '()' '()'()'()

2 george: I understand it's not the package bug but upstream one,
          chose to post at least here before leaving the office...
Comment 1 Fr. Br. George 2016-12-14 14:18:56 MSK
How very funny :(
Comment 2 Fr. Br. George 2017-02-09 09:48:03 MSK
Now, after a time passed, I can not guess, why it is a bug? Seems to me "'()" is actual last argument. So what do we expect intead7
Comment 3 Michael Shigorin 2017-02-09 15:40:59 MSK
(В ответ на комментарий №2)
> So what do we expect intead7
"Scrolling" three last-arg history positions up, obviously.
Comment 4 Arseny Maslennikov 2023-04-27 12:31:23 MSK
(In reply to Michael Shigorin from comment #3)
> (В ответ на комментарий №2)
> > So what do we expect intead7
> "Scrolling" three last-arg history positions up, obviously.

Instead of improving/fixing insert-last-word (implemented in C source), upstream has been recommending the following commands:
    % autoload -Uz smart-insert-last-word
    % zle -N insert-last-word smart-insert-last-word
to be included in .zshrc.