Skip to content

Commit 1d836d0

Browse files
committed
[vt100] absolutely terrible workaround for spaces being collapsed
1 parent d69b22f commit 1d836d0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

NewTerm/VT100/VT100StringSupplier.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ - (NSString *)stringForLine:(int)rowIndex {
3939
// UITextView won’t render a massive line of spaces (e.g. an empty nano screen), so add a newline
4040
// if the line ends with a space
4141
if (rowIndex != self.rowCount - 1 && unicharBuffer[width - 1] == ' ') {
42+
if (unicharBuffer[width - 2] == ' ') {
43+
// TODO: this is crazy. there has to be a better way to stop spaces from being collapsed
44+
unicharBuffer[width - 2] = 0xA0; // non-breaking space
45+
}
4246
unicharBuffer[width - 1] = '\n';
4347
}
4448

@@ -69,6 +73,7 @@ - (NSMutableAttributedString *)attributedString {
6973

7074
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
7175
paragraphStyle.alignment = NSTextAlignmentLeft;
76+
paragraphStyle.baseWritingDirection = NSWritingDirectionLeftToRight;
7277
paragraphStyle.lineBreakMode = NSLineBreakByCharWrapping;
7378

7479
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:allLines attributes:@{

0 commit comments

Comments
 (0)