1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 12:07:45 +00:00

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

View file

@ -60,7 +60,12 @@
{ {
if (_groupName) if (_groupName)
return _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 @end