mirror of
https://github.com/coteditor/CotEditor.git
synced 2024-09-11 11:25:57 +03:00
Change character inspector behavior
This commit is contained in:
parent
ccb4244a13
commit
2cdbd65916
@ -5,6 +5,11 @@ Change Log
|
||||
develop
|
||||
--------------------------
|
||||
|
||||
### Improvements
|
||||
|
||||
- Close character inspector when text selection was changed.
|
||||
|
||||
|
||||
### Fixes
|
||||
|
||||
- Fix an issue where window title bar was dyed in the editor's background color on El Capitan.
|
||||
|
@ -91,6 +91,7 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------
|
||||
/// nib name
|
||||
- (nullable NSString *)nibName
|
||||
@ -114,7 +115,6 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ------------------------------------------------------
|
||||
/// show popover
|
||||
- (void)showPopoverRelativeToRect:(NSRect)positioningRect ofView:(nonnull NSView *)parentView
|
||||
@ -126,6 +126,20 @@
|
||||
[popover setBehavior:NSPopoverBehaviorSemitransient];
|
||||
[popover showRelativeToRect:positioningRect ofView:parentView preferredEdge:NSMinYEdge];
|
||||
[[parentView window] makeFirstResponder:parentView];
|
||||
|
||||
// auto-close popover if selection is changed.
|
||||
if ([parentView isKindOfClass:[NSTextView class]]) {
|
||||
__block __weak id observer = [[NSNotificationCenter defaultCenter] addObserverForName:NSTextViewDidChangeSelectionNotification
|
||||
object:parentView
|
||||
queue:[NSOperationQueue mainQueue]
|
||||
usingBlock:^(NSNotification *note)
|
||||
{
|
||||
if (![popover isDetached]) {
|
||||
[popover performClose:nil];
|
||||
}
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:observer];
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user