Skip to content

Commit

Permalink
Merge branch 'main' into feat-sixel-support
Browse files Browse the repository at this point in the history
  • Loading branch information
raphamorim authored Feb 21, 2025
2 parents a642787 + 27c87a7 commit 17ea3f3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
7 changes: 3 additions & 4 deletions examples/cellbuf/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ func main() {
}

termType := os.Getenv("TERM")
scr := cellbuf.NewScreen(os.Stdout, &cellbuf.ScreenOptions{
Width: w,
Height: h,
scr := cellbuf.NewScreen(os.Stdout, w, h, &cellbuf.ScreenOptions{
Term: termType,
RelativeCursor: !altScreen,
AltScreen: altScreen,
Expand All @@ -58,9 +56,10 @@ func main() {
text := ansi.SetHyperlink("https://charm.sh") +
ansi.Style{}.Reverse().Styled(" !Hello, world! ") +
ansi.ResetHyperlink()
scrw := cellbuf.NewScreenWriter(scr)
render := func() {
scr.Fill(cellbuf.NewCell('你'))
scr.PrintCropAt(x, y, text, "")
scrw.PrintCropAt(x, y, text, "")
scr.Render()
scr.Flush()
}
Expand Down
9 changes: 4 additions & 5 deletions examples/layout/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,10 +375,8 @@ func main() {
}

termType := os.Getenv("TERM")
scr := cellbuf.NewScreen(os.Stdout, &cellbuf.ScreenOptions{
scr := cellbuf.NewScreen(os.Stdout, physicalWidth, physicalHeight, &cellbuf.ScreenOptions{
Term: termType,
Width: physicalWidth,
Height: physicalHeight,
Profile: colorprofile.Detect(os.Stdout, os.Environ()),
AltScreen: true,
})
Expand Down Expand Up @@ -409,11 +407,12 @@ func main() {
dialogWidth := lipgloss.Width(dialogUI) + dialogBoxStyle.GetHorizontalFrameSize()
dialogHeight := lipgloss.Height(dialogUI) + dialogBoxStyle.GetVerticalFrameSize()
dialogX, dialogY := physicalWidth/2-dialogWidth/2-docStyle.GetVerticalFrameSize()-1, 12
scrw := cellbuf.NewScreenWriter(scr)
render := func() {
scr.Clear()
scr.SetContent(docStyle.Render(doc.String()))
scrw.SetContent(docStyle.Render(doc.String()))
box := cellbuf.Rect(dialogX, dialogY, dialogWidth, dialogHeight)
scr.SetContentRect(dialogBoxStyle.Render(dialogUI), box)
scrw.SetContentRect(dialogBoxStyle.Render(dialogUI), box)
scr.Render()
scr.Flush()
}
Expand Down

0 comments on commit 17ea3f3

Please sign in to comment.