question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add an option to set the terminal padding

See original GitHub issue

I would like to come up with a solution for the following issue:

Say you have a tab that renders the terminal, say it’s 300x200. Now if we put the terminal into that tab, we can either make the terminal container to fill it 100%, but in that case the terminal text will touch the edges of the tab at the left, right, top and bottom, which might look weird in some situations. So an easy solution would be to add a 5px margin to the tab container, which does the job, but now you have the viewport scrollbar drawn at a weird position. I think this problem cannot be solved through css (correct me if I’m wrong) because the viewport has to be made aware of the margin to still work in sync. I would therefore propose to make the margin (or better call it padding) configurable through a config option, and then make xterm aware of it:

// 5px padding to all sides
term.setOption('padding', 5);

// individual paddings
term.setOption('padding', {
  top: 5, 
  left: 0,
  right: 10,
  bottom: 5
});

The problem in pictures

Fit the tab clash 5px margin to the tab, weird looking scrollbar margin bad 5px margin, but scrollbar matching the tab container margin right

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:7
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
Tyriarcommented, Sep 6, 2017

Also, it looks like scroll bar width is:

var vp = document.querySelector('.xterm-viewport');
var sbWidth = vp.offsetWidth - vp.clientWidth;

Would be good to be exact here. We should only need to call it once (calling it may force a layout).

0reactions
mofuxcommented, Jan 15, 2018

I’ve created PR #1208 that implements this feature.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Increase padding in gnome terminal - Ask Ubuntu
In the file ~/.config/gtk-3.0/gtk.css (which you may need to create), add this: vte-terminal { padding: 10px; }.
Read more >
How to Increase Padding in GNOME Terminal
Increase Terminal Padding. Step 01: Create a gtk.css file in /.config; Step 02: Add the following line to increase padding; Step 03: Kill...
Read more >
Padding in gnome-terminal - Super User
I was using the above code before to enable padding in my gnome-terminal. This doesn't seem to work anymore after a recent gtk...
Read more >
Padding on Terminal apps - Solus Forum
Hello Everyone Hello Core Team. I've noticed something strange and un-aesthetic (to me) on terminal under Solus OS.
Read more >
How to Increase Padding in GNOME Terminal - Linux Today
Don't you feel you should give some extra space around the terminal border? If yes, check how it looks after adding padding to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found