altsem / gitu

A TUI Git client inspired by Magit
MIT License
1.78k stars 92 forks source link

Leading tabs not displayed in diffs #201

Closed matta closed 3 months ago

matta commented 3 months ago

Using gitu 0.21.0, the diff display seems to collapse tabs to zero width characters. This makes gitu annoying to use with go code, which uses leading tabs for indentation. The screenshots are taken from Alacritty on Debian stable.

(gitu is awesome by the way! A great alternative to firing up Emacs just to get to magit)

Example:

image

Same repository state using git diff in the terminal:

image

altsem commented 3 months ago

This seems to be an effect of the TUI lib Ratatui we're using. The fix is easy I suppose, replace tabs with spaces before rendering.

Question just remains: How many spaces? Might be good enough to hard-code it to 4 for now. :thinking:

matta commented 3 months ago

4 spaces works for me. It is what lazygit does by default, too. Thanks!

As far as feature work, making it configurable might be worth it at some point, maybe even through editorconfig by way of the ec4s crate. That'd be pretty fancy, though.