Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Truncate status when necessary #7

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

atalii
Copy link

@atalii atalii commented Nov 17, 2023

Would fix alire-project/alire#1329.

I tested only on Linux, and to be honest, I don't quite know what this patch does to platform support. I doubt there's any witchcraft capable of making this work on Windows; I've no idea what MacOS supports; and while I assume the ioctl's are the same on the various BSD's, I didn't check. @mosteo would you be able to clarify what platforms need to be tested?

When the TTY is too narrow to contain the output, the assumption
that a carriage return and whitespace while erase the line no
longer holds. Prior to printing, check the number of columns
available in the TTY.

See alire-project/alire#1329 for a demonstration of the issue.
@mosteo
Copy link
Member

mosteo commented Dec 11, 2023

Hi @atalii, we would need this to be working, or at least non-breaking, for the three main OSes Alire runs on.

I know that GNATCOLL has a GNATCOLL.Terminal that supposedly is able to get the terminal width in all those OSes, but I have never tested it. I wouldn't also want to bring in such a large dependency just for that, but it may server as inspiration.

This is to answer your questions, I haven't actually looked in detail at the changes. I hope to do so without too much delay.

@atalii
Copy link
Author

atalii commented Dec 11, 2023

Thanks! I briefly looked at GNATCOLL.Terminal. The implementation for Windows is just a few lines of #ifdef'd C, and they use the same code for all the other platforms. Technically, it doesn't seem that supporting each platform is difficult or lengthy, but I don't have a MacOS or Windows device to test/develop on. I can try to set up virtual environments for each, but that might take a while.

Thanks again!

@mosteo mosteo added the enhancement New feature or request label Dec 12, 2023
@atalii
Copy link
Author

atalii commented Jul 23, 2024

Sorry to get back to this so late! I just put everything under an #ifdef __linux__. I believe this code also works on MacOS, but I don't have the means to test it.

Re using Gnatcoll, I don't think it's preelaborate, so it can't be used here. Let me know if that's incorrect, though.

Hopefully this all looks good and works as I expect it to - thanks :)

@mosteo mosteo self-requested a review July 26, 2024 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Strangely formatted message in 80 columns: ◷ Searching... [...]
2 participants