diff --git a/README.md b/README.md index d211c02..d0bd0d5 100644 --- a/README.md +++ b/README.md @@ -108,6 +108,13 @@ With this Terminal command you can customize this limit: defaults write de.relikd.baRSS shortArticleNamesLimit -int 50 ``` +3. Each article menu item shows a summary tooltip (if the server provides one). +By default, the tooltip is limited to 2000 characters. +You can change the limit with this command: +``` +defaults write de.relikd.baRSS tooltipCharacterLimit -int 500 +``` + 3. Limit the number of displayed articles per feed menu. **Note:** displayed unread count may be different than the unread items inside. 'Open all unread' will open hidden items too. ``` diff --git a/baRSS/Core Data/FeedArticle+Ext.m b/baRSS/Core Data/FeedArticle+Ext.m index cd99d3a..9264e37 100644 --- a/baRSS/Core Data/FeedArticle+Ext.m +++ b/baRSS/Core Data/FeedArticle+Ext.m @@ -63,7 +63,14 @@ item.state = (self.unread && UserPrefsBool(Pref_feedUnreadIndicator) ? NSControlStateValueOn : NSControlStateValueOff); item.onStateImage = [NSImage imageNamed:RSSImageMenuItemUnread]; item.accessibilityLabel = (self.unread ? NSLocalizedString(@"article: unread", @"accessibility label, feed menu item") : NSLocalizedString(@"article: read", @"accessibility label, feed menu item")); - item.toolTip = (self.abstract ? self.abstract : self.body); // fall back to body (html) + // truncate tooltip + NSUInteger limit = UserPrefsUInt(Pref_tooltipCharacterLimit); + if (limit > 0) { + NSString *tooltip = (self.abstract ? self.abstract : self.body); // fall back to body (html) + if (tooltip.length > limit) + tooltip = [[tooltip substringToIndex:limit] stringByAppendingString:@"…\n[…]"]; + item.toolTip = tooltip; + } item.representedObject = self.objectID; item.target = [self class]; item.action = @selector(didClickOnMenuItem:); diff --git a/baRSS/Helper/UserPrefs.h b/baRSS/Helper/UserPrefs.h index eeb13b2..24d8d1f 100644 --- a/baRSS/Helper/UserPrefs.h +++ b/baRSS/Helper/UserPrefs.h @@ -39,6 +39,7 @@ // ------ Hidden preferences ------ only modifiable via `defaults write de.relikd.baRSS {KEY}` ------ /** default: @c 10 */ static NSString* const Pref_openFewLinksLimit = @"openFewLinksLimit"; /** default: @c 60 */ static NSString* const Pref_shortArticleNamesLimit = @"shortArticleNamesLimit"; +/** default: @c 2k */ static NSString* const Pref_tooltipCharacterLimit = @"tooltipCharacterLimit"; /** default: @c 40 */ static NSString* const Pref_articlesInMenuLimit = @"articlesInMenuLimit"; /** default: @c nil */ static NSString* const Pref_colorStatusIconTint = @"colorStatusIconTint"; /** default: @c nil */ static NSString* const Pref_colorUnreadIndicator = @"colorUnreadIndicator"; diff --git a/baRSS/Helper/UserPrefs.m b/baRSS/Helper/UserPrefs.m index 1dcaf04..0e15008 100644 --- a/baRSS/Helper/UserPrefs.m +++ b/baRSS/Helper/UserPrefs.m @@ -29,6 +29,7 @@ void UserPrefsInit(void) { // Display limits & truncation ( defaults write de.relikd.baRSS {KEY} -int 10 ) [defs setObject:[NSNumber numberWithUnsignedInteger:10] forKey:Pref_openFewLinksLimit]; [defs setObject:[NSNumber numberWithUnsignedInteger:60] forKey:Pref_shortArticleNamesLimit]; + [defs setObject:[NSNumber numberWithUnsignedInteger:2000] forKey:Pref_tooltipLimit]; [defs setObject:[NSNumber numberWithUnsignedInteger:40] forKey:Pref_articlesInMenuLimit]; [defs setObject:[NSNumber numberWithUnsignedInteger:1] forKey:Pref_prefSelectedTab]; // feed tab [[NSUserDefaults standardUserDefaults] registerDefaults:defs];