8000 Terminal.println() is a no-op while an animation is running. · Issue #264 · ajalt/mordant · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Terminal.println() is a no-op while an animation is running. #264
Open
@RafeArnold

Description

@RafeArnold

If the terminal is actively running an animation, the line-feed that should be appended to the console when calling Terminal.println(), or Terminal.println(String) does not get printed. This is due to the terminal interceptors being run before the text is handed to TerminalInterface.completePrintRequest(PrintRequest) where the line-feed is applied.

To reproduce, run the below code in an interactive terminal:

import com.github.ajalt.mordant.animation.textAnimation
import com.github.ajalt.mordant.terminal.Terminal

fun main() {
  val terminal = Terminal()
  val animation = terminal.textAnimation<Unit> { "whatever" }
  animation.update(Unit)
  terminal.println("asdasdasdas\n")
  terminal.println("asdasdasdas")
  terminal.println()
  terminal.println()
  animation.stop()
}

Expected output:

asdasdasdas

asdasdasdas


whatever

Actual output:

asdasdasdas
asdasdasdas
whatever

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0