mirror of
https://github.com/Maks1mS/bubbles.git
synced 2024-12-23 22:32:59 +03:00
Add ^A and ^E keybindings
This commit is contained in:
parent
48e19e3b0d
commit
501f9cbbe1
5
go.mod
5
go.mod
@ -2,4 +2,7 @@ module github.com/charmbracelet/teaparty
|
||||
|
||||
go 1.13
|
||||
|
||||
require github.com/charmbracelet/tea v0.0.0-20200126032228-29799c315162
|
||||
require (
|
||||
github.com/charmbracelet/tea v0.0.0-20200130023737-bb06373836b4
|
||||
golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9 // indirect
|
||||
)
|
||||
|
6
go.sum
6
go.sum
@ -1,6 +1,8 @@
|
||||
github.com/charmbracelet/tea v0.0.0-20200126032228-29799c315162 h1:BderJi+l/5OV27L0wfE3yUA6rXaDldcKAHVUt8DfYVw=
|
||||
github.com/charmbracelet/tea v0.0.0-20200126032228-29799c315162/go.mod h1:UsFFdg04MNbcYi1r2FBtdDEFY07bObaYDKHhE1xZUaQ=
|
||||
github.com/charmbracelet/tea v0.0.0-20200130023737-bb06373836b4 h1:O8IGyYrKQuCwZZ98JP3DvzQCoPiXM5Y2zjwlDY7mOFM=
|
||||
github.com/charmbracelet/tea v0.0.0-20200130023737-bb06373836b4/go.mod h1:UsFFdg04MNbcYi1r2FBtdDEFY07bObaYDKHhE1xZUaQ=
|
||||
github.com/pkg/term v0.0.0-20190109203006-aa71e9d9e942 h1:A7GG7zcGjl3jqAqGPmcNjd/D9hzL95SuoOQAaFNdLU0=
|
||||
github.com/pkg/term v0.0.0-20190109203006-aa71e9d9e942/go.mod h1:eCbImbZ95eXtAUIbLAuAVnBnwf83mjf6QIVH8SHYwqQ=
|
||||
golang.org/x/sys v0.0.0-20200120151820-655fe14d7479 h1:LhLiKguPgZL+Tglay4GhVtfF0kb8cvOJ0dHTCBO8YNI=
|
||||
golang.org/x/sys v0.0.0-20200120151820-655fe14d7479/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9 h1:1/DFK4b7JH8DmkqhUk48onnSfrPzImPoVxuomtbT2nk=
|
||||
golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
|
@ -51,6 +51,12 @@ func Update(msg tea.Msg, m Model) (Model, tea.Cmd) {
|
||||
m.pos++
|
||||
}
|
||||
return m, nil
|
||||
case tea.KeyCtrlA: // ^A, beginning
|
||||
m.pos = 0
|
||||
return m, nil
|
||||
case tea.KeyCtrlE: // ^E, end
|
||||
m.pos = len(m.Value) - 1
|
||||
return m, nil
|
||||
case tea.KeyRune:
|
||||
m.Value = m.Value[:m.pos] + msg.String() + m.Value[m.pos:]
|
||||
m.pos++
|
||||
|
Loading…
Reference in New Issue
Block a user