blacknon / hwatch

A modern alternative to the watch command, records the differences in execution results and can check this differences at after.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hwatch does not print tab characters

ilyagr opened this issue · comments

Executing printf "a\tb\n" prints out something that looks like

a       b

However, hwatch 'printf "a\tb\n"' just shows

ab

fdehau/tui-rs#98 seems very much related.

Thanks!

fdehau/tui-rs#98 seems very much related.

umm... It will take some time to fix this library. 🤔
For the time being, I will try to fork and modify tui-rs and move the hwatch side source there

I think the easiest thing to do would be to expand tabs to spaces manually.

The cheating way would be to replace tab characters with 4 spaces.

A better way would be to print enough spaces so that the horizontal cursor position is a multiple of 8. I think this is what watch does.

Terminals do something more complicated but I'm not sure how many people would notice the difference.

I don't know if there's an easy way to fix it in tui-rs.

In the case of the tabs command, etc., it seems that the tab size is specified using the terminfo function.
If you can get the tab size of the terminal, it seems that you can get the value to replace with spaces, but it is still at the stage of investigation.

Implemented in version 0.3.10. Close.

Works beautifully, thanks!