lazygit/pkg/gui/filetree
Eng Zer Jun f933a2f7ec
Replace min/max helpers with built-in min/max
We upgraded our minimum Go version to 1.21 in commit
57ac9c2189. We can now replace our
`utils.Min` and `utils.Max` functions with the built-in `min` and `max`.

Reference: https://go.dev/ref/spec#Min_and_max
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2024-04-07 23:24:10 +08:00
..
build_tree.go refactor to use generics for file nodes 2022-07-31 19:43:14 +10:00
build_tree_test.go refactor to use generics for file nodes 2022-07-31 19:43:14 +10:00
collapsed_paths.go make more use of generics 2022-03-24 20:14:41 +11:00
commit_file_node.go handle nil properly with file nodes 2022-08-01 20:32:01 +10:00
commit_file_tree.go Fall back to WithWaitingStatus if item is scrolled out of view 2023-12-10 16:03:25 +01:00
commit_file_tree_view_model.go Support selecting file range in patch builder 2024-01-28 12:00:47 +11:00
file_node.go feat: introduce a copy menu into the file view 2023-12-07 08:30:03 +01:00
file_node_test.go refactor to use generics for file nodes 2022-07-31 19:43:14 +10:00
file_tree.go Replace min/max helpers with built-in min/max 2024-04-07 23:24:10 +08:00
file_tree_test.go move more view model logic into the files view model 2022-03-17 19:13:40 +11:00
file_tree_view_model.go Reduce the chance of race condition with list cursor 2024-01-28 09:20:52 +11:00
node.go Support range select for staging/discarding files 2024-01-25 11:34:59 +11:00
README.md properly resolve cyclic dependency 2022-01-22 10:48:51 +11:00

FileTree Package

This package handles the representation of file trees. There are two ways to render files: one is to render them flat, so something like this:

dir1/file1
dir1/file2
file3

And the other is to render them as a tree

dir1/
  file1
  file2
file3

Internally we represent each of the above as a tree, but with the flat approach there's just a single root node and every path is a direct child of that root. Viewing in 'tree' mode (as opposed to 'flat' mode) allows for collapsing and expanding directories, and lets you perform actions on directories e.g. staging a whole directory. But it takes up more vertical space and sometimes you just want to have a flat view where you can go flick through your files one by one to see the diff.

This package is not concerned about rendering the tree: only representing its internal state.