feat: change to parent directory if CWD is deleted (#2424)
* feat: change to parent directory if CWD is deleted * fix lint warning * Update `CHANGELOG.md`
This commit is contained in:
1 parent
ede1e7e7c3
commit
3ec5ee8616
2 files changed
+10
No files matched your search
@@ -22,6 +22,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||
- A new field `.All` is added to the `ruler` file to display the number of all files (i.e. visible + hidden) in the current working directory (#2376).
|
||||
- A new option `numbercursorfmt` is added to further customize the appearance of line numbers (#2395).
|
||||
- The `loading...` message delay of 100 milliseconds for file previews is now applied to directories as well (#2410).
|
||||
- `lf` will now automatically change to the parent directory if the current directory no longer exists and the `watch` option is enabled (#2424).
|
||||
|
||||
### Fixed
|
||||
|
||||
|
||||
@@ -473,6 +473,15 @@ func (app *app) loop() {
|
||||
|
||||
deletePathRecursive(app.nav.regCache, path)
|
||||
deletePathRecursive(app.nav.dirCache, path)
|
||||
|
||||
for _, dirPath := range app.nav.dirPaths {
|
||||
if dirPath == path {
|
||||
if err := app.nav.cd(filepath.Dir(path)); err != nil {
|
||||
log.Print(err)
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
case ev := <-app.ui.evChan:
|
||||
e := app.ui.readEvent(ev, app.nav)
|
||||
if e == nil {
|
||||
|
||||
Reference in new issue
Block a user