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

Re: State of the ZLE region across new prompts



On Mon, 11 Jul 2016 21:28:14 -0700
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> Consider:
> 
>     zle-line-finish() { CURSOR=0 MARK=$#BUFFER REGION_ACTIVE=1 }
>     zle -N zle-line-finish
> 
> The idea here, such as it is, is to highlight the entire buffer before
> it is executed.  (I was doing this to test something unrelated.)
> 
> With this in place, run a command, then when ZLE resumes at the next
> prompt, start recalling commands with up-line-or-history.  Note that
> they are highlighted.  I'm not entirely sure but I believe this means
> the region is still active, not just that highlighting is confused.
> Is REGION_ACTIVE intended to persist in this way?

I think the problem is that region_active is set to 0 at the end of
zlecore(), so you're missing it when zle-line-finish is called.  This is
therefore an edge case.

It's presumably reasonable also to set it to 0 on any entry to the
top-level of ZLE at the start of zleread(). 

pws



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