ddworken / hishtory

Your shell history: synced, queryable, and in context
https://hishtory.dev
MIT License
2.43k stars 41 forks source link

Rendering is wrong when tab `\t` is in the command #225

Open zhou13 opened 3 weeks ago

zhou13 commented 3 weeks ago

When tab \t is in the command, it seems that sometimes history does not compute the line width correctly, causing weird rendering issues (some lines occupy more than one line). Untitled

ddworken commented 3 weeks ago

Ah, thank you for this bug report!

You're exactly right that this is a bug and it explains something I've run into before but had never been able to track down. The root cause is that the runewidth library defines the width of a tab as 0. It looks like there are some clever ways of checking the width of a tab character that we could implement.

I'll have to experiment with this, but this will be the next thing on my todo list. So thank you!

zhou13 commented 2 weeks ago

How about just replacing tab with a single space when displaying?