liner
liner copied to clipboard
Support colour
Could be nice for things like Ion syntax highlighting.
Would need some changes to Buffer
.
Well I believe you can use colour in buffers already by using the proper ANSI codes, but maybe it would be better to have a nice API.
I think we should be able to supply a &'static [&'static str]
that specifies specific keywords to highlight, along with the color code to use with those keywords, then throw in color codes where matches are found.
I don't think it should only highlight keywords. Also highlighting the first word or whatever would be awesome, but also problematic since this crate isn't specific to ion. Maybe leaving that to the user with a simple do_highlighting(buffer: &mut String)
callback would be enough? And then maybe also a high-level abstraction over that, like make_keyword_highlight(keywords: &'static [&'static str])
.
What are everyones opinions on having regular expression based highlighting? Where we supply a function with an array filled with regular expressions and there respective colors.
Only question then would be how we could selectively highlight certain words based on context, as the Fish shell does when you enter an invalid command. But regexp-based highlighting does seem to be crucial for general syntax-based highlighting. Then there's the issue of being able to automatically indent & unindent the prompt based on the depth of the current block and the keyword on the current prompt.