Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Hwatch does not print tab characters #86

Closed
ilyagr opened this issue Jan 8, 2023 · 6 comments
Closed

Hwatch does not print tab characters #86

ilyagr opened this issue Jan 8, 2023 · 6 comments
Milestone

Comments

@ilyagr
Copy link
Contributor

ilyagr commented Jan 8, 2023

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

a       b

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

ab
@ilyagr
Copy link
Contributor Author

ilyagr commented Jan 8, 2023

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

@blacknon
Copy link
Owner

blacknon commented Jan 8, 2023

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

@ilyagr
Copy link
Contributor Author

ilyagr commented Jan 8, 2023

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.

@blacknon blacknon added this to the 0.3.10 milestone Apr 14, 2023
@blacknon
Copy link
Owner

blacknon commented Apr 15, 2023

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.

blacknon added a commit that referenced this issue Apr 15, 2023
@blacknon
Copy link
Owner

Implemented in version 0.3.10. Close.

@ilyagr
Copy link
Contributor Author

ilyagr commented Apr 17, 2023

Works beautifully, thanks!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants