eza-community / eza-community/eza

feat: truncate lines to terminal width when using -l and -1 switches

Open
#372 0 comments 2 reactions 0 assignees View on GitHub
area: display type: feature
Dominant language
Rust
Stars
23.3k
Forks
523
PR merge metrics
No merged PRs in 30d

Description

Hello!

It would be nice to have (maybe as an option) the long lines truncated to the current terminal width, when using -l or -1 switches, so that any single line never overflows to the following.

![image](https://github.com/eza-community/eza/assets/12746830/f9da8948-36c3-41fb-a59a-8243de32a1b2)

Best of all, when the new hypotetical "--truncate" option is used, eza could manage the long paths in smart ways - example from my screenshot above:
the line
`Cookies -> C:\Users\raffaele.bianco\AppData\Local\Microsoft\Windows\INetCookies`
could be rendered as
`Cookies -> C:\Users\raffaele.bianco\AppData\Local\...\INetCookies`
or
`Cookies -> C:\Users\raffaele.bianco\...\INetCookies`
reducing a subset of the last path elements to a shorter "..." (accordingly to the current terminal width), but keeping the last folder for best readability.

Oh-my-posh can do something similar (if I remember correctly) - hoping that this is somewhat useful to know.

Contributor guide

Open the contributing guide

Research direction

No files, tests, or entry points are named. Begin by tracing the -l and -1 switches and how terminal width is handled, then clarify whether --truncate and smart path shortening are required; done should mean long lines no longer overflow the terminal and the expected shortening behavior is specified.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.