Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: command line highlighting
- X-seq: zsh-workers 24783
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx (Zsh hackers list)
- Subject: Re: PATCH: command line highlighting
- Date: Thu, 03 Apr 2008 12:30:14 +0200
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.uk; h=Received:X-YMail-OSG:X-Yahoo-Newman-Property:Received:In-reply-to:From:References:To:Subject:Date:Message-ID; b=XvnH8jcE0frm67LI2r/w/3DoF1ni5aSN+YvfK563PZKi2gADAQ73VXYYYxMXgDSXzEpzhn7/thZ7psN73UFwbZKpLDMvmqdAGAGXkgeue7/CfStX1pSMGNhqkcV8W9Dw1JbKSVYWSh57INJKhCgpBp95Xf3mvHTmD09nLIW1ewc= ;
- In-reply-to: <8360.1207165155@pws-pc>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <8360.1207165155@pws-pc>
Peter Stephenson wrote:
> Now 4.3.6 is out of the way, here's something I've been working on. It
> highlights the normal command line (not a completion list) in three
Very cool. This is fantastic. The fish shell will be going belly up once
this evolves a bit.
> +special array parameter tt(region_highglight); see
There's a typo there.
Can the region and unprintable characters have a different highlight
style? zle_highlight is an array, right? Or is that for start/end escape
sequences.
> - arbitrary chunks of the line: controlled by the (zle special) array
> region_highlight. This is limited to static uses at the moment;
> highlighting doesn't track movement.
This is probably the part that will be expanded on if things like syntax
highlighting will be done in shell code (completion system like).
As a test, I wrote a very rudimentary bracket matching widget:
local i
zle self-insert
for ((i=$CURSOR;i;i--)) {
[[ $BUFFER[$i] = '(' ]] && break
}
region_highlight=("$((i-1)) $i/ bold")
With a zle -M command at the end of this, zsh coredumps. Let me know if
you can't reproduce it. I observed it on Solaris 10.
I'm not sure where and how to implement the unhighlight. Ideally, I
would like to have the matching paren highlighted for 1 second which
is what nedit does. And how can it be sure to remove its highlight
and not a region from some other widget. In the same way as compadd
adds completion matches instead of us having a $comp_matches, maybe a
builtin would be easier. It might allow more flexibility: timeout options,
group/tag identifiers, etc.
I'm not too familiar with the way syntax highlighting is typically done
in text editors. Maybe command-lines are small enough that reparsing
the whole line each time makes sense but that might imply full redraws
which could be bad over slow ssh connections. If the parsing is only
done partially as changes are made, then we'll need a good few hooks and
a way to make highlights sticky: the same word in the buffer is
highlighted even as text is inserted before it.
This is going to make the whole concept of PS2 prompts instead of proper
multiline editing seem even more out of place.
Oliver
Messages sorted by:
Reverse Date,
Date,
Thread,
Author