summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBurak Emir <emir@epfl.ch>2007-07-06 14:30:52 +0000
committerBurak Emir <emir@epfl.ch>2007-07-06 14:30:52 +0000
commit1c53987588496bc244e700ac82c63f00691e4e3c (patch)
tree6ba51f9a8783e41d3169ef85e12de2c7db9acd99
parent6b9c0247506e46321dfedaa01b37a9696cb21014 (diff)
downloadscala-1c53987588496bc244e700ac82c63f00691e4e3c.tar.gz
scala-1c53987588496bc244e700ac82c63f00691e4e3c.tar.bz2
scala-1c53987588496bc244e700ac82c63f00691e4e3c.zip
tentative fix that of bug causing divergence
-rw-r--r--src/library/scala/xml/PrettyPrinter.scala5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/library/scala/xml/PrettyPrinter.scala b/src/library/scala/xml/PrettyPrinter.scala
index 73d8fb54ac..dda65f9303 100644
--- a/src/library/scala/xml/PrettyPrinter.scala
+++ b/src/library/scala/xml/PrettyPrinter.scala
@@ -60,9 +60,9 @@ class PrettyPrinter( width:Int, step:Int ) {
if (i > tmp || i == -1) throw new BrokenException() // cannot break
var last: List[Int] = Nil
- while (i < tmp) {
+ while (i != -1 && i < tmp) {
last = i::last
- i = s.indexOf(' ', i)
+ i = s.indexOf(' ', i+1)
}
var res: List[Item] = Nil
while (Nil != last) try {
@@ -70,6 +70,7 @@ class PrettyPrinter( width:Int, step:Int ) {
cur = ind
res = b :: Break :: cut(s.substring(last.head, s.length), ind)
// backtrack
+ last = last.tail
} catch {
case _:BrokenException => last = last.tail
}