aboutsummaryrefslogtreecommitdiffstats
path: root/Source/CMTextView.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-02-04 12:34:50 +0000
committerBibiko <bibiko@eva.mpg.de>2010-02-04 12:34:50 +0000
commit2c5453a01eae97bf03f16cfd088f2f069bb0594d (patch)
tree2f46278ea90be2b7e951af3f70ce9d41fe67e355 /Source/CMTextView.m
parent7b7e81cfdda087a27836cb056a7b7f1fbabe1d50 (diff)
downloadsequelpro-2c5453a01eae97bf03f16cfd088f2f069bb0594d.tar.gz
sequelpro-2c5453a01eae97bf03f16cfd088f2f069bb0594d.tar.bz2
sequelpro-2c5453a01eae97bf03f16cfd088f2f069bb0594d.zip
• fixed undo behaviour of insertion of history/query favs
• improved text macro/query favs insertion logic
Diffstat (limited to 'Source/CMTextView.m')
-rw-r--r--Source/CMTextView.m13
1 files changed, 11 insertions, 2 deletions
diff --git a/Source/CMTextView.m b/Source/CMTextView.m
index d9ba59f4..33d56544 100644
--- a/Source/CMTextView.m
+++ b/Source/CMTextView.m
@@ -1112,6 +1112,11 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
- (void)insertFavoriteAsSnippet:(NSString*)theSnippet atRange:(NSRange)targetRange
{
+ if(snippetControlCounter > -1) {
+ NSBeep();
+ return;
+ }
+
NSInteger i;
// reset snippet array
@@ -1127,7 +1132,8 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
@try{
NSString *re = @"(?<!\\\\)\\$\\{(1?\\d):([^\\{\\}]*)\\}";
- targetRange = NSIntersectionRange(NSMakeRange(0,[[self string] length]), targetRange);
+ if(targetRange.length)
+ targetRange = NSIntersectionRange(NSMakeRange(0,[[self string] length]), targetRange);
[snip setString:theSnippet];
if(snip == nil || ![snip length]) return;
@@ -1222,10 +1228,13 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
[self breakUndoCoalescing];
// Insert favorite query as snippet if any
- [self setSelectedRange:targetRange];
+ // if(targetRange.length)
+ [self setSelectedRange:targetRange];
// Suppress snippet range calculation in [self textStorageDidProcessEditing] while initial insertion
snippetWasJustInserted = YES;
+
+ [self breakUndoCoalescing];
[self insertText:snip];
// Any snippets defined?