Skip to content

Commit

Permalink
Trigger update after copy/move (#1638)
Browse files Browse the repository at this point in the history
* trigger update after copy/move

* trigger refresh after returnign from shell

* add renew after returning from shell

* move file update
  • Loading branch information
valoq authored Mar 24, 2024
1 parent 951795c commit ddcd308
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,10 @@ func (app *app) runCmdSync(cmd *exec.Cmd, pause_after bool) {
}

app.ui.loadFile(app, true)

//mark the current directory as updated for refresh
app.nav.currDir().updated = true

app.nav.renew()
}

Expand Down Expand Up @@ -517,6 +521,7 @@ func (app *app) runShell(s string, args []string, prefix string) {
cmd.Stderr = os.Stderr

app.runCmdSync(cmd, prefix == "!")

return
}

Expand Down
7 changes: 6 additions & 1 deletion nav.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ type dir struct {
ignoredia bool // ignoredia value from last sort
noPerm bool // whether lf has no permission to open the directory
lines []string // lines of text to display if directory previews are enabled
updated bool // directory has been updated after last dirCheck
}

func newDir(path string) *dir {
Expand Down Expand Up @@ -521,7 +522,7 @@ func (nav *nav) checkDir(dir *dir) {
}

switch {
case s.ModTime().After(dir.loadTime):
case s.ModTime().After(dir.loadTime) || dir.updated:
now := time.Now()

// XXX: Linux builtin exFAT drivers are able to predict modifications in the future
Expand Down Expand Up @@ -1372,6 +1373,8 @@ loop:
if errCount == 0 {
app.ui.exprChan <- &callExpr{"echo", []string{"\033[0;32mCopied successfully\033[0m"}, 1}
}
//mark the current directory as updated for refresh
nav.currDir().updated = true
}

func (nav *nav) moveAsync(app *app, srcs []string, dstDir string) {
Expand Down Expand Up @@ -1484,6 +1487,8 @@ func (nav *nav) moveAsync(app *app, srcs []string, dstDir string) {
if errCount == 0 {
app.ui.exprChan <- &callExpr{"echo", []string{"\033[0;32mMoved successfully\033[0m"}, 1}
}
//mark the current directory as updated for refresh
nav.currDir().updated = true
}

func (nav *nav) paste(app *app) error {
Expand Down

0 comments on commit ddcd308

Please sign in to comment.