fix: added enter command mode action
This commit is contained in:
parent
0a149b4e44
commit
f2496f91dd
@ -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
|
||||||
|
}
|
||||||
|
|||||||
@ -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)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user