Shelve the per-pane context indicator (keep narrow-toolbar fix)
Reliable per-pane context tracking isn't achievable from transcripts: we can't distinguish 'claude is live in this pane' from 'a shell sitting in a directory that recently had a claude session' (claude renders inline, not alt-screen; no WSL foreground-process access), and the 200k-vs-1M window isn't recorded so % is unreliable. Removed the context indicator, its OSC 7 cwd injection (pty.rs), the get_pane_context backend (usage.rs), src/lib/usage.ts, the orchestration paneContext map, and the App poll. The narrow-pane toolbar reflow (leaf--narrow/xnarrow tiers, label shrink, close × pinned) is KEPT — it's verified and independent. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
15c2842ce1
commit
00a1e24ecf
10 changed files with 4 additions and 568 deletions
|
|
@ -82,10 +82,6 @@ interface XtermPaneProps {
|
|||
* Defined as an optional callback so single-pane windows don't require
|
||||
* wiring it up. */
|
||||
onNavigate?: (intent: NavigateIntent) => void;
|
||||
/** Fired with the shell's reported working directory (from an OSC 7 escape,
|
||||
* which WSL panes emit via an injected PROMPT_COMMAND — see pty.rs). Used to
|
||||
* map the pane to the claude session running in it. */
|
||||
onCwd?: (cwd: string) => void;
|
||||
}
|
||||
|
||||
const DEFAULT_XTERM_FONT_SIZE = 13;
|
||||
|
|
@ -105,7 +101,6 @@ export default function XtermPane({
|
|||
focusTrigger = 0,
|
||||
fontSize,
|
||||
onNavigate,
|
||||
onCwd,
|
||||
}: XtermPaneProps) {
|
||||
const containerRef = useRef<HTMLDivElement>(null);
|
||||
const termRef = useRef<Terminal | null>(null);
|
||||
|
|
@ -126,7 +121,6 @@ export default function XtermPane({
|
|||
const onDataReceivedRef = useRef(onDataReceived);
|
||||
const onFocusRef = useRef(onFocus);
|
||||
const onNavigateRef = useRef(onNavigate);
|
||||
const onCwdRef = useRef(onCwd);
|
||||
// Stable ref for setSearchOpen so it can be called from inside the
|
||||
// attachCustomKeyEventHandler closure without the closure going stale.
|
||||
const setSearchOpenRef = useRef<(v: boolean) => void>(setSearchOpen);
|
||||
|
|
@ -137,7 +131,6 @@ export default function XtermPane({
|
|||
useEffect(() => { onDataReceivedRef.current = onDataReceived; }, [onDataReceived]);
|
||||
useEffect(() => { onFocusRef.current = onFocus; }, [onFocus]);
|
||||
useEffect(() => { onNavigateRef.current = onNavigate; }, [onNavigate]);
|
||||
useEffect(() => { onCwdRef.current = onCwd; }, [onCwd]);
|
||||
useEffect(() => { setSearchOpenRef.current = setSearchOpen; }, [setSearchOpen]);
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
|
@ -211,29 +204,6 @@ export default function XtermPane({
|
|||
searchAddonRef.current = search;
|
||||
term.loadAddon(search);
|
||||
|
||||
// OSC 7 (cwd reporting): WSL panes emit `\e]7;file://<host><path>\e\\` on
|
||||
// every prompt (via the PROMPT_COMMAND we inject at spawn). Capture the
|
||||
// path and report it up so the pane can be matched to its claude session.
|
||||
// Registered before data flows so the first prompt's cwd is caught.
|
||||
term.parser.registerOscHandler(7, (data) => {
|
||||
const m = /^file:\/\/[^/]*(\/.*)$/.exec(data);
|
||||
if (m) {
|
||||
let path = m[1];
|
||||
try {
|
||||
path = decodeURIComponent(path);
|
||||
} catch {
|
||||
/* leave raw if it isn't valid percent-encoding */
|
||||
}
|
||||
// Defer out of term.write()'s synchronous path: OSC handlers run while
|
||||
// xterm processes PTY data, which can coincide with React's render
|
||||
// phase — calling the parent's setState directly there triggers a
|
||||
// "cannot update while rendering" warning and the update gets dropped.
|
||||
const reported = path;
|
||||
queueMicrotask(() => onCwdRef.current?.(reported));
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
// Initial size — fit before asking the PTY for its dimensions.
|
||||
fit.fit();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue