Skip to content

Commit

Permalink
• Improved handling of larger documents
Browse files Browse the repository at this point in the history
• Fixed a crash if the R script editor has to handle _very_ long lines


git-svn-id: https://svn.r-project.org/R-packages/trunk/Mac-GUI@6245 694ef91d-65df-0310-b7bb-92e67a308ead
  • Loading branch information
Hans-Jörg Bibiko committed Aug 28, 2012
1 parent 7102a27 commit 0d3bff1
Show file tree
Hide file tree
Showing 8 changed files with 170 additions and 78 deletions.
5 changes: 5 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
NEWS for R.app GUI for Mac OS X

Last-update: 2012-08-28 [HJBB]
* Improved handling of larger documents
* Fixed a crash if the R script editor has to handle
_very_ long lines

Last-update: 2012-08-24 [HJBB]
* Added Code Folding of { ... } multi-line blocks
in R Script Editor; see gutter and/or
Expand Down
6 changes: 6 additions & 0 deletions NSTextView_RAdditions.m
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,11 @@ - (IBAction)selectEnclosingBrackets:(id)sender
NSInteger pcnt = 0; // ) counter
NSInteger bcnt = 0; // ] counter
NSInteger scnt = 0; // } counter
NSInteger breakCounter = 10000;

// look for the first non-balanced closing bracket
for(NSUInteger i=caretPosition; i<stringLength; i++) {
if(!breakCounter--) return;
if(RPARSERCONTEXTFORPOSITION((RTextView*)self, i) != pcExpression) continue;
switch(CFStringGetCharacterAtIndex(parserStringRef, i)) {
case ')':
Expand Down Expand Up @@ -182,7 +184,9 @@ - (IBAction)selectEnclosingBrackets:(id)sender
if(c == co)
bracketCounter++;

breakCounter = 10000;
for(NSInteger i=caretPosition; i>=0; i--) {
if(!breakCounter--) return;
if(RPARSERCONTEXTFORPOSITION((RTextView*)self, i) != pcExpression) continue;
c = CFStringGetCharacterAtIndex(parserStringRef, i);
if(c == co) {
Expand All @@ -199,7 +203,9 @@ - (IBAction)selectEnclosingBrackets:(id)sender
if(start < 0 ) return;

bracketCounter = 0;
breakCounter = 10000;
for(NSUInteger i=caretPosition; i<stringLength; i++) {
if(!breakCounter--) return;
if(RPARSERCONTEXTFORPOSITION((RTextView*)self, i) != pcExpression) continue;
c = CFStringGetCharacterAtIndex(parserStringRef, i);
if(c == co) {
Expand Down
2 changes: 2 additions & 0 deletions RDocumentWinCtrl.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ extern NSColor *shColorIdentifier;
BOOL argsHints; // fn args hinting
BOOL lastLineWasCodeIndented;
BOOL isFormattingRcode;
BOOL isFunctionScanning;

int hsType; // help search type

Expand Down Expand Up @@ -148,6 +149,7 @@ extern NSColor *shColorIdentifier;

- (NSView*) saveOpenAccView;

- (BOOL) isFunctionScanning;
- (void) functionRescan; // re-scans the functions it the document and updates function list/pop-up
- (void) functionGo: (id) sender; // invoked by function pop-up, the tag of the sender specifies the position to go to
- (void) functionReset; // reset all functions (will go away soon, user functionRescan instead)
Expand Down
Loading

0 comments on commit 0d3bff1

Please sign in to comment.