WIP: working on search execution
Some checks failed
Run Test Suite / test (push) Failing after 29s

This commit is contained in:
Hayden Hargreaves 2026-04-09 15:17:07 -07:00
parent 514c77c1af
commit 501d15e410
2 changed files with 34 additions and 2 deletions

View File

@ -15,6 +15,9 @@ func (a EnterSearchMode) Execute(m Model) tea.Cmd {
search := m.SearchState()
search.Forword = a.Forward
// BUG: Not sure if this is safe?
m.SetCommandOutput(nil)
m.SetSearchState(search)
m.SetMode(core.SearchMode)
return nil
@ -144,3 +147,32 @@ func (a SearchDeletePreviousWord) Execute(m Model) tea.Cmd {
return nil
}
type SearchExecute struct{}
func (a SearchExecute) Execute(m Model) tea.Cmd {
search := m.SearchState()
// Exit normally
defer func() {
act := ExitSearchMode{}
act.Execute(m)
}()
if !search.Forword {
m.SetCommandOutput(&core.CommandOutput{
Lines: []string{"reverse search not implemented yet."},
Inline: true,
IsError: true,
})
return nil
}
// Do the search
win := m.ActiveWindow()
buf := m.ActiveBuffer()
x, y := win.Cursor.Col, win.Cursor.Line
return nil
}

View File

@ -273,7 +273,7 @@ func NewSearchKeymap() *Keymap {
operators: map[string]action.Operator{}, // this will likely be empty
actions: map[string]action.Action{
"esc": action.ExitSearchMode{},
// "enter": action.CommandExecute{Registry: command.DefaultRegistry},
"enter": action.SearchExecute{},
"backspace": action.SearchBackspace{},
"delete": action.SearchDelete{},
"ctrl+w": action.SearchDeletePreviousWord{},