mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-16 20:11:08 +00:00
* feat(terminal): click archive names to fill extraction command Paste an absolute tar or unzip command when a Linux session Ctrl/Cmd-clicks a printed archive name. Cwd comes from OSC 7 markers only, so a later directory change cannot retarget an old relative name. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(terminal): anchor wrapped archive links on the continuation row A token that starts on the next physical row was mapped to the previous row's exclusive end cell. Inclusive offsets now move to the next segment, while an end-exclusive offset stays on the row where the match stops. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(terminal): separate archive fill from text after the cursor Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(terminal): separate archive fill across a wrapped draft Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com>
32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
export interface ShellPromptReadiness {
|
|
sensitiveInputActive?: boolean;
|
|
hasLiveTerminal: boolean;
|
|
alternateScreenActive: boolean;
|
|
isAtPrompt: boolean;
|
|
userInputLength: number;
|
|
pendingTypedInputLength?: number;
|
|
}
|
|
|
|
/**
|
|
* Prompt is showing on the primary screen and is not a password/TUI.
|
|
* A typed draft is allowed; archive clicks insert at the cursor.
|
|
*/
|
|
export function isShellPromptReadyForInsertion(options: ShellPromptReadiness): boolean {
|
|
if (options.sensitiveInputActive) return false;
|
|
if (!options.hasLiveTerminal) return false;
|
|
if (options.alternateScreenActive) return false;
|
|
if (!options.isAtPrompt) return false;
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Whether an automated PTY write (e.g. SFTP "open path in terminal") may run
|
|
* at a clean interactive shell prompt -- not mid-line, not in an editor/TUI.
|
|
*/
|
|
export function isIdleShellReadyForCommandInjection(options: ShellPromptReadiness): boolean {
|
|
if (!isShellPromptReadyForInsertion(options)) return false;
|
|
if (options.userInputLength > 0) return false;
|
|
if ((options.pendingTypedInputLength ?? 0) > 0) return false;
|
|
return true;
|
|
}
|