zsh-workers
 help / color / mirror / code / Atom feed
* Remove (probably?) unhelpful check in narrow-to-region
@ 2006-10-01 22:50 Mikael Magnusson
  2006-10-02 10:08 ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: Mikael Magnusson @ 2006-10-01 22:50 UTC (permalink / raw)
  To: zsh-workers

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Remove (probably?) unhelpful check in narrow-to-region
  2006-10-01 22:50 Remove (probably?) unhelpful check in narrow-to-region Mikael Magnusson
@ 2006-10-02 10:08 ` Peter Stephenson
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 2006-10-02 10:08 UTC (permalink / raw)
  To: Zsh hackers list

"Mikael Magnusson" <mikachu@gmail.com> wrote:
> 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.

I've changed it; I don't think I ever tried this out, but there's
no reason why it shouldn't work.

> 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.

At this point in the code we're dealing entirely with items supposedly
directly added by the user, which are therefore made visible in
zle_refresh.c.  General handling for highlighting would be very useful but
isn't that easy.  It's particularly hard if you want to track the start and
end of special effects through future modifications to the line.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-10-02 10:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-01 22:50 Remove (probably?) unhelpful check in narrow-to-region Mikael Magnusson
2006-10-02 10:08 ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).