fix: added enter command mode action

This commit is contained in:
Hayden Hargreaves 2026-02-10 22:30:01 -07:00
parent 0a149b4e44
commit f2496f91dd
3 changed files with 10 additions and 1 deletions

View File

@ -8,3 +8,11 @@ type Quit struct{}
func (a Quit) Execute(m Model) tea.Cmd { func (a Quit) Execute(m Model) tea.Cmd {
return tea.Quit return tea.Quit
} }
// Quit implements Action (:)
type EnterComandMode struct{}
func (a EnterComandMode) Execute(m Model) tea.Cmd {
m.SetMode(CommandMode)
return nil
}

View File

@ -69,7 +69,7 @@ func (m Model) View() string {
var bar string var bar string
if m.mode == action.CommandMode { if m.mode == action.CommandMode {
bar = fmt.Sprintf(" %6s | %d:%d (%d:%d) %s ", modeString, m.cursor.x, m.cursor.y, m.win_w, m.win_h, m.command) bar = fmt.Sprintf(" %6s | %d:%d (%d:%d) :%s ", modeString, m.cursor.x, m.cursor.y, m.win_w, m.win_h, m.command)
} else { } else {
bar = fmt.Sprintf(" %6s | %d:%d (%d:%d) | %s | %+v | %d", modeString, m.cursor.x, m.cursor.y, m.win_w, m.win_h, m.input.Pending(), m.insertKeys, m.insertCount) bar = fmt.Sprintf(" %6s | %d:%d (%d:%d) | %s | %+v | %d", modeString, m.cursor.x, m.cursor.y, m.win_w, m.win_h, m.input.Pending(), m.insertKeys, m.insertCount)
} }

View File

@ -41,6 +41,7 @@ func NewNormalKeymap() *Keymap {
"O": action.OpenLineAbove{}, "O": action.OpenLineAbove{},
"x": action.DeleteChar{Count: 1}, "x": action.DeleteChar{Count: 1},
"ctrl+c": action.Quit{}, "ctrl+c": action.Quit{},
":": action.EnterComandMode{},
}, },
} }
} }