From ec190baa55b424ba2ae192847985e28a2191b343 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Mon, 20 Nov 2023 21:52:31 -0500 Subject: [PATCH] MacPDF: Replace newlines with spaces in outline titles Else, outline items that have newlines in them end up with a weird vertical offset. (This does affect the outline item's tooltip, which shows the whole title. But not having a newline there seems alright, arguably preferable.) --- Meta/Lagom/Contrib/MacPDF/MacPDFOutlineViewDataSource.mm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Meta/Lagom/Contrib/MacPDF/MacPDFOutlineViewDataSource.mm b/Meta/Lagom/Contrib/MacPDF/MacPDFOutlineViewDataSource.mm index fde1fa17f1..b6fe2efb95 100644 --- a/Meta/Lagom/Contrib/MacPDF/MacPDFOutlineViewDataSource.mm +++ b/Meta/Lagom/Contrib/MacPDF/MacPDFOutlineViewDataSource.mm @@ -60,7 +60,12 @@ { if (_groupName) return _groupName; - return [NSString stringWithUTF8String:_item->title.characters()]; + NSString* title = [NSString stringWithUTF8String:_item->title.characters()]; + + // Newlines confuse NSOutlineView, at least in sidebar style (even with `usesSingleLineMode` set to YES on the cell view's text field). + title = [[title componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]] componentsJoinedByString:@" "]; + + return title; } @end