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

Remove (probably?) unhelpful check in narrow-to-region



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