Fix recursion output indentation and spacing#1202
Open
Shonas301 wants to merge 1 commit intolsd-rs:mainfrom
Open
Fix recursion output indentation and spacing#1202Shonas301 wants to merge 1 commit intolsd-rs:mainfrom
Shonas301 wants to merge 1 commit intolsd-rs:mainfrom
Conversation
* Add depth indentation to lsd -R output Changes made: - add depth param to display_folder_path, indent header by (depth+1)*2 spaces - indent content lines by (depth+1)*2 spaces at depth > 0 - reduce available grid width by content indent to prevent overflow - trim trailing newlines before section headers to remove double blank lines - add tests: depth1 indent, depth2 indent, no double blank lines * Fix grid width reduction to only apply at depth > 0 Changes made: - only subtract content_indent from term_width when depth > 0 (content is actually indented) - depth 0 content uses full terminal width as before * Simplify indent logic and reduce allocations Changes made: - add INDENT_STEP constant to replace magic number 2 - move content_prefix allocation behind depth > 0 guard - single-pass fold replaces Vec + join for line indentation - move +1 offset into display_folder_path for consistent API - collapse trimmed_len intermediate variable - remove redundant arithmetic comments from tests
7 tasks
Author
Sorry about the cold open of this and #1203 ! screen shot is attached for what it looks like! If there are changes requested just lmk, nbd, if you don't think it belongs in the upstream just lmk. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

I've been using
lsd -Rfor deep walks and it's hard to follow — entries sitflush-left regardless of depth, and there are multiple blank lines between
subdirectory blocks. No visual nesting at all.
Changes:
2 * depthspaces (both headers and content)so the nesting reads visually
Before:
After:
Display-layer only — nothing in traversal or meta collection changed.
TODO
cargo fmtdoc/samples(if applicable)doc/samples(if applicable)doc/samples(if applicable)