mirror of https://github.com/sbt/sbt.git
[2.x] refactor: Update EscHelpers.scala (#8928)
This commit is contained in:
parent
e0a067da99
commit
a6a1cf383e
|
|
@ -99,7 +99,6 @@ object EscHelpers {
|
|||
var index = 0
|
||||
var state = 0
|
||||
val digit = new ArrayBuffer[Byte]
|
||||
var leftDigit = -1
|
||||
while (i < bytes.length) {
|
||||
bytes(i) match {
|
||||
case 27 => state = esc
|
||||
|
|
@ -111,7 +110,7 @@ object EscHelpers {
|
|||
state = 0
|
||||
index = index - 1
|
||||
case b if state == csi =>
|
||||
leftDigit = Try(new String(digit.toArray).toInt).getOrElse(0)
|
||||
val leftDigit = Try(new String(digit.toArray).toInt).getOrElse(0)
|
||||
state = 0
|
||||
b.toChar match {
|
||||
case 'D' => index = math.max(index - leftDigit, 0)
|
||||
|
|
@ -150,7 +149,6 @@ object EscHelpers {
|
|||
var state = 0
|
||||
var limit = 0
|
||||
val digit = new ArrayBuffer[Byte]
|
||||
var leftDigit = -1
|
||||
var escIndex = -1
|
||||
bytes.foreach { b =>
|
||||
if (index < res.length) res(index) = b
|
||||
|
|
@ -169,7 +167,7 @@ object EscHelpers {
|
|||
state = 0
|
||||
index = math.max(index - 1, 0)
|
||||
case b if state == csi =>
|
||||
leftDigit = Try(new String(digit.toArray).toInt).getOrElse(0)
|
||||
val leftDigit = Try(new String(digit.toArray).toInt).getOrElse(0)
|
||||
state = 0
|
||||
b.toChar match {
|
||||
case 'h' | 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'J' | 'K' =>
|
||||
|
|
@ -206,7 +204,6 @@ object EscHelpers {
|
|||
var state = 0
|
||||
var limit = 0
|
||||
val digit = new ArrayBuffer[Byte]
|
||||
var leftDigit = -1
|
||||
bytes.foreach {
|
||||
case 27 => state = esc
|
||||
case b if (state == esc || state == csi) && b >= 48 && b < 58 =>
|
||||
|
|
@ -217,7 +214,7 @@ object EscHelpers {
|
|||
state = 0
|
||||
index = math.max(index - 1, 0)
|
||||
case b if state == csi =>
|
||||
leftDigit = Try(new String(digit.toArray).toInt).getOrElse(0)
|
||||
val leftDigit = Try(new String(digit.toArray).toInt).getOrElse(0)
|
||||
state = 0
|
||||
b.toChar match {
|
||||
case 'h' => index = math.max(index - 1, 0)
|
||||
|
|
|
|||
Loading…
Reference in New Issue