fix: failing tests
This commit is contained in:
parent
87ef441c99
commit
60e1a67dc4
2 changed files with 10 additions and 15 deletions
|
|
@ -323,10 +323,8 @@ export class TextBuffer {
|
|||
|
||||
// Fallback paste detection: some terminals send large pastes as rapid chunks
|
||||
// instead of using bracketed paste mode. We detect this by timing between inputs.
|
||||
if (
|
||||
input.length > RAPID_INPUT_THRESHOLD ||
|
||||
(input.length >= 50 && this._rapidInputBuffer.length === 0)
|
||||
) {
|
||||
// Only trigger for actually large chunks to avoid interfering with normal typing
|
||||
if (input.length > RAPID_INPUT_THRESHOLD) {
|
||||
this._rapidInputStartPos = this._cursor;
|
||||
|
||||
// Accumulate chunks without inserting to avoid visual flicker
|
||||
|
|
@ -524,7 +522,8 @@ export class TextBuffer {
|
|||
}
|
||||
|
||||
// Fallback: detect chunked paste operations
|
||||
if (this.handleRapidInput(input)) {
|
||||
// Don't trigger rapid input detection for small inputs (e.g. single characters like "/" or "@")
|
||||
if (input.length > 50 && this.handleRapidInput(input)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { testBothModes, renderInMode } from "./TUIChat.dualModeHelper.js";
|
||||
import { renderInMode, testBothModes } from "./TUIChat.dualModeHelper.js";
|
||||
|
||||
describe("TUIChat - Slash Commands Tests", () => {
|
||||
testBothModes("shows slash when user types /", async (mode) => {
|
||||
|
|
@ -28,17 +28,15 @@ describe("TUIChat - Slash Commands Tests", () => {
|
|||
const { lastFrame, stdin } = renderInMode(mode);
|
||||
|
||||
// Type /log to trigger slash command filtering
|
||||
stdin.write("/log");
|
||||
stdin.write("/exi");
|
||||
|
||||
// Wait a bit for the UI to update (allow extra time in both modes)
|
||||
await new Promise((resolve) =>
|
||||
setTimeout(resolve, mode === "remote" ? 200 : 150),
|
||||
);
|
||||
await new Promise((resolve) => setTimeout(resolve, 200));
|
||||
|
||||
const frame = lastFrame();
|
||||
|
||||
// Should show the typed command
|
||||
expect(frame).toContain("/log");
|
||||
expect(frame).toContain("/exi");
|
||||
|
||||
// Mode-specific UI elements
|
||||
if (mode === "remote") {
|
||||
|
|
@ -53,7 +51,7 @@ describe("TUIChat - Slash Commands Tests", () => {
|
|||
const { lastFrame, stdin } = renderInMode(mode);
|
||||
|
||||
// Type /log and then tab
|
||||
stdin.write("/log");
|
||||
stdin.write("/exi");
|
||||
|
||||
await new Promise((resolve) => setTimeout(resolve, 50));
|
||||
|
||||
|
|
@ -83,9 +81,7 @@ describe("TUIChat - Slash Commands Tests", () => {
|
|||
// Type just /
|
||||
stdin.write("/");
|
||||
|
||||
await new Promise((resolve) =>
|
||||
setTimeout(resolve, mode === "remote" ? 120 : 50),
|
||||
);
|
||||
await new Promise((resolve) => setTimeout(resolve, 200));
|
||||
|
||||
const frame = lastFrame();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue