aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPNarrowDownCompletion.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-03-17 10:54:27 +0000
committerBibiko <bibiko@eva.mpg.de>2010-03-17 10:54:27 +0000
commit183ac8ed6f065c99de2911df97f4285ed21bbcca (patch)
tree024f55f8bafe7793d6561fce33baaa6e116e41c0 /Source/SPNarrowDownCompletion.m
parent8317097106e89ca010bee9771bd0c1f6d53754b8 (diff)
downloadsequelpro-183ac8ed6f065c99de2911df97f4285ed21bbcca.tar.gz
sequelpro-183ac8ed6f065c99de2911df97f4285ed21bbcca.tar.bz2
sequelpro-183ac8ed6f065c99de2911df97f4285ed21bbcca.zip
- fixed bug for nested snippets if a nested snippet is located at the very end of the text buffer and has no default value
- added a range sanity check for completion before insertion of the chosen item
Diffstat (limited to 'Source/SPNarrowDownCompletion.m')
-rw-r--r--Source/SPNarrowDownCompletion.m4
1 files changed, 4 insertions, 0 deletions
diff --git a/Source/SPNarrowDownCompletion.m b/Source/SPNarrowDownCompletion.m
index ac29fc08..cfdd7605 100644
--- a/Source/SPNarrowDownCompletion.m
+++ b/Source/SPNarrowDownCompletion.m
@@ -759,6 +759,10 @@
- (void)insert_text:(NSString* )aString
{
+ // Ensure that theCharRange is valid
+ if(NSMaxRange(theCharRange) > [[theView string] length])
+ theCharRange = NSIntersectionRange(NSMakeRange(0,[[theView string] length]), theCharRange);
+
NSRange r = [theView selectedRange];
if(r.length)
[theView setSelectedRange:r];