mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-20 09:09:35 +02:00
test(#654): pin the wrap walk for a soft-wrapped composer on a parked viewport
The parked-viewport test had no wrapped rows and the termination test runs at
baseY 0, so nothing pinned the walk of a multi-row composer through absolute
lines off the bottom. The new case fails on the pre-fix terminal-ui.js
('link' instead of 'history') and passes with the fix.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
d6d9315fb6
commit
52557ec558
1 file changed
+24
@@ -1116,6 +1116,30 @@ describe('terminal link tap', () => {
|
|||||||
expect(windowRef.open).toHaveBeenCalledWith('https://example.com/guide', '_blank', 'noopener,noreferrer');
|
expect(windowRef.open).toHaveBeenCalledWith('https://example.com/guide', '_blank', 'noopener,noreferrer');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('walks a soft-wrapped composer through absolute lines while the viewport is parked', () => {
|
||||||
|
// The composer spans absolute lines 2-3 (3 is its soft-wrapped tail, where the caret
|
||||||
|
// sits); the viewport is parked one row above the bottom, so screen row 1 is the
|
||||||
|
// composer's FIRST row and screen row 0 is scrollback.
|
||||||
|
const history = 'docs at https://example.com/guide';
|
||||||
|
const composer = '❯ summarize https://example.com/typed';
|
||||||
|
const lines = ['older', history, composer, ' for me', '', ''];
|
||||||
|
const { app, windowRef } = linkHarness(lines);
|
||||||
|
Object.assign(app.terminal, { rows: 3 });
|
||||||
|
Object.assign(app.terminal.buffer.active, { baseY: 3, viewportY: 1, cursorY: 0 });
|
||||||
|
const getLine = app.terminal.buffer.active.getLine;
|
||||||
|
app.terminal.buffer.active.getLine = (row: number) => {
|
||||||
|
const line = getLine(row);
|
||||||
|
return line && row === 3 ? { ...line, isWrapped: true } : line;
|
||||||
|
};
|
||||||
|
|
||||||
|
// The composer's first row is on the caret's logical line: its typed URL stays editable.
|
||||||
|
expect(app._handleMobileTerminalTap(at(composer.indexOf('https'), 1), true, 'history')).toBe('history');
|
||||||
|
expect(windowRef.open).not.toHaveBeenCalled();
|
||||||
|
// Screen row 0 is absolute line 1, scrollback: its URL opens.
|
||||||
|
expect(app._handleMobileTerminalTap(at(history.indexOf('https'), 0), true, 'history')).toBe('link');
|
||||||
|
expect(windowRef.open).toHaveBeenCalledWith('https://example.com/guide', '_blank', 'noopener,noreferrer');
|
||||||
|
});
|
||||||
|
|
||||||
it('stops the caret-line wrap walk at the buffer end even when every row is wrapped', () => {
|
it('stops the caret-line wrap walk at the buffer end even when every row is wrapped', () => {
|
||||||
// xterm's getLine indexes its circular list modulo capacity, so past the last row it
|
// xterm's getLine indexes its circular list modulo capacity, so past the last row it
|
||||||
// returns earlier rows again; with all of them soft-wrapped an unbounded walk never ends.
|
// returns earlier rows again; with all of them soft-wrapped an unbounded walk never ends.
|
||||||
|
|||||||
Reference in new issue
Block a user