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

Re: PATCH: changing terminal cursor form



Mikael Magnusson wrote:
> Will this leave my cursor color/shape alone if I don't do anything to
> enable this mechanism? (I already have things set up in shell code
> which do things this system doesn't appear to be able to do).

A default shape is set for three contexts and if you use those contexts,
it will change the cursor. More generally, if you use emacs mode you
probably won't notice anything whereas vi mode is noticeably affected.
The exception to that generalisation is overwrite-mode for which this
does currently set a default. We could drop that or overwrite and
(vi)replace could be separate contexts. However there's also a strong
case for setting a default for regionstart and regionend because the
default behaviour with a reverse video region and reverse block cursor
is not ideal.

A web search brings up many cases of vi mode users either seeking help
or sharing .zshrc files, primarily to toggle between a bar and block
cursor for insert/normal mode. I'm not even finding other use cases. I'd
rather that we provide a better default experience for a good few users
where the cost is inconveniencing a small number of fairly advanced
users such as yourself into adding .term.extensions+=( -cursor ) to
.zshrc.

I'd be interested in more details of what you do which this system
doesn't handle. I'm aware that this has added something analagous to
zle_highlight without an equivalent to region_highlight. To extend this
out for custom widgets, something like a CURSORCONTEXT zle widget
variable to which you could assign a custom context to would be one
option. It'd be up to the widget writer to ensure it gets unset later.
That approach doesn't handle competing widgets that both want to use the
variable. Maybe CURSORCONTEXT could be an array (for a stack) or perhaps
that's over-complicating things. Would that handle your use case?

Also, should the naming be .zle.cursorform? I didn't use the namespace
because it is similar to zle_highlight. Maybe we should make the old
names namerefs into the namespace?

Oliver




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