liner icon indicating copy to clipboard operation
liner copied to clipboard

Support colour

Open MovingtoMars opened this issue 7 years ago • 5 comments

Could be nice for things like Ion syntax highlighting.

Would need some changes to Buffer.

MovingtoMars avatar Jun 01 '17 09:06 MovingtoMars

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.

MovingtoMars avatar Jun 11 '17 00:06 MovingtoMars

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.

mmstick avatar Jul 11 '17 23:07 mmstick

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]).

jD91mZM2 avatar Jan 12 '18 10:01 jD91mZM2

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.

LaurenceOfAustralia avatar Feb 15 '18 21:02 LaurenceOfAustralia

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.

mmstick avatar Feb 16 '18 04:02 mmstick