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

Re: zle-line-finish behavior and documentation



On Jan 21,  1:46pm, Vincent Lefevre wrote:
}
} OK, but if the goal is to reset the previous prompt, that's too late.

I guess the assumption was that if you're aborting the line there's no
reason to update the previous prompt.

} There would also be other two problems:
} 1) $ZLE_LINE_ABORTED gets empty when one does Ctrl-C on an empty line.
} 2) $ZLE_LINE_ABORTED is not reset when a command line is not aborted.

Hmm.  I think it *should* work to do e.g. this:

  zle-line-init() {
    (( $+ZLE_LINE_ABORTED )) && RPS1=ABORT || unset RPS1
    unset ZLE_LINE_ABORTED
    zle reset-prompt
  }

And indeed ZLE_LINE_ABORTED is set-but-emtpy after an interrupt on a blank
command line, and is unset after an accept-line.  For some reason, though,
reset-prompt doesn't redraw the right prompt until the second consecutive
interrupt.

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
  }



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