1 parent
249264b4cd
commit
b76d2546e1
4 files changed
+7
-7
No files matched your search
@@ -466,14 +466,14 @@ func (app *app) loop() {
|
|||||||
}
|
}
|
||||||
app.ui.draw(app.nav)
|
app.ui.draw(app.nav)
|
||||||
case path := <-app.nav.delChan:
|
case path := <-app.nav.delChan:
|
||||||
deletePathRecusrive(app.nav.selections, path)
|
deletePathRecursive(app.nav.selections, path)
|
||||||
if len(app.nav.selections) == 0 {
|
if len(app.nav.selections) == 0 {
|
||||||
app.nav.selectionInd = 0
|
app.nav.selectionInd = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
deletePathRecusrive(app.nav.regCache, path)
|
deletePathRecursive(app.nav.regCache, path)
|
||||||
|
|
||||||
deletePathRecusrive(app.nav.dirCache, path)
|
deletePathRecursive(app.nav.dirCache, path)
|
||||||
currPath := app.nav.currDir().path
|
currPath := app.nav.currDir().path
|
||||||
if currPath == path || strings.HasPrefix(currPath, path+string(filepath.Separator)) {
|
if currPath == path || strings.HasPrefix(currPath, path+string(filepath.Separator)) {
|
||||||
if wd, err := os.Getwd(); err == nil {
|
if wd, err := os.Getwd(); err == nil {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
# Change working dir in shell to last dir in lf on exit (adapted from ranger).
|
# Change working dir in shell to last dir in lf on exit (adapted from ranger).
|
||||||
#
|
#
|
||||||
# You need to add this to your Nushell Enviroment Config File
|
# You need to add this to your Nushell Environment Config File
|
||||||
# (Execute 'config env' in the nushell to open it).
|
# (Execute 'config env' in the nushell to open it).
|
||||||
|
|
||||||
# You may also like to assign a key (Ctrl-O) to this command:
|
# You may also like to assign a key (Ctrl-O) to this command:
|
||||||
|
|||||||
@@ -381,7 +381,7 @@ func makeCollator(localeStr string, opts ...collate.Option) (*collate.Collator,
|
|||||||
// This function deletes entries from a map if the key is either the given path
|
// This function deletes entries from a map if the key is either the given path
|
||||||
// or a subpath of it.
|
// or a subpath of it.
|
||||||
// This is useful for clearing cached data when a directory is moved or deleted.
|
// This is useful for clearing cached data when a directory is moved or deleted.
|
||||||
func deletePathRecusrive[T any](m map[string]T, path string) {
|
func deletePathRecursive[T any](m map[string]T, path string) {
|
||||||
delete(m, path)
|
delete(m, path)
|
||||||
prefix := path + string(filepath.Separator)
|
prefix := path + string(filepath.Separator)
|
||||||
for k := range m {
|
for k := range m {
|
||||||
|
|||||||
@@ -1488,8 +1488,8 @@ func (nav *nav) rename() error {
|
|||||||
// existed and was deleted. In this case the cache entries should be deleted
|
// existed and was deleted. In this case the cache entries should be deleted
|
||||||
// before loading newPath to prevent displaying a stale preview. However,
|
// before loading newPath to prevent displaying a stale preview. However,
|
||||||
// this clears only the current instance of lf, and not any other instances.
|
// this clears only the current instance of lf, and not any other instances.
|
||||||
deletePathRecusrive(nav.regCache, newPath)
|
deletePathRecursive(nav.regCache, newPath)
|
||||||
deletePathRecusrive(nav.dirCache, newPath)
|
deletePathRecursive(nav.dirCache, newPath)
|
||||||
dir := nav.loadDir(filepath.Dir(newPath))
|
dir := nav.loadDir(filepath.Dir(newPath))
|
||||||
|
|
||||||
if dir.loading {
|
if dir.loading {
|
||||||
|
|||||||
Reference in new issue
Block a user