What happens
In a repository that indents with tabs, every line in the diff pane is drawn
starting at column 0.
Might like below
test: function(taskState)
{
aaaaa
vvvv
bbbb
if ()
{
}
},
Why
ratatui draws into a cell grid and does not interpret \t; the terminal never
sees the character either, so nothing expands it. gitview does not expand it
first — the only \t handling in the tree is field splitting:
src/git.rs:801 field.split('\t') # git output columns
src/preview/session.rs:289 answer.split_once('\t') # pane picker reply
render::build hands old / new straight to Highlighter::highlight and
TextDiff::from_lines, so the raw tab survives into the Run text and is
dropped at draw time.
Reproduce
Just open any file with some indent with gitview.
Suggested fix
A width knob is worth having (tab_width, default 4 or 8) since it is per
project taste, and the expansion can be skipped entirely when neither side
contains a tab, so nothing is allocated for the common case.
I have a patch along these lines if it would be useful — it adds tab_width to
Config (clamped) and an expand_tabs helper applied at the top of build.
What happens
In a repository that indents with tabs, every line in the diff pane is drawn
starting at column 0.
Might like below
Why
ratatuidraws into a cell grid and does not interpret\t; the terminal neversees the character either, so nothing expands it. gitview does not expand it
first — the only
\thandling in the tree is field splitting:render::buildhandsold/newstraight toHighlighter::highlightandTextDiff::from_lines, so the raw tab survives into theRuntext and isdropped at draw time.
Reproduce
Just open any file with some indent with gitview.
Suggested fix
A width knob is worth having (
tab_width, default 4 or 8) since it is perproject taste, and the expansion can be skipped entirely when neither side
contains a tab, so nothing is allocated for the common case.
I have a patch along these lines if it would be useful — it adds
tab_widthtoConfig(clamped) and anexpand_tabshelper applied at the top ofbuild.