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

edit terminal.js to full height of view port #2556

Merged
merged 1 commit into from
Dec 7, 2021

Conversation

Yoda-Canada
Copy link
Contributor

@Yoda-Canada Yoda-Canada commented Dec 1, 2021

issue #2519:
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:
e01f38d53a69df584f6bb85c87a20d2
After:
6e3615f1006fa113d90c12ff899bea3

Issue This PR Addresses

Type of Change

  • Bugfix: Change which fixes an issue
  • New Feature: Change which adds functionality
  • Documentation Update: Change which improves documentation
  • UI: Change which improves UI

Description

Checklist

  • Quality: This PR builds and passes our npm test and works locally
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Screenshots: This PR includes screenshots or GIFs of the changes made or an explanation of why it does not (if applicable)
  • Documentation: This PR includes updated/added documentation to user exposed functionality or configuration variables are added/changed or an explanation of why it does not(if applicable)

@gitpod-io
Copy link

gitpod-io bot commented Dec 1, 2021

@@ -20,9 +20,12 @@ const theme = {
white: '#CCCCC6',
yellow: '#FD971F',
};

const width = window.innerWidth;
const height = window.innerHeight;
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@Yoda-Canada
Copy link
Contributor Author

@humphd I have edited the CSS ,and the terminal full height of view port. Please review it, thx.
image

@Andrewnt219 Andrewnt219 self-requested a review December 6, 2021 18:30
Copy link
Contributor

@Andrewnt219 Andrewnt219 left a 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?

@Yoda-Canada
Copy link
Contributor Author

@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;
Copy link
Contributor

@Andrewnt219 Andrewnt219 Dec 6, 2021

Choose a reason for hiding this comment

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

I think vh is the correct way, but seem like we need to apply it on a different class or in combination with other class/classes.

In the picture, the text should go all the way to the bottom, but it turns to scroll at half the height.

image

Copy link
Contributor Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah you're right.

Comment on lines 3 to 4
position: relative;
width: 100vh;
Copy link
Contributor

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.

@humphd humphd merged commit 5f0f8a4 into Seneca-CDOT:master Dec 7, 2021
@Andrewnt219 Andrewnt219 linked an issue Dec 10, 2021 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extend build terminal in dashboard to full height of viewport
3 participants