fix: SFTP auto-refresh + filter mode + delete refresh
- Clear dirCache before refresh after transfer/delete/mkdir - Cache was stale: old entries returned instead of fresh data - Filter mode: allow commands (c,d,n,r) and nav (↑↓,Tab) to pass through - Filter mode no longer blocks transfer/delete/mkdir/pane-switch - Delete: clear cache + program.Send() for re-render - Mkdir: clear cache + program.Send() for re-render
This commit is contained in:
@@ -293,6 +293,10 @@ func (t *SFTPBrowserTab) Update(msg tea.Msg) (Tab, tea.Cmd) {
|
||||
p.filter = p.filter[:len(p.filter)-1]
|
||||
}
|
||||
return t, nil
|
||||
case "tab", "up", "k", "down", "j":
|
||||
// Allow navigation and pane switch in filter mode
|
||||
case "c", "d", "n", "r":
|
||||
// Allow commands in filter mode
|
||||
default:
|
||||
if len(msg.Runes) == 1 {
|
||||
p.filter += string(msg.Runes[0])
|
||||
@@ -496,7 +500,15 @@ func (t *SFTPBrowserTab) copyFile(srcType, dstType paneType, srcPath, dstPath, n
|
||||
t.transferring = false
|
||||
t.mu.Unlock()
|
||||
|
||||
// Auto-refresh destination pane
|
||||
// Auto-refresh destination pane (clear cache first)
|
||||
t.mu.Lock()
|
||||
if dstType == paneRemote {
|
||||
delete(t.right.dirCache, t.right.cwd)
|
||||
} else {
|
||||
delete(t.left.dirCache, t.left.cwd)
|
||||
}
|
||||
t.mu.Unlock()
|
||||
|
||||
if dstType == paneRemote {
|
||||
t.refreshRemote()
|
||||
} else {
|
||||
@@ -606,10 +618,24 @@ func (t *SFTPBrowserTab) deleteItem(fullPath string, isDir bool, isRemote bool)
|
||||
t.transferMsg = ""
|
||||
t.mu.Unlock()
|
||||
|
||||
// Clear cache and refresh
|
||||
t.mu.Lock()
|
||||
if isRemote {
|
||||
go t.refreshRemote()
|
||||
delete(t.right.dirCache, t.right.cwd)
|
||||
} else {
|
||||
go t.refreshLocal()
|
||||
delete(t.left.dirCache, t.left.cwd)
|
||||
}
|
||||
t.mu.Unlock()
|
||||
|
||||
if isRemote {
|
||||
t.refreshRemote()
|
||||
} else {
|
||||
t.refreshLocal()
|
||||
}
|
||||
|
||||
// Trigger re-render
|
||||
if t.program != nil {
|
||||
t.program.Send(sftpRefreshMsg{})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -630,7 +656,17 @@ func (t *SFTPBrowserTab) mkdirRemote() {
|
||||
t.mu.Unlock()
|
||||
return
|
||||
}
|
||||
|
||||
// Clear cache and refresh
|
||||
t.mu.Lock()
|
||||
delete(t.right.dirCache, cwd)
|
||||
t.mu.Unlock()
|
||||
t.refreshRemote()
|
||||
|
||||
// Trigger re-render
|
||||
if t.program != nil {
|
||||
t.program.Send(sftpRefreshMsg{})
|
||||
}
|
||||
}
|
||||
|
||||
func (t *SFTPBrowserTab) View() string {
|
||||
|
||||
Reference in New Issue
Block a user