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.

Feature to support auto-growing the viewport

See original GitHub issue

Ultimately I’d like to be able to have the viewport start off with 1 row, even though the underlying PTY thinks it has 24 rows, and reports this to programs. And when I pass data to xterm.js that tries moving within the 80x24 viewport that’s valid, the actual viewport grows to include enough rows for the operation to happen.

What I do right now is run the following code every time I call term.write(data) (within a setTimeout of 0 seconds needed for some reason):

if (term.buffer.length > term.rows && term.buffer.length < 20) {
  term.resize(term.cols, term.buffer.length);
}

This does work when \n is encountered, but not ESC [ 4 ; 4 H for example. It will move to 4x1 on the current 80x1 viewport.

I could just parse the escape codes myself, but xterm.js already does this. There is a callback for this event, term.onCursorMove, but it doesn’t provide enough information for me to know how many more rows need to be added:

term.onCursorMove(() => {
  // term.buffer.baseY      = 0
  // term.buffer.cursorX    = 3
  // term.buffer.cursorY    = 0
  // term.buffer.length     = 1
  // term.buffer.viewportY  = 0
});
term.write('\x1b[4;4H');

Maybe this callback could be given the specific movement information? That might be enough to help me implement the rest of this feature externally.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
Tyriarcommented, Dec 30, 2019

We wouldn’t want to bring this sort of thing into core, fixing the event is good though. Should we close this in favor of https://github.com/xtermjs/xterm.js/issues/2290?

0reactions
sdegutiscommented, Dec 30, 2019

Sure I think that’s reasonable.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Viewport concepts - CSS: Cascading Style Sheets | MDN
The visual viewport is the visual portion of a screen not including on-screen keyboards, areas outside of a pinch-zoom area, or other feature...
Read more >
Optimizing viewport width - HTML5 Mobile Development Cookbook
Different mobile devices have different default mobile viewport widths. ... Here is what we can do to optimize the viewport width:.
Read more >
Auto Growing Inputs
Auto-Growing Inputs. Inputs. Problem (doesn't resize horizontally): I would like hugs. Solution with span: I would like 99 hugs.
Read more >
Form autofilling, fast overview screenshot and outline ...
Polypane 9.1 comes with new features to quickly test forms, a much faster and robust overview screenshot feature, support for the INP web ......
Read more >
Include CKEditor's AutoGrow plug-in [#2239419]
Wait for CKEditor to add support for "smart" autogrowing: https://dev.ckeditor.com/ticket/12120; Create a new build that includes it.
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