Reload if any component in current path is renamed (#1982)
This commit is contained in:
1 parent
62cbe0b6b5
commit
12f235fac9
1 file changed
+10
-5
@@ -404,14 +404,19 @@ func (app *app) loop() {
|
|||||||
oldCurrPath = curr.path
|
oldCurrPath = curr.path
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := range app.nav.dirs {
|
if wd, err := os.Getwd(); err == nil && wd != app.nav.currDir().path {
|
||||||
if app.nav.dirs[i].path == d.path {
|
// if any path component in the current path is renamed, then
|
||||||
app.nav.dirs[i] = d
|
// the entire set of directories has to be reloaded
|
||||||
|
app.nav.cd(wd)
|
||||||
|
} else {
|
||||||
|
for i := range app.nav.dirs {
|
||||||
|
if app.nav.dirs[i].path == d.path {
|
||||||
|
app.nav.dirs[i] = d
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
app.nav.position()
|
||||||
}
|
}
|
||||||
|
|
||||||
app.nav.position()
|
|
||||||
|
|
||||||
curr, err := app.nav.currFile()
|
curr, err := app.nav.currFile()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
if curr.path != oldCurrPath {
|
if curr.path != oldCurrPath {
|
||||||
|
|||||||
Reference in new issue
Block a user