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

Bug with ZLE special variables and traps?



Hey, zsh-workers:  Is this a recently-introduced bug?  Why is PREBUFFER
empty in a signal handler at patchlevel 1.4940 when it is not at 1.4705?


On Mar 22, 10:42am, Nadav Har'El wrote:
} Subject: Re: Append cancelled commands to history
}
} On Sat, Mar 20, 2010, Bart Schaefer wrote about "Re: Append cancelled commands to history":
} > 
} > Hmm.  When I use TRAPINT, $PREBUFFER is always empty.
} > 
} > torch% print $ZSH_VERSION $ZSH_PATCHLEVEL 
} > 4.3.10-dev-1 1.4940
} 
} Thanks for the explanations. For me, $PREBUFFER does work:
} 
} $ print $ZSH_VERSION $ZSH_PATCHLEVEL
} 4.3.10 1.4705
} $ cat /etc/redhat-release; rpm -qf =zsh
} Fedora release 12 (Constantine)
} zsh-4.3.10-4.fc12.x86_64
} 
} $ functions TRAPINT
} TRAPINT () {
}         zle && [[ $HISTNO -eq $HISTCMD ]] && print -s -r -- "$PREBUFFER$BUFFER"
}         echo "prebuffer: '$PREBUFFER'"
}         return $1
} }
} 
} $ for i in *
} for> do
} for> echo<INTERRUPT>prebuffer: 'for i in *
} do
} '
} 
} $

torch% echo $ZSH_VERSION $ZSH_PATCHLEVEL
4.3.10-dev-1 1.4940
torch% TRAPINT () {
function> zle && [[ $HISTNO -eq $HISTCMD ]] && print -s -r -- "$PREBUFFER$BUFFER"
function> echo "prebuffer: '$PREBUFFER'"
function> return $1
function> }
torch% for i in *
for> do
for> echoprebuffer: ''

torch% 



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