summaryrefslogtreecommitdiffstats
path: root/pkg/gui
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2022-04-15 10:56:49 +1000
committerJesse Duffield <jessedduffield@gmail.com>2022-04-16 15:19:32 +1000
commit00afa30ebff2978e88cdab460b0f8ad818e1b502 (patch)
tree73dc5c7b537d1eab4702c78a7e14cdb55c6ab158 /pkg/gui
parent6a153acc8f5695b9176a8d1b196dfd9eeb5ee34e (diff)
better appearance for reverse attribute
Diffstat (limited to 'pkg/gui')
-rw-r--r--pkg/gui/presentation/files.go20
-rw-r--r--pkg/gui/presentation/files_test.go24
2 files changed, 20 insertions, 24 deletions
diff --git a/pkg/gui/presentation/files.go b/pkg/gui/presentation/files.go
index 3f4e34f14..b095975ad 100644
--- a/pkg/gui/presentation/files.go
+++ b/pkg/gui/presentation/files.go
@@ -1,7 +1,6 @@
package presentation
import (
- "fmt"
"strings"
"github.com/jesseduffield/lazygit/pkg/commands/models"
@@ -17,11 +16,12 @@ const (
COLLAPSED_ARROW = "►"
)
+// keeping these here as individual constants in case later on people want the old tree shape
const (
- INNER_ITEM = "├─ "
- LAST_ITEM = "└─ "
- NESTED = "│ "
- NOTHING = " "
+ INNER_ITEM = " "
+ LAST_ITEM = " "
+ NESTED = " "
+ NOTHING = " "
)
func RenderFileTree(
@@ -77,24 +77,20 @@ func renderAux(
isRoot := depth == -1
- renderLineWithPrefix := func() string {
- return prefix + renderLine(s, depth)
- }
-
if s.IsLeaf() {
if isRoot {
return []string{}
}
- return []string{renderLineWithPrefix()}
+ return []string{prefix + renderLine(s, depth)}
}
if collapsedPaths.IsCollapsed(s.GetPath()) {
- return []string{fmt.Sprintf("%s %s", renderLineWithPrefix(), COLLAPSED_ARROW)}
+ return []string{prefix + COLLAPSED_ARROW + " " + renderLine(s, depth)}
}
arr := []string{}
if !isRoot {
- arr = append(arr, fmt.Sprintf("%s %s", renderLineWithPrefix(), EXPANDED_ARROW))
+ arr = append(arr, prefix+EXPANDED_ARROW+" "+renderLine(s, depth))
}
newPrefix := prefix
diff --git a/pkg/gui/presentation/files_test.go b/pkg/gui/presentation/files_test.go
index 5f475b3fe..17e061012 100644
--- a/pkg/gui/presentation/files_test.go
+++ b/pkg/gui/presentation/files_test.go
@@ -53,12 +53,12 @@ func TestRenderFileTree(t *testing.T) {
},
expected: toStringSlice(
`
-dir1 ►
-dir2 ▼
-├─ dir2 ▼
-│ ├─ M file3
-│ └─ M file4
-└─ M file5
+► dir1
+▼ dir2
+ ▼ dir2
+ M file3
+ M file4
+ M file5
M file1
`,
),
@@ -112,12 +112,12 @@ func TestRenderCommitFileTree(t *testing.T) {
},
expected: toStringSlice(
`
-dir1 ►
-dir2 ▼
-├─ dir2 ▼
-│ ├─ D file3
-│ └─ M file4
-└─ M file5
+► dir1
+▼ dir2
+ ▼ dir2
+ D file3
+ M file4
+ M file5
M file1
`,
),