Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Identify "active" region?
- X-seq: zsh-workers 24905
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Identify "active" region?
- Date: Sat, 03 May 2008 17:52:19 -0700
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
I'd like to write a widget that does
if [[ there is an active region ]]
then zle kill-region
else zle backward-kill-word
fi
(In fact, I'm tempted to write it in C and make it the default binding
for ^W, but that's somewhat beside the point of this message.)
There doesn't seem to be any way to determine that there's an active
region except to override set-mark-command and exchange-point-and-mark
to stash something in a global variable. Have I missed something?
(I thought perhaps I could peek into $region_highlight in the latest
from CVS, but that doesn't update on the fly.)
Opinions on usefulness going forward of detecting the active region?
A distinguished value of MARK appears too problematic, so it'd have to
be another zle variable, or ...?
For the time being I'm using the less-than-satisfactory
(( MARK > 0 && MARK != CURSOR ))
which isn't *that* bad since if I meant to kill all the way to the
beginning of the line I'd probably use kill-whole-line, and at worst
I just have to do exchange-point-and-mark first.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author