mirror of
https://github.com/coteditor/CotEditor.git
synced 2024-09-11 11:25:57 +03:00
Adjust timing detecting URL link
This commit is contained in:
parent
3a2d83640a
commit
3387de8965
@ -11,12 +11,14 @@ develop
|
||||
- Add `--wait` (`-w`) option to wait until a newly opened window closes.
|
||||
- Optimize command performance.
|
||||
- Fix an issue where command cannot open file whose path includes non-ascii character.
|
||||
- Now, the change of “link URL” option is applied to opened documents immediately.
|
||||
|
||||
|
||||
|
||||
### Fix
|
||||
|
||||
- Fix an issue where documents were marked as “Edited” just after opening file if “link URL” option is enabled.
|
||||
- Fix an issue where URL link was not applied to pasted text.
|
||||
|
||||
|
||||
|
||||
|
@ -858,6 +858,12 @@ static NSCharacterSet *kMatchingClosingBracketsSet;
|
||||
- (BOOL)readSelectionFromPasteboard:(nonnull NSPasteboard *)pboard type:(nonnull NSString *)type
|
||||
// ------------------------------------------------------
|
||||
{
|
||||
// apply link to pasted string
|
||||
__unsafe_unretained typeof(self) weakSelf = self; // NSTextView cannot be weak
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[weakSelf detectLinkIfNeeded];
|
||||
});
|
||||
|
||||
// on file drop
|
||||
if ([type isEqualToString:NSFilenamesPboardType]) {
|
||||
NSArray<NSDictionary<NSString *, NSString *> *> *fileDropDefs = [[NSUserDefaults standardUserDefaults] arrayForKey:CEDefaultFileDropArrayKey];
|
||||
@ -1028,6 +1034,12 @@ static NSCharacterSet *kMatchingClosingBracketsSet;
|
||||
|
||||
} else if ([keyPath isEqualToString:CEDefaultAutoLinkDetectionKey]) {
|
||||
[self setAutomaticLinkDetectionEnabled:[newValue boolValue]];
|
||||
if ([self isAutomaticLinkDetectionEnabled]) {
|
||||
[self detectLinkIfNeeded];
|
||||
} else {
|
||||
// remove current links
|
||||
[[self textStorage] removeAttribute:NSLinkAttributeName range:NSMakeRange(0, [[self string] length])];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user