broot icon indicating copy to clipboard operation
broot copied to clipboard

--height is off by one, --height 1 behaves unexpected, scans the entire tree structure

Open knirch opened this issue 6 months ago • 3 comments

Noticed that --height was not giving me the correct number of lines.

(knirch) @falschgeld| ~ $ br --height 10 -c:pt | wc -l
9
(knirch) @falschgeld| ~ $ br --height 2 -c:pt
/home/knirch

(I know it's a sin, but;) also, when given --height 1 it scans the entire structure (time is low now due to fs caching)

(knirch) @falschgeld| ~ $ time br --height 2 -c:pt
/home/knirch

real	0m0.044s
user	0m0.017s
sys	0m0.015s
(knirch) @falschgeld| ~ $ time br --height 1 -c:pt
/home/knirch

real	0m5.135s
user	0m3.706s
sys	0m1.418s
(knirch) @falschgeld| ~ $ time br --height 2 -c:pt
/home/knirch

real	0m0.032s
user	0m0.013s
sys	0m0.019s

knirch avatar Jun 13 '25 13:06 knirch

There's obvioulsy a problem but just to be clear, the value given to --height was the available height for the broot application, not just for the tree.

Canop avatar Jun 13 '25 13:06 Canop

Fair enough, although the wording in --help did seem to imply it was to control the height of the output: Height (if you don't want to fill the screen or for file export). But I'm making an uninformed assumption, as I'm still finding my way through broot. As in, I do not know if -c:pt is synonymous with file export. It's unique circumstances, as I doubt I would ever use --height, and definitely not 1 or 2. (from miaou discussion; I used --height 2 when attempting to collect information for a separate issue)

knirch avatar Jun 13 '25 13:06 knirch

aha. File export is something that has been removed.

CHANGELOG.md
405:- the --file-export-path launch argument which was deprecated since broot 1.6 has been removed (redirect the output of broot instead)

knirch avatar Jun 13 '25 13:06 knirch