fix(tui): preserve ASCII punctuation word boundaries with Intl.Segmenter (#5067)

This commit is contained in:
xu0o0
2026-05-27 18:12:10 +08:00
committed by GitHub
parent 493efd422d
commit b62776e4a2
4 changed files with 66 additions and 6 deletions

View File

@@ -100,6 +100,20 @@ describe("Input component", () => {
assert.strictEqual(input.getValue(), "bazfoo bar ");
});
it("Ctrl+W preserves ASCII punctuation boundaries", () => {
const input = new Input();
input.setValue("foo.bar");
input.handleInput("\x05"); // Ctrl+E
input.handleInput("\x17"); // Ctrl+W - deletes "bar"
assert.strictEqual(input.getValue(), "foo.");
input.setValue("foo:bar");
input.handleInput("\x05"); // Ctrl+E
input.handleInput("\x17"); // Ctrl+W - deletes "bar"
assert.strictEqual(input.getValue(), "foo:");
});
it("Ctrl+U saves deleted text to kill ring", () => {
const input = new Input();