xtermjs / xterm.js

A terminal for the web
https://xtermjs.org/
MIT License
16.99k stars 1.59k forks source link

It is not possible to move the cursor outside the active buffer using ANSI commands #5041

Closed DevTester425 closed 2 months ago

DevTester425 commented 2 months ago

Please describe the solution how to move the cursor to position 1;1 if term.buffer.active.baseY > 0. If this cannot be done by ANSI commands, describe any method.

Details

Steps to reproduce

run code

<!doctype html>
  <html>
    <head>
      <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/xterm@5.1.0/css/xterm.min.css" />
      <script src="https://cdn.jsdelivr.net/npm/xterm@5.1.0/lib/xterm.min.js"></script>
    </head>
    <body>
      <div id="terminal"></div>
      <script>
        (async () => {
            var term = new Terminal({
                rows: 10
            });
            term.open(document.getElementById('terminal'));
            await write(term, '\r\n1\r\n2\r\n3\r\n4\r\n5\r\n6\r\n7\r\n8\r\n9\r\n10\r\n11\r\n12\r\n13\r\n14\r\n15');
            term.scrollToTop();
            await write(term, '\u001b[1;1H');

            async function write(term, data) {
                return new Promise((resolve) => {
                    term.write(data, resolve)
                })
            }
        })()
      </script>
    </body>
  </html>

Result зображення