mirror of
https://github.com/tw93/Mole.git
synced 2026-02-15 13:25:04 +00:00
Repair the analysis navigation and the maximum list key
This commit is contained in:
BIN
bin/analyze-go
BIN
bin/analyze-go
Binary file not shown.
@@ -33,6 +33,7 @@ func snapshotFromModel(m model) historyEntry {
|
|||||||
EntryOffset: m.offset,
|
EntryOffset: m.offset,
|
||||||
LargeSelected: m.largeSelected,
|
LargeSelected: m.largeSelected,
|
||||||
LargeOffset: m.largeOffset,
|
LargeOffset: m.largeOffset,
|
||||||
|
IsOverview: m.isOverview,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ type historyEntry struct {
|
|||||||
LargeSelected int
|
LargeSelected int
|
||||||
LargeOffset int
|
LargeOffset int
|
||||||
Dirty bool
|
Dirty bool
|
||||||
|
IsOverview bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type scanResultMsg struct {
|
type scanResultMsg struct {
|
||||||
@@ -602,8 +603,20 @@ func (m model) updateKey(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
|
|||||||
m.offset = last.EntryOffset
|
m.offset = last.EntryOffset
|
||||||
m.largeSelected = last.LargeSelected
|
m.largeSelected = last.LargeSelected
|
||||||
m.largeOffset = last.LargeOffset
|
m.largeOffset = last.LargeOffset
|
||||||
m.isOverview = false
|
m.isOverview = last.IsOverview
|
||||||
if last.Dirty {
|
if last.Dirty {
|
||||||
|
// If returning to overview mode, refresh overview entries instead of scanning
|
||||||
|
if last.IsOverview {
|
||||||
|
m.hydrateOverviewEntries()
|
||||||
|
m.totalSize = sumKnownEntrySizes(m.entries)
|
||||||
|
m.status = "Ready"
|
||||||
|
m.scanning = false
|
||||||
|
if nextPendingOverviewIndex(m.entries) >= 0 {
|
||||||
|
m.overviewScanning = true
|
||||||
|
return m, m.scheduleOverviewScans()
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
m.status = "Scanning..."
|
m.status = "Scanning..."
|
||||||
m.scanning = true
|
m.scanning = true
|
||||||
return m, tea.Batch(m.scanCmd(m.path), tickCmd())
|
return m, tea.Batch(m.scanCmd(m.path), tickCmd())
|
||||||
@@ -637,11 +650,14 @@ func (m model) updateKey(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
|
|||||||
*m.currentPath = ""
|
*m.currentPath = ""
|
||||||
}
|
}
|
||||||
return m, tea.Batch(m.scanCmd(m.path), tickCmd())
|
return m, tea.Batch(m.scanCmd(m.path), tickCmd())
|
||||||
case "L":
|
case "t", "T":
|
||||||
m.showLargeFiles = !m.showLargeFiles
|
// Don't allow switching to large files view in overview mode
|
||||||
if m.showLargeFiles {
|
if !m.inOverviewMode() {
|
||||||
m.largeSelected = 0
|
m.showLargeFiles = !m.showLargeFiles
|
||||||
m.largeOffset = 0
|
if m.showLargeFiles {
|
||||||
|
m.largeSelected = 0
|
||||||
|
m.largeOffset = 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
case "o":
|
case "o":
|
||||||
// Open selected entry
|
// Open selected entry
|
||||||
@@ -735,9 +751,8 @@ func (m model) enterSelectedDir() (tea.Model, tea.Cmd) {
|
|||||||
}
|
}
|
||||||
selected := m.entries[m.selected]
|
selected := m.entries[m.selected]
|
||||||
if selected.IsDir {
|
if selected.IsDir {
|
||||||
if !m.inOverviewMode() {
|
// Always save current state to history (including overview mode)
|
||||||
m.history = append(m.history, snapshotFromModel(m))
|
m.history = append(m.history, snapshotFromModel(m))
|
||||||
}
|
|
||||||
m.path = selected.Path
|
m.path = selected.Path
|
||||||
m.selected = 0
|
m.selected = 0
|
||||||
m.offset = 0
|
m.offset = 0
|
||||||
@@ -1085,13 +1100,18 @@ func (m model) View() string {
|
|||||||
|
|
||||||
fmt.Fprintln(&b)
|
fmt.Fprintln(&b)
|
||||||
if m.inOverviewMode() {
|
if m.inOverviewMode() {
|
||||||
fmt.Fprintf(&b, "%s↑↓→ | Enter | R Refresh | O Open | F Show | Q Quit%s\n", colorGray, colorReset)
|
// Show ← Back if there's history (entered from a parent directory)
|
||||||
|
if len(m.history) > 0 {
|
||||||
|
fmt.Fprintf(&b, "%s↑↓←→ | Enter | R Refresh | O Open | F Show | ← Back | Q Quit%s\n", colorGray, colorReset)
|
||||||
|
} else {
|
||||||
|
fmt.Fprintf(&b, "%s↑↓→ | Enter | R Refresh | O Open | F Show | Q Quit%s\n", colorGray, colorReset)
|
||||||
|
}
|
||||||
} else if m.showLargeFiles {
|
} else if m.showLargeFiles {
|
||||||
fmt.Fprintf(&b, "%s↑↓ | R Refresh | O Open | F Show | ⌫ Delete | L Back | Q Quit%s\n", colorGray, colorReset)
|
fmt.Fprintf(&b, "%s↑↓← | R Refresh | O Open | F Show | ⌫ Delete | ← Back | Q Quit%s\n", colorGray, colorReset)
|
||||||
} else {
|
} else {
|
||||||
largeFileCount := len(m.largeFiles)
|
largeFileCount := len(m.largeFiles)
|
||||||
if largeFileCount > 0 {
|
if largeFileCount > 0 {
|
||||||
fmt.Fprintf(&b, "%s↑↓←→ | Enter | R Refresh | O Open | F Show | ⌫ Delete | L Large(%d) | Q Quit%s\n", colorGray, largeFileCount, colorReset)
|
fmt.Fprintf(&b, "%s↑↓←→ | Enter | R Refresh | O Open | F Show | ⌫ Delete | T Top(%d) | Q Quit%s\n", colorGray, largeFileCount, colorReset)
|
||||||
} else {
|
} else {
|
||||||
fmt.Fprintf(&b, "%s↑↓←→ | Enter | R Refresh | O Open | F Show | ⌫ Delete | Q Quit%s\n", colorGray, colorReset)
|
fmt.Fprintf(&b, "%s↑↓←→ | Enter | R Refresh | O Open | F Show | ⌫ Delete | Q Quit%s\n", colorGray, colorReset)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user