@@ -38,6 +38,7 @@ public AttributedString highlight(LineReader reader, String buffer) {
3838 int underlineEnd = -1 ;
3939 int negativeStart = -1 ;
4040 int negativeEnd = -1 ;
41+ boolean first = true ;
4142 String search = reader .getSearchTerm ();
4243 if (search != null && search .length () > 0 ) {
4344 underlineStart = buffer .indexOf (search );
@@ -65,6 +66,7 @@ public AttributedString highlight(LineReader reader, String buffer) {
6566 }
6667
6768 AttributedStringBuilder sb = new AttributedStringBuilder ();
69+ commandStyle (reader , sb , true );
6870 for (int i = 0 ; i < buffer .length (); i ++) {
6971 if (i == underlineStart ) {
7072 sb .style (AttributedStyle ::underline );
@@ -77,6 +79,10 @@ public AttributedString highlight(LineReader reader, String buffer) {
7779 }
7880
7981 char c = buffer .charAt (i );
82+ if (first && Character .isSpaceChar (c )) {
83+ first = false ;
84+ commandStyle (reader , sb , false );
85+ }
8086 if (c == '\t' || c == '\n' ) {
8187 sb .append (c );
8288 } else if (c < 32 ) {
@@ -105,4 +111,6 @@ public AttributedString highlight(LineReader reader, String buffer) {
105111 }
106112 return sb .toAttributedString ();
107113 }
114+
115+ protected void commandStyle (LineReader reader , AttributedStringBuilder sb , boolean enable ) {}
108116}
0 commit comments