This commit is contained in:
2026-07-26 14:02:37 +07:00
parent bc56546b49
commit 367ebc1c7f
171 changed files with 4617 additions and 10402 deletions
+25
View File
@@ -699,6 +699,31 @@ describe("Editor component", () => {
});
});
describe("Scroll indicators", () => {
it("keeps truncated scroll indicators within width and preserves their color (issue #6962)", () => {
const width = 10;
const borderColor = (text: string) => `\x1b[35m${text}\x1b[39m`;
const editor = new Editor(createTestTUI(width), { ...defaultEditorTheme, borderColor });
editor.setText(Array.from({ length: 20 }, (_, index) => `line ${index}`).join("\n"));
// Render once to initialize wrapping, then move the cursor so content remains above and below the viewport.
editor.render(width);
for (let index = 0; index < 10; index++) editor.handleInput("\x1b[A");
const lines = editor.render(width);
const topBorder = lines[0]!;
const bottomBorder = lines.at(-1)!;
assert.match(stripVTControlCharacters(topBorder), /^─── ↑/);
assert.match(stripVTControlCharacters(bottomBorder), /^─── ↓/);
assert.strictEqual(topBorder, borderColor(stripVTControlCharacters(topBorder)));
assert.strictEqual(bottomBorder, borderColor(stripVTControlCharacters(bottomBorder)));
for (const line of lines) {
assert.strictEqual(visibleWidth(line), width, `line exceeds width ${width}: ${JSON.stringify(line)}`);
}
});
});
describe("Grapheme-aware text wrapping", () => {
it("wraps lines correctly when text contains wide emojis", () => {
const editor = new Editor(createTestTUI(), defaultEditorTheme);