-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
demo: auto-resize and other tweaks #4695
Conversation
* id="grid" should be id="class" (since "grid" is not unique in the document). * Remove space after 'id=' (multiple places). * Group 3 texture-atlas elements in new <div class="texture-atlas-container">.
* Make terminal take 2/3 of the width, and the options etc get 1/3 * Remove options height limit, which could lead to annoying nested verical scroll regions. (An inner region for the options inside a scrollable viewport.)
This is optional (but the default): You can still explicitly set COLSxROWS, but "auto" uses a ResizeObserver sets the size based on window size.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this is much nicer in general and we can just flip the boolean in client.ts temporarily if we need it to be static.
@jerch could you take a look at this failing test:
It fails when run by GitHub, but it passes when I do |
@PerBothner Hmm thats strange- nope the API should not be sensitive to windows size, unless the window size is so small, that the image gets evicted right away. Then ofc the test fails at its preconditions. It almost looks like thats the case here 🤔 Edit: Where did you get that failure, seems I cant find it. |
@jerch: "Where did you get that failure, seems I cant find it." It was in the results reported by GitHub when it auto-runs tests something is checked in. Specifically https://github.com/xtermjs/xterm.js/actions/runs/5917974173/job/16046844283?pr=4695 . It might have fixed itself: https://github.com/xtermjs/xterm.js/actions/ |
It either was the data center's cat, or we have here evidence of computers' nondeterminism in big cluster setups. Ah well, prolly the cat 🤣 |
Eww this removes the col/row inputs from the options, which I use alot to test behavior. Its much more cumbersome to do the same through the console with |
@jerch you can explicitly set the size via a textbox now, so when we need a specific size we can either set it there after each reload or disable auto resize in client.ts |
Sorry for the rant - buts thats not better, for me it is actually worse. I have many tests, that rely on a certain terminal size, which I now have to fiddle out by resizing the browser window? Furthermore it hard-couples the fit addon, which should be tested separately. Imho the demo should behave like that:
Your change here treats the terminal more like from integrator side, where ppl most likely want the terminal to stay within a certain container dimension. Well that does not work for many of my tests. Edit:
Via a textbox? How that and where? |
Oh sorry, did not see this - yeah thats good enough for me. 👍 (Sorry for the rant above, it felt like introducing more issues at new ends, when seeing the new options list. Did not spot the new entry at the end though.) |
No worries, being passionate is a good thing 😉 |
It might be useful to have a way to initialize the size to a specific (initial) size. For example, in the URL:
Perhaps we could try for a bit with the way it currently works. I can always add this feature later. |
Something like that, I was always thinking a checkbox to remember all settings would be handy |
I had some annoyances with the demo. For example, switching to the dom renderer would make the terminal bigger - which would obscure part of the settings column, making it difficult to change things.
Having the terminal automatically resize itself to fit seemed a better approach for testing, as well as for demo purposes. It uses a
ResizeObserver
for this. Auto-resize is now the default, but you can still manually setCOLSxROWS
if you want to.I also fixed some warts in the
index.html
and tweaked some other styling issues: most noticably making the terminal take 2/3 of the width, rather than 1/2.