otakustay / react-diff-view

A git diff component
MIT License
841 stars 79 forks source link

Diff view loses the right hand side alignment done by using tab when tokenize method has options with markWord("\t", "tab", "") #223

Open sharadkalya opened 1 month ago

sharadkalya commented 1 month ago

When the library replaces the tab character to replace it with content, it loses the actual tab when rendering. And therfore the right hand side is not aligned correctly.

tokenize(hunks, {
    ....
    markWord("\t", "tab", ""),
});

Without tab options passed Screenshot from 2024-08-05 12-11-57

With tab options passed Screenshot from 2024-08-05 12-11-45

otakustay commented 1 month ago

By markWord("\t", "tab", "") you are replace \t into an empty string, try markWord("\t", "tab", "\t"), it may works, if not, any further discussion is welcome