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

fc -l doesn't match %h number?



It looks to me like "fc -l" is not showing a command in the history
that %h is counting when one enters a new subshell.
Consider this program:

#==============================
fc -ap /tmp/hist 10 10
hook() {
    line=''
    fc -l 2>/dev/null
    print subshell level: $ZSH_SUBSHELL
    print $ZSH_DEBUG_CMD
    vared -e -h -p 'hist<%h> ' line
    [[ $line == 'q' ]] && exit
    print -s -- "$line"
}

trap 'hook' DEBUG
x=2
( x=3;
  y=4
)
x=5
#==============================

Now let's run:
$ zsh fc.sh

subshell level: 0
x=2
hist<1> a

    1  a
subshell level: 0
(
	x=3
	y=4
)
hist<2> b

    1  a
subshell level: 1
x=3
hist<3>
# ...


Notice that the numbers in angle brackets keep increasing <1>, <2>,
<3> as they should. However above "hist<3>" we just see "1  a" listed
and not "b".

Am I doing something wrong? Thought's about what's going on here?

Thanks.



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