Author: ericwa
Date: Fri Mar 14 08:49:14 2014
New Revision: 10560
URL: http://svn.gna.org/viewcvs/etoile?rev=10560&view=rev
Log:
Typewriter: commit when the user starts to delete text, so they can always undo
accidental deletions even of uncommitted text
Modified:
trunk/Etoile/Frameworks/CoreObject/Samples/Typewriter/EWTypewriterWindowController.h
trunk/Etoile/Frameworks/CoreObject/Samples/Typewriter/EWTypewriterWindowController.m
Modified:
trunk/Etoile/Frameworks/CoreObject/Samples/Typewriter/EWTypewriterWindowController.h
URL:
http://svn.gna.org/viewcvs/etoile/trunk/Etoile/Frameworks/CoreObject/Samples/Typewriter/EWTypewriterWindowController.h?rev=10560&r1=10559&r2=10560&view=diff
==============================================================================
---
trunk/Etoile/Frameworks/CoreObject/Samples/Typewriter/EWTypewriterWindowController.h
(original)
+++
trunk/Etoile/Frameworks/CoreObject/Samples/Typewriter/EWTypewriterWindowController.h
Fri Mar 14 08:49:14 2014
@@ -40,6 +40,7 @@
// Tracking text changes
BOOL changedByUser;
NSTimer *coalescingTimer;
+ BOOL isDeleting;
}
@property (nonatomic, readonly) NSTableView *notesTable;
Modified:
trunk/Etoile/Frameworks/CoreObject/Samples/Typewriter/EWTypewriterWindowController.m
URL:
http://svn.gna.org/viewcvs/etoile/trunk/Etoile/Frameworks/CoreObject/Samples/Typewriter/EWTypewriterWindowController.m?rev=10560&r1=10559&r2=10560&view=diff
==============================================================================
---
trunk/Etoile/Frameworks/CoreObject/Samples/Typewriter/EWTypewriterWindowController.m
(original)
+++
trunk/Etoile/Frameworks/CoreObject/Samples/Typewriter/EWTypewriterWindowController.m
Fri Mar 14 08:49:14 2014
@@ -444,6 +444,17 @@
- (BOOL)textView:(NSTextView *)aTextView
shouldChangeTextInRange:(NSRange)affectedCharRange replacementString:(NSString
*)replacementString
{
changedByUser = YES;
+
+ BOOL willDelete = (replacementString != nil && [replacementString
isEqualToString: @""]);
+
+ if (willDelete && !isDeleting)
+ {
+ // If the user has uncommitted text, and the start deleting,
commit their uncommitted changes
+ // so they can undo the deletions
+ [self commitTextChangesAsCheckpoint: NO];
+ }
+
+ isDeleting = willDelete;
return YES;
}
_______________________________________________
Etoile-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/etoile-cvs