[R-SIG-Mac] Can I disable brace completion in console?

Hans-Joerg Bibiko bibiko at eva.mpg.de
Thu May 24 09:30:31 CEST 2007

>> More precisely, I'm referring to the new feature that automatically
>> adds the right brace (or bracket or parenthesis) when the left one
>> is typed. Nice when you type from left to right, but inconvenient
>> when you edit the same or previous lines. At least using something
>> like "Cmd - {" to override it would be nice.
> Sounds reasonable. I'll see if we can add that...

Cmd-{ is not so practical regarding to non-US keyboard users, but  
maybe Cmd-B

Cmd-B could simply toggle the boolean RTextView_autoCloseBrackets or  
could disable the auto-pair function for the next keydown event.(?)

On the other hand one could improve the auto-pair behaviour

-by checking the character right from the cursor (if there's one)
Example in RTextView.m > method keyDown:
[super keyDown:theEvent];
	r = [self selectedRange];
	NSTextStorage *ts = [self textStorage];
	BOOL flag = YES;
	if([ts length] > r.location){
		unichar c = [[ts string] characterAtIndex:r.location];
		flag=(c==' ' || c==',' || c==';' || c==']' || c==')' || c=='}')? 
	if (r.location != NSNotFound && flag) {
		// NSAttributedString *as = [[NSAttributedString alloc]  
initWithString:complement attributes:
		// [NSDictionary dictionaryWithObject:TAVal forKey:kTALinked]];
		NSTextStorage *ts = [self textStorage];
		[self replaceCharactersInRange:r withString:complement];
		[ts addAttribute:kTALinked value:TAVal range:r];
		[self setSelectedRange:r];

-by adding the possibility to select something in the command line  
and press (,[,{,", or ' to wrap the selection.
Example:  123456  you select 34 and press (  =  12(34)56

I use this very often for editing the command line ;)



More information about the R-SIG-Mac mailing list