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

Support setting padding on the .xterm element #1208

Merged
merged 12 commits into from
Feb 6, 2018
Merged

Conversation

mofux
Copy link
Contributor

@mofux mofux commented Jan 15, 2018

Fixes #946

This PR adds the ability to add a custom css padding to the .xterm element while still having the scrollbar filling the whole space.

In action:

@blink1073
Copy link
Contributor

This is great, thanks @mofux!

@cancan101
Copy link

so what is left to get this merged?

@ficristo
Copy link
Contributor

Will this work if I set only padding-left ?

@mofux
Copy link
Contributor Author

mofux commented Jan 17, 2018

@ficristo Yes, it will work with individual paddings for every side.

@mofux
Copy link
Contributor Author

mofux commented Jan 19, 2018

@Tyriar All checks are green now, please review if you find a moment 🧐

@Tyriar Tyriar added this to the 3.1.0 milestone Jan 19, 2018
@Tyriar
Copy link
Member

Tyriar commented Jan 19, 2018

I resolved the conflicts introduced from #1222

@Tyriar
Copy link
Member

Tyriar commented Jan 19, 2018

Found a bug, having a non-zero padding breaks IMEs. This is happening because of the position of the xterm-helper and there was an assumption that there was no padding inside the terminal container.

screen shot 2018-01-19 at 12 55 58 pm

kapture 2018-01-19 at 12 54 53

The Clipboard.ts file also moves textarea under the cursor (moveTextAreaUnderMouseCursor) for middle click paste selection on Linux and the right click context menu. We'll want to make sure they still work with large padding values.

src/Viewport.ts Outdated
// Measure the width of the scrollbar. If it is 0 we can assume it's an OSX overlay scrollbar.
// Unfortunately the overlay scrollbar would be hidden underneath the screen element in that case,
// therefore we account 15px to make it visible
this.scrollBarWidth = (this.viewportElement.offsetWidth - this.scrollArea.offsetWidth) || 15;
Copy link
Member

Choose a reason for hiding this comment

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

Let's pull 15 up to the top to a named constant, maybe FALLBACK_SCROLL_BAR_WIDTH?

@cancan101
Copy link

any updates on this PR?

@mofux
Copy link
Contributor Author

mofux commented Jan 28, 2018

@cancan101 I'll try to resolve the remaining issues this week.

@Tyriar
Copy link
Member

Tyriar commented Feb 6, 2018

@mofux I synced with master and resolved conflicts then made the following changes:

  • Moved helperContainer inside screenElement, this fixes the issue above where the IME position is incorrect as the helperContainer will always be positioned with the screen elements.
  • Removed screenElement from the public API, since no one has really asked for it let's not put it in. Consumers also know their own padding so it's fairly easy for them to know the rendered box position.
  • Move 15 into named const FALLBACK_SCROLL_BAR_WIDTH

@KhizerRehan
Copy link

KhizerRehan commented May 16, 2022

@mofux @Tyriar
I am using this version how to set padding?
"xterm": "4.18.0"

//  overriding padding does work in chrome devtool but when applied in file it fails to apply on terminal screen
.xterm-screen {
  padding: 10px !important;
}

any help?

@Tyriar
Copy link
Member

Tyriar commented May 16, 2022

@KhizerRehan I think you set it on .xterm

@mofux mofux deleted the padding branch September 15, 2023 08:27
@ssh-randy
Copy link

ssh-randy commented Oct 4, 2023

love the change! unfortunately... one small snag.

image

the terminal now bleeds over. i tried setting padding-right, but no dice.

i used this:


.xterm-screen {
  padding-left: 20px;
  padding-right: 20px;
  padding-top: 20px;
}

any idea how to fix it?

edit: one more note, i'm using the fit AddOn

@ssh-randy
Copy link

ah nevermind. i should be adjusting the css on the container to address this 😄

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.

Add an option to set the terminal padding
7 participants