fix: local PowerShell garbled output + resize not propagating
All checks were successful
Build & Sign Wraith / Build Windows + Sign (push) Successful in 4m10s
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>
This commit is contained in:
parent
3638745436
commit
d39c0d38ed
@ -9,7 +9,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted, watch } from "vue";
|
import { ref, onMounted, onBeforeUnmount, watch } from "vue";
|
||||||
import { invoke } from "@tauri-apps/api/core";
|
import { invoke } from "@tauri-apps/api/core";
|
||||||
import { useTerminal } from "@/composables/useTerminal";
|
import { useTerminal } from "@/composables/useTerminal";
|
||||||
import "@/assets/css/terminal.css";
|
import "@/assets/css/terminal.css";
|
||||||
@ -20,11 +20,20 @@ const props = defineProps<{
|
|||||||
}>();
|
}>();
|
||||||
|
|
||||||
const containerRef = ref<HTMLElement | null>(null);
|
const containerRef = ref<HTMLElement | null>(null);
|
||||||
const { terminal, mount, fit } = useTerminal(props.sessionId, "pty");
|
const { terminal, mount, fit, destroy } = useTerminal(props.sessionId, "pty");
|
||||||
|
let resizeObserver: ResizeObserver | null = null;
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (containerRef.value) {
|
if (containerRef.value) {
|
||||||
mount(containerRef.value);
|
mount(containerRef.value);
|
||||||
|
|
||||||
|
// Watch container size changes and refit terminal
|
||||||
|
resizeObserver = new ResizeObserver(() => {
|
||||||
|
if (props.isActive) {
|
||||||
|
fit();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
resizeObserver.observe(containerRef.value);
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
fit();
|
fit();
|
||||||
@ -48,4 +57,12 @@ watch(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
if (resizeObserver) {
|
||||||
|
resizeObserver.disconnect();
|
||||||
|
resizeObserver = null;
|
||||||
|
}
|
||||||
|
destroy();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -70,7 +70,9 @@ export function useTerminal(sessionId: string, backend: 'ssh' | 'pty' = 'ssh'):
|
|||||||
cursorStyle: "block",
|
cursorStyle: "block",
|
||||||
scrollback: 10000,
|
scrollback: 10000,
|
||||||
allowProposedApi: true,
|
allowProposedApi: true,
|
||||||
convertEol: backend === 'ssh',
|
// SSH always needs EOL conversion. PTY needs it on Windows (ConPTY sends bare \n)
|
||||||
|
// but not on Unix (PTY driver handles LF→CRLF). navigator.platform is the simplest check.
|
||||||
|
convertEol: backend === 'ssh' || navigator.platform.startsWith('Win'),
|
||||||
rightClickSelectsWord: false,
|
rightClickSelectsWord: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user