| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- package editor
- import (
- //"fmt"
- //"github.com/gdamore/tcell"
- )
- /*func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
- switch msg := msg.(type) {
- case tea.WindowSizeMsg:
- m.Width = msg.Width
- m.Height = msg.Height
- m.Viewport.SetWidth(msg.Width)
- h := msg.Height - 2
- if h < 0 {
- h = 0
- }
- m.Viewport.SetHeight(h)
- return m, nil
- case tea.MouseWheelMsg:
- return m, nil
- case tea.KeyPressMsg:
- for i := range m.Actions {
- action := m.Actions[i]
- if key.Matches(msg, action.Binding) {
- //fmt.Println(msg, action.Binding)
- cmd := action.Callback(&m, []string{})
- m.Viewport.SetContent(m.renderedContent())
- return m, cmd
- }
- }
- key := msg.Key()
- if key.Text != "" {
- for _, r := range key.Text {
- m.Buffer.Insert(r)
- }
- }
- m.Viewport.SetContent(m.renderedContent())
- return m, nil
- }
- return m, nil
- }
- */
|