@@ -1087,6 +1087,7 @@ - (void)applicationWillResignActive:(NSNotification *)aNotification {
1087
1087
[notationController synchronizeNoteChanges: nil ];
1088
1088
[cView setInactiveIcon: self ];
1089
1089
[self resetModTimers ];
1090
+
1090
1091
}
1091
1092
1092
1093
- (NSMenu *)applicationDockMenu: (NSApplication *)sender {
@@ -1303,8 +1304,9 @@ - (void)cacheTypedStringIfNecessary:(NSString*)aString {
1303
1304
1304
1305
// from fieldeditor
1305
1306
- (void )controlTextDidChange: (NSNotification *)aNotification {
1306
-
1307
+
1307
1308
if ([aNotification object ] == field) {
1309
+ [self resetModTimers ];
1308
1310
typedStringIsCached = NO ;
1309
1311
isFilteringFromTyping = YES ;
1310
1312
@@ -1364,6 +1366,7 @@ - (void)controlTextDidChange:(NSNotification *)aNotification {
1364
1366
}
1365
1367
1366
1368
isFilteringFromTyping = NO ;
1369
+
1367
1370
} else if ([TagEditer isMultitagging ]) { // <--for elasticthreads multitagging
1368
1371
if (!isAutocompleting&&!wasDeleting) {
1369
1372
isAutocompleting = YES ;
@@ -1404,6 +1407,7 @@ - (void)tableViewSelectionIsChanging:(NSNotification *)aNotification {
1404
1407
BOOL allowMultipleSelection = NO ;
1405
1408
NSEvent *event = [window currentEvent ];
1406
1409
1410
+ [self resetModTimers ];
1407
1411
NSEventType type = [event type ];
1408
1412
// do not allow drag-selections unless a modifier is pressed
1409
1413
if (type == NSLeftMouseDragged || type == NSLeftMouseDown ) {
@@ -1624,6 +1628,7 @@ - (BOOL)displayContentsForNoteAtIndex:(int)noteIndex {
1624
1628
- (void )textDidChange: (NSNotification *)aNotification {
1625
1629
id textObject = [aNotification object ];
1626
1630
1631
+ // [self resetModTimers];
1627
1632
if (textObject == textView) {
1628
1633
[currentNote setContentString: [textView textStorage ]];
1629
1634
[self postTextUpdate ];
@@ -2048,6 +2053,8 @@ - (IBAction)fixFileEncoding:(id)sender {
2048
2053
}
2049
2054
2050
2055
- (void )windowDidResignKey: (NSNotification *)notification{
2056
+
2057
+ [self resetModTimers ];
2051
2058
if ([notification object ] == [TagEditer tagPanel ]) { // <--this is for ElasticThreads' multitagging window
2052
2059
2053
2060
if ([TagEditer isMultitagging ]) {
@@ -2063,6 +2070,8 @@ - (void)windowDidResignKey:(NSNotification *)notification{
2063
2070
}
2064
2071
2065
2072
- (void )windowWillClose: (NSNotification *)aNotification {
2073
+
2074
+ [self resetModTimers ];
2066
2075
if ([prefsController quitWhenClosingWindow ]){
2067
2076
[NSApp terminate: nil ];
2068
2077
}
@@ -2961,61 +2970,30 @@ - (IBAction)toggleWordCount:(id)sender{
2961
2970
2962
2971
}
2963
2972
2964
-
2965
2973
- (void )flagsChanged: (NSEvent *)theEvent{
2966
2974
// if (ModFlagger>=0) {
2967
- if (([theEvent modifierFlags ]& NSAlternateKeyMask )&&(([ theEvent keyCode ]== 58 )||([theEvent keyCode ]== 61 ))) { // option down&NSKeyDownMask
2968
- if ((ModFlagger==0 )&&(popped==0 )){
2975
+ // NSLog(@"flagschanged :>%@<", theEvent);
2976
+ if ((ModFlagger==0 )&&(popped==0 )&&([theEvent modifierFlags ]& NSAlternateKeyMask )&&(([theEvent keyCode ]== 58 )||([theEvent keyCode ]== 61 ))) { // option down&NSKeyDownMask
2969
2977
ModFlagger = 1 ;
2970
2978
modifierTimer = [[NSTimer scheduledTimerWithTimeInterval: 1.2
2971
2979
target: self
2972
2980
selector: @selector (updateModifier: )
2973
2981
userInfo: @" option"
2974
2982
repeats: NO ] retain ];
2975
- }else {
2976
- ModFlagger=0 ;
2977
- }
2978
- }else if (([theEvent modifierFlags ]&NSControlKeyMask )&&(([theEvent keyCode ]==59 )||([theEvent keyCode ]==62 ))) { // control down
2979
- if ((ModFlagger==0 )&&(popped==0 )){
2983
+
2984
+ }else if ((ModFlagger==0 )&&(popped==0 )&&([theEvent modifierFlags ]&NSControlKeyMask )&&(([theEvent keyCode ]==59 )||([theEvent keyCode ]==62 ))) { // control down
2980
2985
ModFlagger = 2 ;
2981
2986
modifierTimer = [[NSTimer scheduledTimerWithTimeInterval: 1.2
2982
2987
target: self
2983
2988
selector: @selector (updateModifier: )
2984
2989
userInfo: @" control"
2985
2990
repeats: NO ] retain ];
2986
- }else {
2987
- ModFlagger=0 ;
2988
- }
2989
- }else if ([theEvent modifierFlags ]==256 ){
2990
2991
2991
- ModFlagger = 0 ;
2992
- if (modifierTimer){
2993
- if ([modifierTimer isValid ]) {
2994
- [modifierTimer invalidate ];
2995
- }
2996
- modifierTimer = nil ;
2997
- [modifierTimer release ];
2998
- }
2999
- if (popped>0 ) {
3000
-
3001
- if ((popped==1 )&&(([theEvent keyCode ]==58 )||([theEvent keyCode ]==61 ))) {// option up
3002
- [self performSelector: @selector (popWordCount: ) withObject: NO afterDelay: 0.3 ];
3003
-
3004
- }else if ((popped==2 )&&(([theEvent keyCode ]==59 )||([theEvent keyCode ]==62 ))) { // control up
3005
- [self performSelector: @selector (popPreview: ) withObject: NO afterDelay: 0.3 ];
3006
- }
3007
- popped=0 ;
3008
-
3009
- }
3010
2992
}else {
3011
- ModFlagger = -1 ;
3012
- if (modifierTimer) {
3013
- if ([modifierTimer isValid ]) {
3014
- [modifierTimer invalidate ];
3015
- }
3016
- modifierTimer = nil ;
3017
- [modifierTimer release ];
3018
- }
2993
+ [self resetModTimers ];
2994
+ /* if ([theEvent modifierFlags]==256){
2995
+ ModFlagger = 0;
2996
+ }*/
3019
2997
}
3020
2998
}
3021
2999
@@ -3036,13 +3014,23 @@ - (void)updateModifier:(NSTimer*)theTimer{
3036
3014
}
3037
3015
3038
3016
- (void )resetModTimers{
3039
- if (popped==1 ) {
3040
- [self performSelector: @selector (popWordCount: ) withObject: NO afterDelay: 0.1 ];
3041
- }else if (popped==2 ) {
3042
- [self performSelector: @selector (popPreview: ) withObject: NO afterDelay: 0.1 ];
3043
- }
3044
- popped=0 ;
3045
- ModFlagger = 0 ;
3017
+ // NSLog(@"resetmods");
3018
+ if ((ModFlagger>0 )||(popped>0 )) {
3019
+ ModFlagger = 0 ;
3020
+ if (modifierTimer){
3021
+ if ([modifierTimer isValid ]) {
3022
+ [modifierTimer invalidate ];
3023
+ }
3024
+ modifierTimer = nil ;
3025
+ [modifierTimer release ];
3026
+ }
3027
+ if (popped==1 ) {
3028
+ [self performSelector: @selector (popWordCount: ) withObject: NO afterDelay: 0.1 ];
3029
+ }else if (popped==2 ) {
3030
+ [self performSelector: @selector (popPreview: ) withObject: NO afterDelay: 0.1 ];
3031
+ }
3032
+ popped=0 ;
3033
+ }
3046
3034
}
3047
3035
3048
3036
@@ -3187,4 +3175,10 @@ - (void)refreshNotesList
3187
3175
[notesTableView setNeedsDisplay: YES ];
3188
3176
}
3189
3177
3178
+ - (BOOL )performKeyEquivalent: (NSEvent *)theEvent {
3179
+ NSLog (@" perform key AC" );
3180
+ [[NSApp delegate ] resetModTimers ];
3181
+ return [super performKeyEquivalent: theEvent];
3182
+ }
3183
+
3190
3184
@end
0 commit comments