Skip to content

Commit

Permalink
chore(deps): bump ansi from 0.3.2 to 0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
aymanbagabas committed Oct 24, 2024
1 parent 1c01f2b commit 2b4accc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.18

require (
github.com/charmbracelet/lipgloss v0.13.0
github.com/charmbracelet/x/ansi v0.3.2
github.com/charmbracelet/x/ansi v0.4.0
github.com/charmbracelet/x/term v0.2.0
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f
github.com/mattn/go-localereader v0.0.1
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ github.com/charmbracelet/lipgloss v0.13.0 h1:4X3PPeoWEDCMvzDvGmTajSyYPcZM4+y8sCA
github.com/charmbracelet/lipgloss v0.13.0/go.mod h1:nw4zy0SBX/F/eAO1cWdcvy6qnkDUxr8Lw7dvFrAIbbY=
github.com/charmbracelet/x/ansi v0.3.2 h1:wsEwgAN+C9U06l9dCVMX0/L3x7ptvY1qmjMwyfE6USY=
github.com/charmbracelet/x/ansi v0.3.2/go.mod h1:dk73KoMTT5AX5BsX0KrqhsTqAnhZZoCBjs7dGWp4Ktw=
github.com/charmbracelet/x/ansi v0.4.0 h1:NqwHA4B23VwsDn4H3VcNX1W1tOmgnvY1NDx5tOXdnOU=
github.com/charmbracelet/x/ansi v0.4.0/go.mod h1:dk73KoMTT5AX5BsX0KrqhsTqAnhZZoCBjs7dGWp4Ktw=
github.com/charmbracelet/x/term v0.2.0 h1:cNB9Ot9q8I711MyZ7myUR5HFWL/lc3OpU8jZ4hwm0x0=
github.com/charmbracelet/x/term v0.2.0/go.mod h1:GVxgxAbjUrmpvIINHIQnJJKpMlHiZ4cktEQCN6GWyF0=
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f h1:Y/CXytFA4m6baUTXGLOoWe4PQhGxaX0KpnayAqC48p4=
Expand Down
20 changes: 10 additions & 10 deletions standard_renderer.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ func (r *standardRenderer) flush() {
// This case fixes a bug in macOS terminal. In other terminals the
// other case seems to do the job regardless of whether or not we're
// using the full terminal window.
buf.WriteString(ansi.MoveCursor(r.linesRendered, 0))
buf.WriteString(ansi.SetCursorPosition(0, r.linesRendered))
} else {
buf.WriteString(ansi.CursorLeft(r.width))
}
Expand Down Expand Up @@ -312,8 +312,8 @@ func (r *standardRenderer) clearScreen() {
r.mtx.Lock()
defer r.mtx.Unlock()

r.execute(ansi.EraseEntireDisplay)
r.execute(ansi.MoveCursorOrigin)
r.execute(ansi.EraseEntireScreen)
r.execute(ansi.CursorOrigin)

r.repaint()
}
Expand Down Expand Up @@ -342,8 +342,8 @@ func (r *standardRenderer) enterAltScreen() {
//
// Note: we can't use r.clearScreen() here because the mutex is already
// locked.
r.execute(ansi.EraseEntireDisplay)
r.execute(ansi.MoveCursorOrigin)
r.execute(ansi.EraseEntireScreen)
r.execute(ansi.CursorOrigin)

// cmd.exe and other terminals keep separate cursor states for the AltScreen
// and the main buffer. We have to explicitly reset the cursor visibility
Expand Down Expand Up @@ -516,7 +516,7 @@ func (r *standardRenderer) setIgnoredLines(from int, to int) {
}
buf.WriteString(ansi.CursorUp1)
}
buf.WriteString(ansi.MoveCursor(r.linesRendered, 0)) // put cursor back
buf.WriteString(ansi.SetCursorPosition(0, r.linesRendered)) // put cursor back
_, _ = r.out.Write(buf.Bytes())
}
}
Expand Down Expand Up @@ -556,13 +556,13 @@ func (r *standardRenderer) insertTop(lines []string, topBoundary, bottomBoundary
buf := &bytes.Buffer{}

buf.WriteString(ansi.SetScrollingRegion(topBoundary, bottomBoundary))
buf.WriteString(ansi.MoveCursor(topBoundary, 0))
buf.WriteString(ansi.SetCursorPosition(0, topBoundary))
buf.WriteString(ansi.InsertLine(len(lines)))
_, _ = buf.WriteString(strings.Join(lines, "\r\n"))
buf.WriteString(ansi.SetScrollingRegion(0, r.height))

// Move cursor back to where the main rendering routine expects it to be
buf.WriteString(ansi.MoveCursor(r.linesRendered, 0))
buf.WriteString(ansi.SetCursorPosition(0, r.linesRendered))

_, _ = r.out.Write(buf.Bytes())
}
Expand All @@ -586,12 +586,12 @@ func (r *standardRenderer) insertBottom(lines []string, topBoundary, bottomBound
buf := &bytes.Buffer{}

buf.WriteString(ansi.SetScrollingRegion(topBoundary, bottomBoundary))
buf.WriteString(ansi.MoveCursor(bottomBoundary, 0))
buf.WriteString(ansi.SetCursorPosition(0, bottomBoundary))
_, _ = buf.WriteString("\r\n" + strings.Join(lines, "\r\n"))
buf.WriteString(ansi.SetScrollingRegion(0, r.height))

// Move cursor back to where the main rendering routine expects it to be
buf.WriteString(ansi.MoveCursor(r.linesRendered, 0))
buf.WriteString(ansi.SetCursorPosition(0, r.linesRendered))

_, _ = r.out.Write(buf.Bytes())
}
Expand Down

0 comments on commit 2b4accc

Please sign in to comment.