Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Remove (probably?) unhelpful check in narrow-to-region
- X-seq: zsh-workers 22804
- From: "Mikael Magnusson" <mikachu@xxxxxxxxx>
- To: zsh-workers <zsh-workers@xxxxxxxxxx>
- Subject: Remove (probably?) unhelpful check in narrow-to-region
- Date: Mon, 2 Oct 2006 00:50:12 +0200
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=Je3M4iJrdaNcBl556pvAuCHAEBRsn8yAsSrQZaVIOt5Z06meoYXXUk+05GmpNOcUGdv2d1PoKrbiE+3kB20scg+AzR8HKIiUdIQi1lmZREIjAhIuoMLX7VU5bIkC9GnZV1EHvdME1+hweEXDHW5WxOx/4rD0U0XLlVDE/2F2rNE=
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
With this change, you can press set-mark, narrow-to-region with the
cursor in the same place, without it you always have to include one
character in the narrowed region. This is useful for example if you
want to insert some command from history, just press the combo and
history search or whatever like usual, then press enter. I tried it
out for a bit and i haven't been able to find any negative effects.
PS I tried to include some ansi color codes in the -p and -P arguments
but they just get printed literally, would it be possible to print
them evaluated instead? I stared at the code for 5 minutes but
couldn't figure out where the extra quoting is added.
Index: Functions/Zle/narrow-to-region
===================================================================
RCS file: /cvsroot/zsh/zsh/Functions/Zle/narrow-to-region,v
retrieving revision 1.2
diff -p -u -d -r1.2 narrow-to-region
--- Functions/Zle/narrow-to-region 5 Jul 2002 10:49:47 -0000 1.2
+++ Functions/Zle/narrow-to-region 1 Oct 2006 22:46:23 -0000
@@ -68,9 +68,7 @@ if [[ -n $_ntr_save || -z $_ntr_restore
_ntr_end=$CURSOR
fi
- if (( _ntr_start == _ntr_end )); then
- return 1
- elif (( _ntr_start > _ntr_end )); then
+ if (( _ntr_start > _ntr_end )); then
_ntr_swap=_ntr_start
_ntr_start=_ntr_end
_ntr_end=_ntr_swap
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author