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

Re: [BUG] Line number in prompt after `zle reset-prompt'



I would say it's not a bug. I found it possible to replace
"reset-prompt" with "redisplay" which doesn't re-expand prompt.
However, there is one interesting thing:

PROMPT=" %i # "
a() { zle redisplay }
zle -N a
b() { zle redisplay; zle -M "test" }
zle -N b
c() { zle -M "test" }
zle -N c
bindkey "^E" a
bindkey "^R" b
bindkey "^T" c

"a" and "c" will not reexpand prompt, while "b" will, apparently with no reason

Best regards,
Sebastian Gniazdowski


On 31 October 2015 at 21:23, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Oct 31,  7:42pm, Sebastian Gniazdowski wrote:
> }
> } PROMPT="%i # "
> } a() { zle reset-prompt }
> } zle -N a
> } bindkey "^E" a
> }
> } and press Ctrl-E. Line number will change
>
> Not sure this is a bug:
>
> %N
>      The name of the script, sourced file, or shell function that zsh is
>      currently executing, whichever was started most recently.
>
> %i
>      The line number currently being executed in the script, sourced
>      file, or shell function given by %N.
>
> If you use:
>
>     PROMPT="%N %i # "
>
> and then press ^E, you will see
>
>     a 0 #
>
> which is correct, the line number in the function "a" is 0.



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