diff --git a/TodoTxtMac/TTMFieldEditor.h b/TodoTxtMac/TTMFieldEditor.h
index 2ceacea..591fe47 100644
--- a/TodoTxtMac/TTMFieldEditor.h
+++ b/TodoTxtMac/TTMFieldEditor.h
@@ -54,6 +54,7 @@
@property (nonatomic, retain) NSArray *contextsArray;
@property (nonatomic, retain) NSTimer *completionTimer;
@property (nonatomic) NSUInteger nextInsertionIndex;
+@property (nonatomic) NSString *originalValue;
#pragma mark - Autocompletion Timer Methods
diff --git a/TodoTxtMac/TTMFieldEditor.m b/TodoTxtMac/TTMFieldEditor.m
index db88ce5..0a4eca9 100644
--- a/TodoTxtMac/TTMFieldEditor.m
+++ b/TodoTxtMac/TTMFieldEditor.m
@@ -61,6 +61,11 @@ - (id)initWithFrame:(NSRect)frame
return self;
}
+- (BOOL)becomeFirstResponder {
+ self.originalValue = [self.string copy]; // retain value for cancelOperation method
+ return ([super becomeFirstResponder]);
+}
+
- (void)drawRect:(NSRect)dirtyRect
{
[super drawRect:dirtyRect];
@@ -168,13 +173,8 @@ - (NSRange)rangeForUserCompletion {
- (void)cancelOperation:(id)sender {
// How the Esc key behaves is dependent on a user setting.
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"escapeKeyCancelsAllTextChanges"]) {
- // Undo all events on the undoManager's stack. Autocompletion triggers additional undo
- // groups to be created, so one undo or undoNestedGroup call is not enough to undo all
- // changes.
- NSUndoManager *undoManager = [self undoManager];
- while ([undoManager canUndo]) {
- [undoManager undoNestedGroup];
- }
+ [self.undoManager removeAllActions];
+ self.string = self.originalValue;
} else {
// Trigger autocompletion (default behavior).
[self complete:nil];
diff --git a/TodoTxtMac/TodoTxtMac-Info.plist b/TodoTxtMac/TodoTxtMac-Info.plist
index 2c29d8b..c0c705d 100644
--- a/TodoTxtMac/TodoTxtMac-Info.plist
+++ b/TodoTxtMac/TodoTxtMac-Info.plist
@@ -38,11 +38,11 @@
CFBundlePackageType
APPL
CFBundleShortVersionString
- 1.6.0
+ 1.6.1
CFBundleSignature
????
CFBundleVersion
- 1.6.0
+ 1.6.1
LSApplicationCategoryType
public.app-category.productivity
LSMinimumSystemVersion