shell-writing (syntax hilighting) advice?
Isaac Dupree
ml at isaac.cedarswampstudios.org
Sat Jun 13 17:50:34 EDT 2009
I'm trying to write a shell-style thing (actually a wrapper around bash)
that gives syntax highlighting for the line being edited, and also
displays more info. For example, if I type "for" and pause, the "for"
could turn red because it'd be a syntax error, and also display some
helpful info like:
$ for
for NAME [in WORDS ...]; do COMMANDS; done
for (( EXPR1 ; EXPR2 ; EXPR3 )) ; do COMMANDS ; done
I found out that Readline has an "event hook" that I could at least use
to get code's control every time a character is typed (and at other
intervals). But is it safe/possible to just write colored characters
over the uncolored ones? (Haskeline, Readline, I don't really care what
library I use, as long as I can do what I want without re-implementing a
whole line editing system!)
Hmm, I think I'll stick to that "syntax hilighting" question for a
start, rather than trying to ask everything at once.
-Isaac
More information about the Haskeline
mailing list