1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-04 16:14:44 +00:00

Merge pull request #326 from bikraj2/fix/unchecked_history_addition

fix(history): prevent adding multiple history entries with same path when scanning
This commit is contained in:
Tw93
2026-01-17 08:24:36 +08:00
committed by GitHub

View File

@@ -971,7 +971,9 @@ func (m model) enterSelectedDir() (tea.Model, tea.Cmd) {
}
selected := m.entries[m.selected]
if selected.IsDir {
m.history = append(m.history, snapshotFromModel(m))
if len(m.history) == 0 || m.history[len(m.history)-1].Path != m.path {
m.history = append(m.history, snapshotFromModel(m))
}
m.path = selected.Path
m.selected = 0
m.offset = 0