[R-SIG-Mac] suggestion to fix undo behaviour in R.app's console

Hans-Jörg Bibiko bibiko at eva.mpg.de
Wed Apr 1 10:03:25 CEST 2009

Dear Simon, dear all,

here is my tiny suggestion to improve the undo behaviour in R's  
console after auto-pairing "" () etc.:

In RTextView.m around line 208 (Mac-GUI-1.27):

case '\'':
	if (!complement) {
		complement = @"\'";
		acCheck = YES;
		if ([self parserContextForPosition:r.location] != pcExpression) break;

	// register the next pairing procedure to the undo manager better
	[self shouldChangeTextInRange:[self selectedRange]  

	SLog(@"RTextView: open bracket chracter %c", ck);
	[super keyDown:theEvent];
		r = [self selectedRange];
		if (r.location != NSNotFound) {

[self shouldChangeTextInRange:[self selectedRange]  
will register the next changes a bit better.
The return value of that function is ignored but it could be used as:

if([self shouldChangeTextInRange:[self selectedRange]  
... do it
... print error - not editable



Hans-Joerg Bibiko
Max Planck Institute for Evolutionary Anthropology
Department of Linguistics
Deutscher Platz 6     phone:   +49 (0) 341 3550 341
D-04103 Leipzig       fax:     +49 (0) 341 3550 333
Germany               e-mail:  bibiko at eva.mpg.de

More information about the R-SIG-Mac mailing list