mirror of
https://github.com/Gu1llaum-3/sshm.git
synced 2026-01-27 03:04:21 +01:00
feat: add configurable key bindings with ESC quit disable option
- Add unified application configuration system with JSON config file - Implement configurable quit keys (default: "q", "ctrl+c") - Add disable_esc_quit option for vim users to prevent accidental exits - Auto-create default config file at ~/.config/sshm/config.json - Maintain backward compatibility (ESC quit enabled by default) - Include comprehensive tests and documentation
This commit is contained in:
@@ -445,8 +445,9 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
|
||||
func (m Model) handleListViewKeys(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
|
||||
var cmd tea.Cmd
|
||||
key := msg.String()
|
||||
|
||||
switch msg.String() {
|
||||
switch key {
|
||||
case "esc", "ctrl+c":
|
||||
if m.deleteMode {
|
||||
// Exit delete mode
|
||||
@@ -455,10 +456,16 @@ func (m Model) handleListViewKeys(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
|
||||
m.table.Focus()
|
||||
return m, nil
|
||||
}
|
||||
return m, tea.Quit
|
||||
// Use configurable key bindings for quit
|
||||
if m.appConfig != nil && m.appConfig.KeyBindings.ShouldQuitOnKey(key) {
|
||||
return m, tea.Quit
|
||||
}
|
||||
case "q":
|
||||
if !m.searchMode && !m.deleteMode {
|
||||
return m, tea.Quit
|
||||
// Use configurable key bindings for quit
|
||||
if m.appConfig != nil && m.appConfig.KeyBindings.ShouldQuitOnKey(key) {
|
||||
return m, tea.Quit
|
||||
}
|
||||
}
|
||||
case "/", "ctrl+f":
|
||||
if !m.searchMode && !m.deleteMode {
|
||||
|
||||
Reference in New Issue
Block a user