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.)
This commit is contained in:
Nico Weber 2023-11-20 21:52:31 -05:00 committed by Andreas Kling
parent e13954410a
commit ec190baa55
Notes: sideshowbarker 2024-07-18 00:34:07 +09:00

View File

@ -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