From afa854c55d194bba9558642cb2a79006191c0fc6 Mon Sep 17 00:00:00 2001 From: Alexander Gehrke Date: Sat, 14 May 2022 11:07:59 +0200 Subject: [PATCH] Fix whitespace errors --- build.sc | 2 ++ copret/src/slides.scala | 29 ++++++++++++++++------------- copret/src/terminal.scala | 1 - 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/build.sc b/build.sc index e9610b8..9e33a06 100644 --- a/build.sc +++ b/build.sc @@ -3,6 +3,8 @@ import $ivy.`com.lihaoyi::mill-contrib-bloop:0.9.5` object copret extends ScalaModule with PublishModule { def scalaVersion = "3.1.0" + override def ammoniteVersion = "2.5.3" + def publishVersion = "0.0.1" def pomSettings = PomSettings( diff --git a/copret/src/slides.scala b/copret/src/slides.scala index 9fcc9d7..0b45b84 100644 --- a/copret/src/slides.scala +++ b/copret/src/slides.scala @@ -15,12 +15,13 @@ case class Presentation(slides: Vector[Slide], meta: Map[String, String] = Map.e action match case Start => executeSlide(p, pos)() - rec(p, 1, waitkey) + rec(p, 0, waitkey) case Next | Other(_) => if pos + 1 < p.slides.size then executeSlide(p, pos + 1)() rec(p, pos + 1, waitkey) - else rec(p, pos, waitkey) + else + rec(p, pos, waitkey) case QuickNext => if pos + 1 < p.slides.size then executeQuick(p, pos + 1)() @@ -30,7 +31,8 @@ case class Presentation(slides: Vector[Slide], meta: Map[String, String] = Map.e if pos > 0 then executeQuick(p, pos - 1)() rec(p, pos - 1, waitkey) - else rec(p, pos, waitkey) + else + rec(p, pos, waitkey) case Interactive(cmd, path) => %(cmd)(path) rec(p, pos - 1, QuickNext) @@ -47,7 +49,8 @@ case class Presentation(slides: Vector[Slide], meta: Map[String, String] = Map.e target match case Some(i) => rec(p, pos, Goto(i)) case None => rec(p, pos - 1, QuickNext) - case Quit => () + case Quit => + () rec(this, 0, Start) @@ -112,9 +115,9 @@ case class TypedCommand[T](exec: T => String, display: String, cmd: T) extends S def force() = _output private def typeCmd() = - for char <- display - do print(char) - Thread.sleep(50 + scala.util.Random.nextInt(80)) + for char <- display do + print(char) + Thread.sleep(50 + scala.util.Random.nextInt(80)) println() /* Conditionally disable execution. Useful for e.g. a debug mode, or a non-interactive mode */ @@ -135,22 +138,22 @@ object TypedCommand: def run(using Path): Vector[String] => String = c => safe_%%(c) - def runShell(using Path): Vector[String] => String = + def runShell(using Path): Vector[String] => String = c => safe_%%(Vector(shell, "-c", c.mkString(" "))) - def runInteractive(using Path): Vector[String] => String = + def runInteractive(using Path): Vector[String] => String = c => { %(c); ""} - def apply(cmd: String*)(using Path): TypedCommand[Vector[String]] = + def apply(cmd: String*)(using Path): TypedCommand[Vector[String]] = TypedCommand(run, cmd.mkString(" "), cmd.toVector) - def shell(cmd: String*)(using Path): TypedCommand[Vector[String]] = + def shell(cmd: String*)(using Path): TypedCommand[Vector[String]] = TypedCommand(runShell, cmd.mkString(" "), cmd.toVector) - def fake(cmd: String): TypedCommand[String] = + def fake(cmd: String): TypedCommand[String] = TypedCommand(_ => "", cmd, cmd) - def interactive(cmd: String*)(using Path): TypedCommand[Vector[String]] = + def interactive(cmd: String*)(using Path): TypedCommand[Vector[String]] = TypedCommand(runInteractive, cmd.mkString(" "), cmd.toVector) diff --git a/copret/src/terminal.scala b/copret/src/terminal.scala index 2e75cb7..63f6bdf 100644 --- a/copret/src/terminal.scala +++ b/copret/src/terminal.scala @@ -67,5 +67,4 @@ private[copret] trait TerminalSyntax: def rows = jterm.getSize.getRows - /* vim:set tw=120: */