Skip to content

fix(site): fix terminal size when displaying alerts #12444

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

Merged
merged 6 commits into from
Mar 8, 2024

Conversation

BrunoQuaresma
Copy link
Collaborator

Before - The terminal size does not fit the available space so the bottom is hidden.

Screen.Recording.2024-03-06.at.15.44.50.mov

After - The terminal adjusts when there are alert changes.

working.mov

Unfortunately, I don't think there is a sane way to automate tests for this but open to suggestions.

Close #7914

@BrunoQuaresma BrunoQuaresma self-assigned this Mar 6, 2024
@code-asher
Copy link
Member

A comment about testing, since we have the story now, maybe we can just output more than a screen's worth of text, since with the bug it would render differently than without it, so it should catch this issue.

@code-asher
Copy link
Member

code-asher commented Mar 6, 2024

Or we output some ANSI sequence that writes text to the bottom of the screen. If it displays, we know it is fixed, if not then there is a bug. Or output the terminal size or something.

@mafredri
Copy link
Member

mafredri commented Mar 7, 2024

@BrunoQuaresma for testing, maybe you can write an escape sequence to the terminal that will write something at the bottom? Edit: Actually, this is probably what Asher was suggesting 😄.

For example, the following escape sequence would write to the bottom left and right corners of the terminal: \33[1000BLEFT\33[1000C\33[4DRIGHT

image

Then you can test if the output is visible?

@BrunoQuaresma
Copy link
Collaborator Author

@mafredri @code-asher good suggestion, I didn't know there was a way to do that. I was just copying and pasting the websocket messages from the terminal.

@mafredri how do you know how to do that? I would add it to my LinkedIn like "Languages: English, ANSI"

@BrunoQuaresma
Copy link
Collaborator Author

@code-asher @mafredri just confirming your suggestion worked! 🙏

@mafredri
Copy link
Member

mafredri commented Mar 7, 2024

@mafredri how do you know how to do that? I would add it to my LinkedIn like "Languages: English, ANSI"

Haha, I will consider it 😉. TBH it was trial and error, I remembered that it was ~ ESC[#X, then I just tried the letters ABCD and saw what happened (I could've just looked it up lol.) Essentially we're moving 1000 blocks in each direction which means we'll hit a wall and stay at the edge, when we do the right one we also go 1000 blocks and then backtrack a few so we have space to output the text. 😄

This looks like a pretty solid intro if you're interested: https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797#cursor-controls

@BrunoQuaresma BrunoQuaresma requested a review from code-asher March 7, 2024 15:46
Copy link
Member

@code-asher code-asher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect!

@BrunoQuaresma BrunoQuaresma merged commit 060033e into main Mar 8, 2024
@BrunoQuaresma BrunoQuaresma deleted the bq/fix-terminal-alert-size branch March 8, 2024 10:38
Copy link
Collaborator Author

Merge activity

@github-actions github-actions bot locked and limited conversation to collaborators Mar 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Web terminal notification for "Startup script failed" does not account for terminal size
3 participants