mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-09 00:49:41 +02:00
fix: add suppressBufferDetection, comprehensive docs and tests
Second deep audit comparing all 43 integration points in Claudeman's app.js against the library API found one critical gap: - Add suppressBufferDetection() — needed when switching to sessions with UI framework text (Ink) after the prompt that would be falsely detected. Claudeman sets _bufferDetectDone=true externally; this method provides the public equivalent. Tests: 74 total (+13 new) - Tab-switch save/restore pattern (flushed state roundtrip) - suppressBufferDetection blocks explicit, implicit (addChar), and cascade (removeChar) detection paths - clear() resets suppression - Methods safe before activate() and after dispose() - addChar implicit buffer detection on first keystroke - refreshFont with flushed-only text README: rewritten from 207 to 459 lines with: - removeChar cascade explanation with return value table - Flushed text concept explained - Integration patterns: buffered, char-at-a-time, tab switching, tab completion, Ink/TUI frameworks, SSE reconnect, resize, font - Architecture diagram (keypress → DOM overlay → PTY echo flow) - Prompt column locking, text wrapping, render cache, scroll awareness - All known limitations documented Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -347,6 +347,20 @@ export class ZerolagInputAddon implements XtermAddon {
|
||||
this._bufferDetectDone = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Suppress buffer detection until the next `clear()` or
|
||||
* `resetBufferDetection()` call.
|
||||
*
|
||||
* Use case: When switching to a session whose buffer contains UI
|
||||
* framework text (e.g., Ink status bars) after the prompt marker,
|
||||
* `detectBufferText()` would falsely pick up that text as user input.
|
||||
* Call this after switching to prevent false detection until the user
|
||||
* actually presses Enter (which calls `clear()` and re-enables detection).
|
||||
*/
|
||||
suppressBufferDetection(): void {
|
||||
this._bufferDetectDone = true;
|
||||
}
|
||||
|
||||
// ─── Prompt utilities ─────────────────────────────────────────────
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user