From b0b8ef9cf6d3adbd39621803c8eb852c610e2dd7 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Wed, 2 Apr 2025 17:54:53 +0200 Subject: [PATCH] Fix display of renamed files This broke with #4346 (Add root node in file tree). --- pkg/gui/presentation/files.go | 2 +- pkg/integration/tests/file/renamed_files.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/gui/presentation/files.go b/pkg/gui/presentation/files.go index f4e232938..d1acd02da 100644 --- a/pkg/gui/presentation/files.go +++ b/pkg/gui/presentation/files.go @@ -308,7 +308,7 @@ func fileNameAtDepth(node *filetree.Node[models.File], depth int) string { name := join(splitName[depth:]) if node.File != nil && node.File.IsRename() { - splitPrevName := split(node.File.PreviousPath) + splitPrevName := split("./" + node.File.PreviousPath) prevName := node.File.PreviousPath // if the file has just been renamed inside the same directory, we can shave off diff --git a/pkg/integration/tests/file/renamed_files.go b/pkg/integration/tests/file/renamed_files.go index 98a7293c5..ec2ecc151 100644 --- a/pkg/integration/tests/file/renamed_files.go +++ b/pkg/integration/tests/file/renamed_files.go @@ -29,7 +29,7 @@ var RenamedFiles = NewIntegrationTest(NewIntegrationTestArgs{ Equals("▼ /"), Equals(" ▼ dir"), Equals(" R file1 → file1"), - Equals(" R dir/file2 → file2-renamed"), // don't want the 'dir/' prefix here + Equals(" R file2 → file2-renamed"), Equals(" R dir/nested/file3 → file3"), ) },