• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

charmbracelet / bubbletea / 10496975098
61%
main: 72%

Build:
Build:
LAST BUILD BRANCH: windows-fkeys
DEFAULT BRANCH: main
Ran 21 Aug 2024 08:27PM UTC
Jobs 1
Files 30
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

21 Aug 2024 08:26PM UTC coverage: 61.583% (-0.5%) from 62.125%
10496975098

push

github

web-flow
feat: expose the renderer interface (#1094)

This adds the ability to use a custom renderer using a modified version
of the existing `renderer` interface. This also keeps track of enabled
capabilities and ensure they are turned off on program exit. It only
turns off enabled capabilities rather.

The new API looks like:

```go
// Renderer is the interface for Bubble Tea renderers.
type Renderer interface {
	// Close closes the renderer and flushes any remaining data.
	Close() error

	// Render renders a frame to the output.
	Render(string) error

	// SetOutput sets the output for the renderer.
	SetOutput(io.Writer)

	// Flush flushes the renderer's buffer to the output.
	Flush() error

	// InsertAbove inserts lines above the current frame. This only works in
	// inline mode.
	InsertAbove(string) error

	// Resize sets the size of the terminal.
	Resize(w int, h int)

	// Request a full re-render. Note that this will not trigger a render
	// immediately. Rather, this method causes the next render to be a full
	// Repaint. Because of this, it's safe to call this method multiple times
	// in succession.
	Repaint()

	// ClearScreen clear the terminal screen. This should always have the same
	// behavior as the "clear" command which is equivalent to `CSI 2 J` and
	// `CSI H`.
	ClearScreen()

	// SetMode sets a terminal mode on/off. The mode argument is an int
	// consisting of the mode identifier.
	// For example, to set alt-screen mode, you would call SetMode(1049, true).
	SetMode(mode int, on bool)

	// Mode returns whether the render has a mode enabled.
	// For example, to check if alt-screen mode is enabled, you would call
	// Mode(1049).
	Mode(mode int) bool
}
```

--- 

This also introduces some performance gains by not writing unnecessary
sequences on enable/disable terminal modes. For example, we always hide
the cursor when the program runs, it doesn't make sense to write the
sequence again whe... (continued)

164 of 278 new or added lines in 6 files covered. (58.99%)

6 existing lines in 2 files now uncovered.

2108 of 3423 relevant lines covered (61.58%)

234.4 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
4
61.46
-2.67% options.go
4
44.28
1.57% tty.go
6
40.0
-60.0% nil_renderer.go
7
50.85
10.31% screen.go
23
52.96
-4.46% standard_renderer.go
70
64.83
-1.91% tea.go

Uncovered Existing Lines

Lines Coverage ∆ File
1
52.96
-4.46% standard_renderer.go
5
64.83
-1.91% tea.go
Jobs
ID Job ID Ran Files Coverage
1 10496975098.1 21 Aug 2024 08:27PM UTC 30
61.58
GitHub Action Run
Source Files on build 10496975098
  • Tree
  • List 30
  • Changed 6
  • Source Changed 0
  • Coverage Changed 6
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 1f5a28f8 on github
  • Prev Build on master (#10478253115)
  • Next Build on master (#10497286340)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc