diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-03-17 10:54:27 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-03-17 10:54:27 +0000 |
commit | 183ac8ed6f065c99de2911df97f4285ed21bbcca (patch) | |
tree | 024f55f8bafe7793d6561fce33baaa6e116e41c0 /Source/SPNarrowDownCompletion.m | |
parent | 8317097106e89ca010bee9771bd0c1f6d53754b8 (diff) | |
download | sequelpro-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.m | 4 |
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]; |