ammonite.terminal.Protocol.scala Maven / Gradle / Ivy
package ammonite.terminal
case class TermInfo(ts: TermState, width: Int)
sealed trait TermAction
case class Printing(ts: TermState, stdout: String) extends TermAction
case class TermState(inputs: LazyList[Int], buffer: Vector[Char], cursor: Int, msg: fansi.Str = "")
extends TermAction
object TermState {
def unapply(ti: TermInfo): Option[(LazyList[Int], Vector[Char], Int, fansi.Str)] = {
TermState.unapply(ti.ts)
}
def unapply(ti: TermAction): Option[(LazyList[Int], Vector[Char], Int, fansi.Str)] = ti match {
case ts: TermState => Some((ts.inputs, ts.buffer, ts.cursor, ts.msg))
case _ => None
}
}
case class ClearScreen(ts: TermState) extends TermAction
case object Exit extends TermAction
case class Result(s: String) extends TermAction
© 2015 - 2025 Weber Informatics LLC | Privacy Policy