Commit Graph

418 Commits

Author SHA1 Message Date
Christian Rocha 65df16238d Fix coloring glitch in Glamour example 2021-05-14 22:30:46 -04:00
Christian Rocha 70be13948a Re-render all lines if the total number of lines increases
If the number of lines increased there's a chance that the increase in
lines caused the terminal to scroll (even in the altscreen). Because of
this we must repaint everything, as skipping lines will mis-render.

Thanks to @fiws for reporting this bug.
2021-05-14 20:04:40 -04:00
Christian Rocha 54da5489a0 Add fm and StormForge to projects using Bubble Tea in the README 2021-05-10 12:46:45 -04:00
Christian Rocha fb64f34bd0 Only render lines that have changed since the last render 2021-05-10 12:28:49 -04:00
Christian Rocha c07cbd1e32 Pull batch processing into the internal message switch 2021-05-06 18:10:17 -04:00
Christian Rocha 4fbe50adb6 Disable mouse when exiting due to a panic 2021-05-05 18:11:56 -04:00
Christian Rocha 3dff6d4b58 Deprecate Program.EnterAltScreen Program.ExitAltScreen methods
The EnterAltScreen/ExitAltScreen commands should be used instead.
2021-05-05 18:11:56 -04:00
Christian Rocha 5c150ebf38 Add cmds for toggling mouse mode + deprecate equivalent Program methods
Also automatically disable mouse mode on exit.
2021-05-05 18:11:56 -04:00
Christian Rocha 7c0bbc7d32 Clean up and normalize examples 2021-05-01 09:33:13 -04:00
Elio Esteves Duarte 64ae19f37e Add paginator example 2021-05-01 08:54:57 -04:00
Tobias Klauser 295f7bd246 Use golang.org/x/term
The golang.org/x/crypto/ssh/terminal package is deprecated and merely a
wrapper around golang.org/x/term. Use the latter directly and avoid the
dependency on the former altogether.
2021-04-29 15:05:50 +02:00
Christian Rocha b9e853eb2d Edits to library descriptions in README 2021-04-14 22:18:27 +02:00
Christian Muehlhaeuser edc7d8c0a9 Add lipgloss to README links, move projects below it 2021-04-14 22:18:27 +02:00
Christian Rocha 42f02edf29 Update spinner, textinput and pipe examples for Bubbles v0.7.7 2021-04-13 22:21:09 -04:00
sora233 ebf80ebf89 Fix stack overflow in examples/http 2021-04-09 10:02:40 +02:00
Kiyon 2d602a1244 Remove redundant lock in listen 2021-04-08 03:47:22 +02:00
Kiyon 1ee40507ef Add lock for updating width and height 2021-04-08 03:45:08 +02:00
Christian Muehlhaeuser ab65f2391f
Bump bubbletea dependency for examples & tutorials 2021-04-03 02:03:23 +02:00
Christian Muehlhaeuser 72ce94f47d
Bump termenv to v0.8.1 2021-04-03 01:43:33 +02:00
Christian Rocha 9d89d162c2 Clear the bottom line before exiting 2021-03-18 13:10:32 -04:00
Christian Rocha 9e9020afce Fix typo in Glamour example 2021-03-18 13:10:15 -04:00
Christian Rocha 5d54a46124
Fix the build badge again
This is why we do PRs first
2021-03-18 12:36:25 -04:00
Christian Rocha 9bc82e4ce6
Whoops, use the Bubble Tea workflow badge instead of Glow's 2021-03-18 12:33:54 -04:00
Christian Muehlhaeuser a72db29ae0 Mutex protect buffer access in standard renderer 2021-03-13 04:31:34 +01:00
Christian Muehlhaeuser ac28669943
Enable golint as linter 2021-03-12 02:19:09 +01:00
Christian Muehlhaeuser f981b991c0 Fix ineffectual assignment in spinner example 2021-03-12 02:17:27 +01:00
Christian Muehlhaeuser b6c7f93d9a Fix various typos in examples 2021-03-12 02:16:41 +01:00
Christian Muehlhaeuser d2c1d9bfb0 Omit unhandled error 2021-03-12 01:25:54 +01:00
Christian Muehlhaeuser b664dee939 Fix typo 2021-03-12 01:24:38 +01:00
Christian Rocha 231fa2cb73
Make altscreen demo slightly fancier 2021-03-11 15:15:08 -05:00
Christian Rocha 01878b5650
Make tui-daemon-combo demo look a little more enticing 2021-03-11 15:03:52 -05:00
Christian Rocha a87e82a3e8
Bump Bubble Tea and Termenv dependencies in examples 2021-03-11 15:03:25 -05:00
Christian Rocha c310475b99
Add Gembro to list of things made with Bubble Tea 2021-03-11 10:15:27 -05:00
Kiyon 7621fad279 Add item for Bubble Tea in the Wild section 2021-03-09 03:52:23 +01:00
Kiyon ac36017f86 WithOutput option should take io.Writer as argument. 2021-03-09 03:51:34 +01:00
Christian Rocha 65e8067a82 Implement String() on type Key and make key constants type KeyType 2021-03-08 19:11:02 -05:00
kiyon 86b93a31c0
Add commands for toggling the altscreen (#62)
* Add commands EnterAltScreen and ExitAltScreen for toggling the altscreen
* Add altscreen toggling example
* ignore .idea

Co-authored-by: Christian Rocha <christian@rocha.is>
2021-03-08 12:48:34 -05:00
Christian Rocha b3f62af8b5 Add nil renderer and combination TUI-daemon program example
The Nil Renderer essentially disables the Bubble Tea renderer sending
loggings and print statements to stdout. It can be enabled via the
ProgramOption WithoutRenderer.
2021-03-07 13:01:54 -05:00
Christian Rocha 2b8b95d8f8 Fix spinners not spinning in spinners examples (fixes #58) 2021-03-03 16:07:35 -05:00
Christian Rocha cd676fab5a
Correct logic where we add a space after the prefix when logging 2021-03-01 18:05:53 -05:00
Christian Rocha fbd32c6eee
Add tz to the list of things built with Bubble Tea 2021-03-01 14:15:05 -05:00
Christian Rocha 0780601791 Open a TTY if input is not a TTY, unless the user has spec'd otherwise 2021-02-27 16:03:34 -05:00
Christian Rocha 4e2643f318 Make sure we pass our mutex by reference 2021-02-27 16:03:34 -05:00
Christian Rocha 65cb46c475
Remove notes about how we'd auto-truncate lines as we're doing that now 2021-02-25 12:12:52 -05:00
Carl Henrik Lunde 3266c3654b Avoid race on renderer.buf in flush vs. write
Fix race by acquiring the mutex before accessing renderer.buf in flush.

	WARNING: DATA RACE
	Read at 0x00c0000ee0a0 by goroutine 11:
	  bytes.(*Buffer).Len()
	      /home/chlunde/opt/go/src/bytes/buffer.go:73 +0x64
	  github.com/charmbracelet/bubbletea.(*renderer).flush()
	      /home/chlunde/src/bubbletea/renderer.go:91 +0x45
	  github.com/charmbracelet/bubbletea.(*renderer).listen()
	      /home/chlunde/src/bubbletea/renderer.go:76 +0x185

	Previous write at 0x00c0000ee0a0 by main goroutine:
	  bytes.(*Buffer).Reset()
	      /home/chlunde/opt/go/src/bytes/buffer.go:98 +0xf5
	  github.com/charmbracelet/bubbletea.(*renderer).write()
	      /home/chlunde/src/bubbletea/renderer.go:195 +0x13c
	  github.com/charmbracelet/bubbletea.(*Program).Start()
	      /home/chlunde/src/bubbletea/tea.go:330 +0xbbb
	  main.main()
	      /home/chlunde/src/bubbletea/examples/spinner/main.go:27 +0x229

Fixes #54
2021-02-25 10:56:48 -05:00
Christian Muehlhaeuser 92a795256a go mod tidy 2021-02-25 10:49:33 -05:00
Christian Rocha 91bd232fe2 Add example illustrating how to send messages via channels in realtime 2021-02-10 00:01:37 +00:00
Christian Rocha dd6a0a092e Bump deps in examples 2021-02-06 19:21:40 +00:00
Christian Rocha d3267e8ce0 Remove logging in text input example 2021-02-06 19:21:40 +00:00
Christian Rocha 133a315b2c Remove double import in textinput example + make a var name less weird 2021-02-06 19:21:40 +00:00