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

Re: User-defined replacement for *-line-or-search in 3.1.4



On Jun 9,  1:23pm, I wrote:
} Subject: User-defined replacement for *-line-or-search in 3.1.4
}
} Shouldn't $#LBUFFER == $CURSOR == $#moveorsearchpattern on first call to this
} function?  If so, why is the +1 necessary?  (If I leave it out, the call to
} history-beginning-search-*ward uses too short a prefix.)
} 
} --- 8< --- snip --- 8< ---
} 
} 	    # Why is +1 needed here, but not needed at $#BUFFER?
} 	    CURSOR=$[$#moveorsearchpattern+1]
} 	    zle history-beginning-search-backward
} 	    CURSOR=$#BUFFER

I've just been fooling with this in the debugger, and I can no longer get
the behavior I was seeing where adding one to the pattern length was
necessary.  I don't know what strangeness I had going on, though I have
done a rebuild in the interim ... anyway, I recommend changing the first
assignment of CURSOR to

	CURSOR=$#moveorsearchpattern

in both of the functions I posted earlier today.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



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