This commit is contained in:
parent
514c77c1af
commit
501d15e410
@ -15,6 +15,9 @@ func (a EnterSearchMode) Execute(m Model) tea.Cmd {
|
|||||||
search := m.SearchState()
|
search := m.SearchState()
|
||||||
search.Forword = a.Forward
|
search.Forword = a.Forward
|
||||||
|
|
||||||
|
// BUG: Not sure if this is safe?
|
||||||
|
m.SetCommandOutput(nil)
|
||||||
|
|
||||||
m.SetSearchState(search)
|
m.SetSearchState(search)
|
||||||
m.SetMode(core.SearchMode)
|
m.SetMode(core.SearchMode)
|
||||||
return nil
|
return nil
|
||||||
@ -144,3 +147,32 @@ func (a SearchDeletePreviousWord) Execute(m Model) tea.Cmd {
|
|||||||
|
|
||||||
return nil
|
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
|
||||||
|
}
|
||||||
|
|||||||
@ -272,8 +272,8 @@ func NewSearchKeymap() *Keymap {
|
|||||||
},
|
},
|
||||||
operators: map[string]action.Operator{}, // this will likely be empty
|
operators: map[string]action.Operator{}, // this will likely be empty
|
||||||
actions: map[string]action.Action{
|
actions: map[string]action.Action{
|
||||||
"esc": action.ExitSearchMode{},
|
"esc": action.ExitSearchMode{},
|
||||||
// "enter": action.CommandExecute{Registry: command.DefaultRegistry},
|
"enter": action.SearchExecute{},
|
||||||
"backspace": action.SearchBackspace{},
|
"backspace": action.SearchBackspace{},
|
||||||
"delete": action.SearchDelete{},
|
"delete": action.SearchDelete{},
|
||||||
"ctrl+w": action.SearchDeletePreviousWord{},
|
"ctrl+w": action.SearchDeletePreviousWord{},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user