* feat: bracketed paste
This introduces support for input via bracketed paste, where escape
characters in the pasted input are not interpreted.
Pasted input are marked as a special field in the KeyMsg. This is
useful because pasted input may need sanitation in individual widgets.
* fix(key): support bracketed paste with short reads
Some terminal emulators feed the bracketed paste data in multiple
chunks, which may not be aligned on a 256 byte boundary. So it's
possible for `input.Read` to return less than 256 bytes read
but while there's still more data to be read to complete a bracketed
paste input.
---------
Co-authored-by: Christian Muehlhaeuser <muesli@gmail.com>
* add: program.ReleaseTerminal and RestoreTerminal to re-use input & terminal
* chore(examples): add altscreen toggling to exec demo
* chore: put low-level altscreen stuff alongside other screen funcs
* docs: edit GoDocs for ReleaseTerminal and RestoreTerminal
* feat(renderer): add internal Msg renderMsg to immediately repaint
* fix: repaint instantly on RestoreTerminal
* fix: restore the altscreen state when restoring the terminal
* feat: implement Cmd-based API for blocking *exec.Cmds
* feat: allow Exec to return custom messages
* feat: allow Exec to be run without a callback
* fix: separate parameters for exec.Command examples
* fix: error message would get printed over by prompt in exec example
* fix: ignore signals while child process is running
* feat: allow to execute other things besides exec.Commands (#280)
* feat: allow to execute other things besides exec.Commands.
* fix: lint issues
* fix: renames, examples
* fix: callback type should be exported
* docs(exce): tiny ExecCommand doc comment correction
* chore(exec): break out Cmd for clarity's sake in example
* fix(exec): give the terminal a moment to catch up if exiting altscreen
* docs(exec): tidy up doc comments
* chore(exec): disambiguate methods for restoring the terminal state vs input
Co-authored-by: Christian Rocha <christian@rocha.is>
Co-authored-by: Carlos A Becker <caarlos0@gmail.com>
This commit also consolidates the exit operations for consistency's
sake, and adds a kill() method to renderers for stopping them without
performing any final rendering.
v0.13.4 introduced a regression where lines weren't always cleared when
resizing the window resulting in the presence of rendering artifacts.
This commit fixes that.
The Nil Renderer essentially disables the Bubble Tea renderer sending
loggings and print statements to stdout. It can be enabled via the
ProgramOption WithoutRenderer.
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