mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 07:20:43 +00:00
fix(tui): dedupe ASCII backspace events
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -210,6 +210,14 @@ describe("createBackspaceDeduper", () => {
|
||||
expect(dedupe("\x7f")).toBe("\x7f");
|
||||
});
|
||||
|
||||
it("treats ASCII BS as backspace when it is the first event", () => {
|
||||
const { dedupe, advance } = createTimedDedupe();
|
||||
|
||||
expect(dedupe("\x08")).toBe("\x08");
|
||||
advance(1);
|
||||
expect(dedupe("\x7f")).toBe("");
|
||||
});
|
||||
|
||||
it("never suppresses non-backspace keys", () => {
|
||||
const dedupe = createBackspaceDeduper();
|
||||
expect(dedupe("a")).toBe("a");
|
||||
|
||||
@@ -209,7 +209,7 @@ export function createBackspaceDeduper(params?: { dedupeWindowMs?: number; now?:
|
||||
let lastBackspaceAt = -1;
|
||||
|
||||
return (data: string): string => {
|
||||
if (!matchesKey(data, Key.backspace)) {
|
||||
if (data !== "\x08" && !matchesKey(data, Key.backspace)) {
|
||||
return data;
|
||||
}
|
||||
const ts = now();
|
||||
|
||||
Reference in New Issue
Block a user