File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1901,12 +1901,18 @@ - (BOOL)textView:(SLKTextView *)textView shouldChangeTextInRange:(NSRange)range
19011901 }
19021902
19031903 // Detects double spacebar tapping, to replace the default "." insert with a formatting symbol, if needed.
1904- if (textView.isFormattingEnabled && range.location > 0 && text.length > 0 && textView. text . length > 1 &&
1904+ if (textView.isFormattingEnabled && range.location > 0 && text.length > 0 &&
19051905 [[NSCharacterSet whitespaceCharacterSet ] characterIsMember: [text characterAtIndex: 0 ]] &&
19061906 [[NSCharacterSet whitespaceCharacterSet ] characterIsMember: [textView.text characterAtIndex: range.location - 1 ]]) {
19071907
19081908 BOOL shouldChange = YES ;
19091909
1910+ // Since we are moving 2 characters to the left, we need for to make sure that the string's lenght,
1911+ // before the caret position, is higher than 2.
1912+ if ([textView.text substringToIndex: textView.selectedRange.location].length < 2 ) {
1913+ return YES ;
1914+ }
1915+
19101916 NSRange wordRange = range;
19111917 wordRange.location -= 2 ; // minus the white space added with the double space bar tapping
19121918
You can’t perform that action at this time.
0 commit comments