1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-16 21:39:11 +00:00

bug-fix: mo analyze keybindings misalignment (#342)

* bug-fix: mo analyze keybindings misalignment

handle also uppercase R together with lowercase r

* bug-fix: mo analyze keybindings misalignment

Fix the logic also for:
- q with Q
- k with K
- j with J
- l with L
- b with B
- h with H
- o with O
This commit is contained in:
Andrei Murariu
2026-01-22 05:16:42 +02:00
committed by GitHub
parent d675529052
commit 192ea08f8d

View File

@@ -584,7 +584,7 @@ func (m model) updateKey(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
} }
switch msg.String() { switch msg.String() {
case "q", "ctrl+c": case "q", "ctrl+c", "Q":
return m, tea.Quit return m, tea.Quit
case "esc": case "esc":
if m.showLargeFiles { if m.showLargeFiles {
@@ -592,7 +592,7 @@ func (m model) updateKey(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
return m, nil return m, nil
} }
return m, tea.Quit return m, tea.Quit
case "up", "k": case "up", "k", "K":
if m.showLargeFiles { if m.showLargeFiles {
if m.largeSelected > 0 { if m.largeSelected > 0 {
m.largeSelected-- m.largeSelected--
@@ -606,7 +606,7 @@ func (m model) updateKey(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
m.offset = m.selected m.offset = m.selected
} }
} }
case "down", "j": case "down", "j", "J":
if m.showLargeFiles { if m.showLargeFiles {
if m.largeSelected < len(m.largeFiles)-1 { if m.largeSelected < len(m.largeFiles)-1 {
m.largeSelected++ m.largeSelected++
@@ -622,12 +622,12 @@ func (m model) updateKey(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
m.offset = m.selected - viewport + 1 m.offset = m.selected - viewport + 1
} }
} }
case "enter", "right", "l": case "enter", "right", "l", "L":
if m.showLargeFiles { if m.showLargeFiles {
return m, nil return m, nil
} }
return m.enterSelectedDir() return m.enterSelectedDir()
case "b", "left", "h": case "b", "left", "h", "B", "H":
if m.showLargeFiles { if m.showLargeFiles {
m.showLargeFiles = false m.showLargeFiles = false
return m, nil return m, nil
@@ -679,7 +679,7 @@ func (m model) updateKey(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
m.status = fmt.Sprintf("Scanned %s", humanizeBytes(m.totalSize)) m.status = fmt.Sprintf("Scanned %s", humanizeBytes(m.totalSize))
m.scanning = false m.scanning = false
return m, nil return m, nil
case "r": case "r", "R":
m.multiSelected = make(map[string]bool) m.multiSelected = make(map[string]bool)
m.largeMultiSelected = make(map[string]bool) m.largeMultiSelected = make(map[string]bool)
@@ -728,7 +728,7 @@ func (m model) updateKey(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
} }
m.status = fmt.Sprintf("Scanned %s", humanizeBytes(m.totalSize)) m.status = fmt.Sprintf("Scanned %s", humanizeBytes(m.totalSize))
} }
case "o": case "o", "O":
// Open selected entries (multi-select aware). // Open selected entries (multi-select aware).
const maxBatchOpen = 20 const maxBatchOpen = 20
if m.showLargeFiles { if m.showLargeFiles {