4 ms·
> garbled alignment when reading a diff of a file which used tabs to indent I have never experienced this. Tabs are of consistent length, so how can the indent
by FriedrichN 5y ago
> garbled alignment when reading a diff of a file which used tabs to indent
I have never experienced this. Tabs are of consistent length, so how can the indentation be garbled?
- Aaargh20318 5y agoTabs are not of consistent length. A tab does not insert X spaces worth of whitespace. A tab moves the cursor to the next tab-stop. There can still be alignment issues if different people choose different tab-stop intervals.
- FriedrichN 5y agoThat's why tabs are used for indentation and not alignment. From col 0 on tabs are consistent.
- CannisterFlux 5y agoThe only case I can think of is when the patch has lines above or below indented with spaces and a modified line with tabs. It looks OK in an editor, but the extra +/-/space from the diff doesn't move the tabbed code, which still is indented to the tab-stop boundary (the tab "absorbs" the diff marker). The space-indented lines are moved 1 to the right by the diff marker, but the code on the tab line now looks to be 1 character too far to the left in the diff. The problem is not the tabs, instead it stems from trying to mix lines indented with tabs and lines indented with spaces.