feat: enable Win32 Input Mode on Windows to get paste support
This commit is contained in:
parent
dd7ab600a0
commit
6c5845ae7a
2 changed files with 9 additions and 0 deletions
6
tea.go
6
tea.go
|
|
@ -1070,6 +1070,9 @@ func (p *Program) Run() (returnModel Model, returnErr error) {
|
|||
// enhancements.
|
||||
p.requestKeyboardEnhancements()
|
||||
} else {
|
||||
// Turn on Win32 Input Mode.
|
||||
_, _ = p.renderer.writeString(ansi.SetWin32InputMode)
|
||||
p.modes.Set(ansi.Win32InputMode)
|
||||
// Send an empty message to tell the user we support
|
||||
// keyboard enhancements on Windows.
|
||||
go p.Send(KeyboardEnhancementsMsg{})
|
||||
|
|
@ -1292,6 +1295,9 @@ func (p *Program) RestoreTerminal() error {
|
|||
}
|
||||
|
||||
p.startRenderer()
|
||||
if p.modes.IsSet(ansi.Win32InputMode) {
|
||||
p.execute(ansi.SetWin32InputMode)
|
||||
}
|
||||
if p.modes.IsSet(ansi.BracketedPasteMode) {
|
||||
p.execute(ansi.SetBracketedPasteMode)
|
||||
}
|
||||
|
|
|
|||
3
tty.go
3
tty.go
|
|
@ -38,6 +38,9 @@ func (p *Program) restoreTerminalState() error {
|
|||
// close the renderer. See [screenRenderer.close] and
|
||||
// [cellbuf.Screen.Close].
|
||||
|
||||
if p.modes.IsSet(ansi.Win32InputMode) {
|
||||
p.execute(ansi.ResetWin32InputMode)
|
||||
}
|
||||
if p.modes.IsSet(ansi.BracketedPasteMode) {
|
||||
p.execute(ansi.ResetBracketedPasteMode)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue