-
Notifications
You must be signed in to change notification settings - Fork 189
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
edit terminal.js to full height of view port #2556
Conversation
@@ -20,9 +20,12 @@ const theme = { | |||
white: '#CCCCC6', | |||
yellow: '#FD971F', | |||
}; | |||
|
|||
const width = window.innerWidth; | |||
const height = window.innerHeight; |
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.
This will work, but it duplicates what we already have with https://www.npmjs.com/package/xterm-addon-fit. The right way to do this is to have the parent element that holds the terminal fill the available width and height, and then it will automatically use that. Can you fix our CSS for the page so that it does this?
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.
Okay, I will try to fix CSS. Actually I have checked some information about why the xterm-addon-fit command invalid. One explanation is that the container does not open until the browser has checked the size, so the xterm-addon-fit command is invalid. That is why I check windows' size first.
f9b540b
to
c2ca3f0
Compare
c2ca3f0
to
f4ec57f
Compare
@humphd I have edited the CSS ,and the terminal full height of view port. Please review it, thx. |
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.
This is not working. Reproduce
// terminal.js
terminal.write(`
lorem
ipsum
`);
The terminal should display the text on two lines, but it has glitchy text instead.
Maybe we can use vh
instead of percentage?
f4ec57f
to
91e6c4c
Compare
@Andrewnt219 You are right. I have changed it and please review. |
@@ -1,3 +1,6 @@ | |||
.xterm { | |||
padding: 0.5rem; | |||
position: relative; | |||
width: 100vh; | |||
height: 89vh; |
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.
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.
I deleted the position and width properties. I know why the text turns to scroll at half the height. I think you have two screen and you changed the screen from one to another. When we change the screen, we need to refresh it.
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.
Yeah you're right.
position: relative; | ||
width: 100vh; |
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.
These two doesn't seem to be necessary. vh
should not be used for width as well.
91e6c4c
to
8a433db
Compare
issue #2519:
![e01f38d53a69df584f6bb85c87a20d2](https://user-images.githubusercontent.com/55161917/144275355-57bbe604-9e94-4122-9863-6ee287671952.png)
![6e3615f1006fa113d90c12ff899bea3](https://user-images.githubusercontent.com/55161917/144275418-81822c3b-74c0-46e5-9bcf-056ca9dec0f7.png)
The terminal port can't auto fit the height because the Browser can't get the size of the container. So I edit the terminal.js file and get the window's width and height, then calculate the row height and column width based on these data.
If the user has more than one screen, just refresh the screen, the terminal window will fit the new screen.
Before:
After:
Issue This PR Addresses
Type of Change
Description
Checklist