Skip to content

Commit

Permalink
revert to original jansi cursor position escape sequenences
Browse files Browse the repository at this point in the history
The behavior has changed with jansi 2.4.1, leading to issues for Windows
Terminal on Windows 8.1.
  • Loading branch information
memo33 committed Oct 21, 2024
1 parent 95df071 commit a86e20f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Changelog

## [Unreleased]
### Fixed
- an issue affecting some old terminals in which the escape sequences used for displaying progress bars were incorrectly printed to the console

### Changed
- improved error message if channel-build fails randomly in case old files could not be removed
Expand Down
6 changes: 4 additions & 2 deletions src/main/scala/sc4pac/Logger.scala
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,11 @@ class CliLogger private (out: java.io.PrintStream, useColor: Boolean, isInteract
val coloredSymbols = if (!cyan) spinnerSymbols else spinnerSymbols.map(this.cyan)
val spin: String => Unit = if (!sameLine) {
val col = msg.map(_.length + 2).getOrElse(1)
(symbol) => out.print(Ansi.ansi().saveCursorPosition().cursorUpLine().cursorToColumn(col).a(symbol).restoreCursorPosition())
// There are two different cursor position standards, see https://github.com/fusesource/jansi/issues/226
// TODO For macOS Term.app, we may need not use DEC instead of SCO.
(symbol) => out.print(Ansi.ansi().saveCursorPositionSCO().cursorUpLine().cursorToColumn(col).a(symbol).restoreCursorPositionSCO())
} else {
(symbol) => out.print(Ansi.ansi().saveCursorPosition().cursorRight(2).a(symbol).restoreCursorPosition())
(symbol) => out.print(Ansi.ansi().saveCursorPositionSCO().cursorRight(2).a(symbol).restoreCursorPositionSCO())
}
val spinner = ZIO.iterate(0)(_ => true) { i =>
for (_ <- ZIO.sleep(duration)) yield { // TODO use zio.Schedule instead?
Expand Down

0 comments on commit a86e20f

Please sign in to comment.