From f2496f91ddfda8d6e1fa600c2ed6126d3d707454 Mon Sep 17 00:00:00 2001 From: Hayden Hargreaves Date: Tue, 10 Feb 2026 22:30:01 -0700 Subject: [PATCH] fix: added enter command mode action --- internal/action/misc.go | 8 ++++++++ internal/editor/view.go | 2 +- internal/input/keymap.go | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/internal/action/misc.go b/internal/action/misc.go index d45f40a..2b53ae2 100644 --- a/internal/action/misc.go +++ b/internal/action/misc.go @@ -8,3 +8,11 @@ type Quit struct{} func (a Quit) Execute(m Model) tea.Cmd { return tea.Quit } + +// Quit implements Action (:) +type EnterComandMode struct{} + +func (a EnterComandMode) Execute(m Model) tea.Cmd { + m.SetMode(CommandMode) + return nil +} diff --git a/internal/editor/view.go b/internal/editor/view.go index e1475d1..f949f25 100644 --- a/internal/editor/view.go +++ b/internal/editor/view.go @@ -69,7 +69,7 @@ func (m Model) View() string { var bar string 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 { 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) } diff --git a/internal/input/keymap.go b/internal/input/keymap.go index 473ae3b..0279bde 100644 --- a/internal/input/keymap.go +++ b/internal/input/keymap.go @@ -41,6 +41,7 @@ func NewNormalKeymap() *Keymap { "O": action.OpenLineAbove{}, "x": action.DeleteChar{Count: 1}, "ctrl+c": action.Quit{}, + ":": action.EnterComandMode{}, }, } }