All checks were successful
Build & Sign Wraith / Build Windows + Sign (push) Successful in 4m10s
Two issues: 1. convertEol was false for PTY sessions, but Windows ConPTY sends bare \n without \r. Now enabled on Windows PTY sessions (checked via navigator.platform). Unix PTY still false (driver handles it). 2. LocalTerminalView had no ResizeObserver, so the terminal never reflowed when the container size changed. Added ResizeObserver matching the SSH TerminalView pattern. Also added proper cleanup on unmount. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
69 lines
1.4 KiB
Vue
69 lines
1.4 KiB
Vue
<template>
|
|
<div class="flex flex-col h-full">
|
|
<div
|
|
ref="containerRef"
|
|
class="terminal-container flex-1"
|
|
@click="terminal.focus()"
|
|
/>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { ref, onMounted, onBeforeUnmount, watch } from "vue";
|
|
import { invoke } from "@tauri-apps/api/core";
|
|
import { useTerminal } from "@/composables/useTerminal";
|
|
import "@/assets/css/terminal.css";
|
|
|
|
const props = defineProps<{
|
|
sessionId: string;
|
|
isActive: boolean;
|
|
}>();
|
|
|
|
const containerRef = ref<HTMLElement | null>(null);
|
|
const { terminal, mount, fit, destroy } = useTerminal(props.sessionId, "pty");
|
|
let resizeObserver: ResizeObserver | null = null;
|
|
|
|
onMounted(() => {
|
|
if (containerRef.value) {
|
|
mount(containerRef.value);
|
|
|
|
// Watch container size changes and refit terminal
|
|
resizeObserver = new ResizeObserver(() => {
|
|
if (props.isActive) {
|
|
fit();
|
|
}
|
|
});
|
|
resizeObserver.observe(containerRef.value);
|
|
}
|
|
setTimeout(() => {
|
|
fit();
|
|
terminal.focus();
|
|
invoke("pty_resize", {
|
|
sessionId: props.sessionId,
|
|
cols: terminal.cols,
|
|
rows: terminal.rows,
|
|
}).catch(() => {});
|
|
}, 50);
|
|
});
|
|
|
|
watch(
|
|
() => props.isActive,
|
|
(active) => {
|
|
if (active) {
|
|
setTimeout(() => {
|
|
fit();
|
|
terminal.focus();
|
|
}, 0);
|
|
}
|
|
},
|
|
);
|
|
|
|
onBeforeUnmount(() => {
|
|
if (resizeObserver) {
|
|
resizeObserver.disconnect();
|
|
resizeObserver = null;
|
|
}
|
|
destroy();
|
|
});
|
|
</script>
|