Skip to content

Commit

Permalink
[Rendering] Make sure flattened directories ask icons for the first dir.
Browse files Browse the repository at this point in the history
The icon for "/src/main/java" is based on "src", not "java".
  • Loading branch information
Alexander-Miller committed Feb 29, 2024
1 parent 7cfe40a commit 8c6df39
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/elisp/treemacs-rendering.el
Original file line number Diff line number Diff line change
Expand Up @@ -654,12 +654,12 @@ RECURSIVE: Bool"
(or git-future (treemacs--git-status-process path project))))
(collapse-future (treemacs--collapsed-dirs-process path project))
(recursive (treemacs--prefix-arg-to-recurse-depth recursive))
(dir-name (treemacs--filename path)))
(base-dir-name (treemacs--filename (treemacs-button-get btn :key))))
(treemacs--button-open
:immediate-insert nil
:button btn
:new-state 'dir-node-open
:new-icon (treemacs-icon-for-dir dir-name 'open)
:new-icon (treemacs-icon-for-dir base-dir-name 'open)
:open-action
(progn
;; do on-expand first so buttons that need collapsing can quickly find their parent
Expand All @@ -680,11 +680,12 @@ RECURSIVE: Bool"
(defun treemacs--collapse-dir-node (btn &optional recursive)
"Close node given by BTN.
Remove all open dir and tag entries under BTN when RECURSIVE."
(-let [path (treemacs-button-get btn :path)]
(let ((path (treemacs-button-get btn :path))
(base-dir-name (treemacs--filename (treemacs-button-get btn :key))))
(treemacs--button-close
:button btn
:new-state 'dir-node-closed
:new-icon (treemacs-icon-for-dir (treemacs--filename path) 'closed)
:new-icon (treemacs-icon-for-dir base-dir-name 'closed)
:post-close-action
(progn
(treemacs--stop-watching path)
Expand Down

0 comments on commit 8c6df39

Please sign in to comment.