mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 12:30:44 +00:00
fix(tui): dedupe ASCII backspace events (#73335)
Merged via squash.
Prepared head SHA: 8f02f48acd
Co-authored-by: shanselman <2892+shanselman@users.noreply.github.com>
Co-authored-by: shanselman <2892+shanselman@users.noreply.github.com>
Reviewed-by: @shanselman
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