Skip to content

Commit

Permalink
Fix regression on menu validation
Browse files Browse the repository at this point in the history
-validateMenuItem: takes precedence over -validateUserInterfaceItem:
and would make the latter useless. Fixed by merging the former into
-validateUserInterfaceItem:.
  • Loading branch information
uranusjr committed Aug 5, 2014
1 parent b06740c commit bf6b2d3
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions MacDown/Code/Document/MPDocument.m
Original file line number Diff line number Diff line change
Expand Up @@ -481,20 +481,15 @@ - (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item
BOOL validness = !self.previewVisible && self.previousSplitRatio >= 0.0;
((NSMenuItem *)item).hidden = !validness;
}
else if (action == @selector(toggleTOCRendering:))
{
NSInteger state = self.rendersTOC ? NSOnState : NSOffState;
((NSMenuItem *)item).state = state;
}
return result;
}


#pragma mark - NSMenuValidation

- (BOOL)validateMenuItem:(NSMenuItem *)menuItem
{
if (menuItem.action == @selector(toggleTOCRendering:))
menuItem.state = self.rendersTOC ? NSOnState : NSOffState;
return YES;
}


#pragma mark - NSTextViewDelegate

- (BOOL)textView:(NSTextView *)textView doCommandBySelector:(SEL)commandSelector
Expand Down

0 comments on commit bf6b2d3

Please sign in to comment.