Undo cursor tweaks around prompt

This commit is contained in:
Eugene Yokota 2019-04-20 23:51:13 -04:00
parent c4d6efe5af
commit 95761b2ea1
1 changed files with 2 additions and 10 deletions

View File

@ -57,20 +57,12 @@ abstract class JLine extends LineReader {
else
readLineDirectRaw(prompt, mask)
private[this] val console = ConsoleOut.systemOut
private[this] def readLineDirectRaw(prompt: String, mask: Option[Char]): Option[String] = {
val newprompt = handleMultilinePrompt(prompt)
val result = mask match {
mask match {
case Some(m) => Option(reader.readLine(newprompt, m))
case None => Option(reader.readLine(newprompt))
}
// since the task progress scrolls the logs upward, and expects the cursors to be on
// the last text line, this moves the cursor up to complensate for user hitting return.
val CursorUp1 = s"\u001B[A"
if (ConsoleAppender.showProgress) console.print(CursorUp1)
else ()
result
}
private[this] def handleMultilinePrompt(prompt: String): String = {
@ -87,7 +79,7 @@ abstract class JLine extends LineReader {
private[this] def handleProgress(prompt: String): String = {
import ConsoleAppender._
if (showProgress) s"$ScrollUp$DeleteLine" + prompt
if (showProgress) s"$DeleteLine" + prompt
else prompt
}