Skip to content

Commit d5197e4

Browse files
committed
Do not highlight spaces
1 parent 6fa60a2 commit d5197e4

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

RichString.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,15 +188,16 @@ void RichString_setAttrn_preserveWithStandout(RichString* this, int attrs, int s
188188
pair_content(currentCharPairNum, &before_fg_color, &before_bg_color);
189189
}
190190

191-
// When text color matches higlight, the resulting STANDOUT is the same as on default text, so we at least set italics TODO
191+
// TODO: When text color matches higlight, the resulting STANDOUT is the same as on default text,
192+
// so we at least set italics
192193
int attrToPass = A_STANDOUT;
193194
if (before_fg_color == passed_bg_color) {
194195
attrToPass = attrToPass | A_ITALIC;
195196
}
196-
// If current char has is BOLD or its ColorPair Index is not the default 0,
197+
// If current char is not a space, has BOLD or its ColorPair Index is not the default 0,
197198
// apply our own attrToPass with STANDOUT + optionally ITALICS,
198199
// instead of the passed attrs, which has the BG highlight color
199-
ch->attr = (ch->attr & A_BOLD || currentCharPairNum != 0) ? (ch->attr | attrToPass) : (unsigned int)attrs;
200+
ch->attr = (ch->chars[0] != L' ' && (ch->attr & A_BOLD || currentCharPairNum != 0)) ? (ch->attr | attrToPass) : (unsigned int)attrs;
200201
ch++;
201202
}
202203
}

0 commit comments

Comments
 (0)