lsd-rs / lsd-rs/lsd

[Suggestion] Use icons/offset instead of icons/separator to manage icons of different width

Open
#1,152 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
16.2k
Forks
510
PR merge metrics
No merged PRs in 30d

Description

Hi,

When using unicode, icons might be of different width, making the filenames unaligned :
```
X foo
X faa
```

We can solve this issue by patching the fonts. However, when using lsd through ssh, we might not have full control over the fonts installed on the client.

Seeing that lsd correctly align the output columns, even if there is icons of different width :
```
X foo X fee
X faa X fuu
```

I suggest doing the following to print an entry :
1. store the cursor's current position.
2. print the icon.
3. go back to the previous position.
4. go forth by icons/offset characters.
5. print the filename.

This should solve this issue even if the icons differs by width.

Cordially,

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the lsd code that prints icons using icons/separator and compare it with the existing column-alignment behavior. Evaluate the proposed cursor-position and icons/offset approach, then verify that filenames remain aligned for icons with different Unicode widths, including the examples in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.