Repository: Canop/broot (language: rust)

Issue:
For a symlink to another partition, opening it in a new panel shows a wrong fs size
STEPS TO REPRODUCE:
1. Create a symlink to a dir in another partition.
2. `broot --show-root-fs`
3. Press `right` on that link.
4. The fs size on the header bar updates correctly.
5. Press `left` to go back.
6. Press `Ctrl+right` to open the symlink in a new panel.
7. The fs size in the new panel is still that of the left panel.


Discussion / hints:
Perhaps one solution is to make `ctrl-right` behave like `right`: the current directory is set to the target of the symlink, not the symlink itself. More consistency.
I reproduce the problem. I'll have a look.

Fix patch:
diff --git a/src/verb/internal_focus.rs b/src/verb/internal_focus.rs
index 50e9565f..1739a965 100644
--- a/src/verb/internal_focus.rs
+++ b/src/verb/internal_focus.rs
@@ -11,7 +11,10 @@ use {
         task_sync::Dam,
         tree::TreeOptions,
     },
-    std::path::{Path, PathBuf},
+    std::{
+        fs,
+        path::{Path, PathBuf},
+    },
 };
 
 pub fn on_path(
@@ -50,13 +53,19 @@ pub fn new_state_on_path(
 }
 
 pub fn new_panel_on_path(
-    path: PathBuf,
+    mut path: PathBuf,
     screen: Screen,
     tree_options: TreeOptions,
     purpose: PanelPurpose,
     con: &AppContext,
     direction: HDir,
 ) -> CmdResult {
+    // We try to canonicalize the path, mostly to resolve links
+    if let Ok(canonic) = fs::canonicalize(&path) {
+        path = canonic;
+        // If it can't be canonicalized, we'll let the panel state
+        // deal with the original path
+    }
     if purpose.is_preview() {
         let pattern = tree_options.pattern.tree_to_preview();
         CmdResult::NewPanel {
@@ -135,7 +144,6 @@ fn path_from_input(
             base_path.to_path_buf()
         }
     }
-
 }
 
 pub fn get_status_markdown(


Test patch: