Skip to content

Commit

Permalink
fix(logger): fix spinner pos
Browse files Browse the repository at this point in the history
  • Loading branch information
eysi09 committed May 19, 2019
1 parent ec3b681 commit 12d0dd4
Showing 2 changed files with 4 additions and 6 deletions.
3 changes: 1 addition & 2 deletions garden-service/src/logger/renderers.ts
Original file line number Diff line number Diff line change
@@ -16,7 +16,6 @@ import {
flow,
isArray,
isEmpty,
padStart,
reduce,
kebabCase,
repeat,
@@ -75,7 +74,7 @@ export function printEmoji(emoji: EmojiName) {

/*** RENDERERS ***/
export function leftPad(entry: LogEntry): string {
return padStart("", (entry.opts.indent || 0) * 3)
return "".padStart((entry.opts.indent || 0) * 3)
}

export function renderEmoji(entry: LogEntry): string {
7 changes: 3 additions & 4 deletions garden-service/src/logger/writers/fancy-terminal-writer.ts
Original file line number Diff line number Diff line change
@@ -93,12 +93,11 @@ export class FancyTerminalWriter extends Writer {
private spin(entries: TerminalEntryWithSpinner[], totalLines: number): void {
entries.forEach(e => {
let out = ""
const [x, y] = e.spinnerCoords
const termX = x === 0 ? x : x + 1
const termY = -(totalLines - y - 1)
const x = e.spinnerCoords[0]
const y = -(totalLines - e.spinnerCoords[1] - 1)
out += ansiEscapes.cursorSavePosition
out += ansiEscapes.cursorTo(0) // Ensure cursor is to the left
out += ansiEscapes.cursorMove(termX, termY)
out += ansiEscapes.cursorMove(x, y)
out += spinnerStyle(this.tickSpinner(e.key))
out += ansiEscapes.cursorRestorePosition
this.stream.write(out)

0 comments on commit 12d0dd4

Please sign in to comment.