fix: ESC key, .config, workspace permissions, terminal race condition
This commit is contained in:
@@ -314,17 +314,6 @@ export const TerminalComponent = React.forwardRef<TerminalRef, TerminalProps>(
|
||||
// Open xterm first (must happen before fit)
|
||||
term.open(container);
|
||||
term.focus();
|
||||
|
||||
// Allow ESC to propagate to browser when not in alternate buffer (vim/tmux)
|
||||
term.attachCustomKeyEventHandler((e) => {
|
||||
if (e.key === "Escape") {
|
||||
const isAlternate =
|
||||
term.buffer.active.type === "alternate";
|
||||
return isAlternate; // true = xterm handles it, false = browser handles it
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
const ws = connectWebSocket();
|
||||
|
||||
// Mobile touch scroll.
|
||||
@@ -366,16 +355,12 @@ export const TerminalComponent = React.forwardRef<TerminalRef, TerminalProps>(
|
||||
// If the viewport is scrollable, scroll it directly.
|
||||
// Otherwise we are in alternate screen (tmux/vim) and must
|
||||
// send SGR 1006 mouse-wheel protocol data.
|
||||
const hasScrollback =
|
||||
viewport.scrollHeight > viewport.clientHeight;
|
||||
const hasScrollback = viewport.scrollHeight > viewport.clientHeight;
|
||||
if (hasScrollback) {
|
||||
viewport.scrollTop += deltaY;
|
||||
} else {
|
||||
const ws = wsRef.current;
|
||||
if (
|
||||
ws?.readyState === WebSocket.OPEN &&
|
||||
termRef.current
|
||||
) {
|
||||
if (ws?.readyState === WebSocket.OPEN && termRef.current) {
|
||||
// Use the cursor position as the wheel location so
|
||||
// tmux knows which pane to scroll.
|
||||
const buf = termRef.current.buffer.active;
|
||||
|
||||
Reference in New Issue
Block a user