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

Re: zle-line-finish behavior and documentation



On 2016-01-21 11:04:49 -0800, Bart Schaefer wrote:
> The PS1 prompt does get updated on reset-prompt, it works with:
> 
>   PS1="%1v$PS1"
>   zle-line-init () {
>     (( $+ZLE_LINE_ABORTED )) && psvar[1]='ABORT ' || psvar[1]=''
>     unset ZLE_LINE_ABORTED
>     zle reset-prompt
>   }

Thanks. It works also together with my previous code related to the
exit status. My code now has:

precmd()
{
  psvar[1]=$?
  if [[ $psvar[1] -gt 128 ]] then
    local sig=$signals[$(($psvar[1]-127))]
    [[ -n $sig ]] && psvar[1]=$sig
  fi
  [...]
}

zle-line-init()
{
  [...]
  (( $+ZLE_LINE_ABORTED )) && psvar[1]+=!
  unset ZLE_LINE_ABORTED
  zle reset-prompt
}

zle-line-finish()
{
  zle reset-prompt
}

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)



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