Skip to content

Commit fe83132

Browse files
author
rcartwright
committed
This revision includes some cosmetic changes in comments in
Indenter.java and a very small patch to fix a bug that arose in MovingDocumentRegion.java. The following files were modified: M src/edu/rice/cs/drjava/model/definitions/indent/Indenter.java M src/edu/rice/cs/drjava/model/MovingDocumentRegion.java git-svn-id: file:///tmp/test-svn/trunk@5677 fe72c1cf-3628-48e9-8b72-1c46755d3cff
1 parent 3a763dc commit fe83132

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

drjava/src/edu/rice/cs/drjava/model/MovingDocumentRegion.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ public String value() {
103103

104104
// Construct the matching string and compressed selection prefix and suffix strings within text
105105
String prefix, match, suffix;
106-
if (excerptLength < startRed) { // selection not included in excerpt
106+
// Added the predicate "startRed < 0" because "text.substring(startRed, endRed)" threw an
107+
// IndexOutOfBoundsException with startRed == -18. Perhaps editing text in question created this situation.
108+
if (excerptLength < startRed || startRed < 0) { // selection not included in excerpt
107109
prefix = StringOps.compress(text.substring(0, excerptLength));
108110
match = " ...";
109111
suffix = "";

drjava/src/edu/rice/cs/drjava/model/definitions/indent/Indenter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ public void buildTree(int indentLevel) {
116116
rule14 = new QuestionNewParenPhrase(rule15, rule16), // is current non ) line a new phrase after open paren?
117117
rule23 = new QuestionNewParenPhrase(rule30, rule38), // is current ) line a new phrase after open paren?
118118
rule21 = new QuestionCurrLineStartsWith(")", rule23, rule14), // does current line start with ')'?
119+
119120
// root of non-comment indent tree: is brace enclosing start of this line in { '(', '['}?
120121
rule13 = new QuestionBraceIsParenOrBracket(rule21, rule17),
121122

0 commit comments

Comments
 (0)