Skip to content

Commit

Permalink
Merge pull request #779 from garden-io/fix-spinner-pos
Browse files Browse the repository at this point in the history
fix(logger): fix spinner pos
  • Loading branch information
eysi09 authored May 20, 2019
2 parents ec3b681 + 12d0dd4 commit b7bf2ad
Show file tree
Hide file tree
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
Expand Up @@ -16,7 +16,6 @@ import {
flow,
isArray,
isEmpty,
padStart,
reduce,
kebabCase,
repeat,
Expand Down Expand Up @@ -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 {
Expand Down
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
Expand Up @@ -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)
Expand Down

0 comments on commit b7bf2ad

Please sign in to comment.