fix(cli): add kilocode_change markers

This commit is contained in:
Alex Alecu
2026-04-14 19:41:50 +03:00
parent c1aca9a0cc
commit 316a6473b6
2 changed files with 4 additions and 5 deletions
@@ -2,8 +2,7 @@ import { useRenderer } from "@opentui/solid"
import { createSimpleContext } from "./helper"
import { FormatError, FormatUnknownError } from "@/cli/error"
import { win32FlushInputBuffer } from "../win32"
// kilocode_change - import resetTerminalState for mouse tracking cleanup
import { resetTerminalState } from "@tui/util/terminal"
import { resetTerminalState } from "@tui/util/terminal" // kilocode_change
type Exit = ((reason?: unknown) => Promise<void>) & {
message: {
set: (value?: string) => () => void
@@ -40,8 +39,7 @@ export const { use: useExit, provider: ExitProvider } = createSimpleContext({
renderer.setTerminalTitle("")
renderer.destroy()
win32FlushInputBuffer()
// kilocode_change - reset terminal state to disable mouse tracking
resetTerminalState()
resetTerminalState() // kilocode_change
if (reason) {
const formatted = FormatError(reason) ?? FormatUnknownError(reason)
if (formatted) {
@@ -1,5 +1,6 @@
import { RGBA } from "@opentui/core"
// kilocode_change start
/**
* Write escape sequences to disable all mouse tracking modes and reset terminal state.
* This is a safety net to ensure the terminal is clean after exit, even if the renderer's
@@ -18,10 +19,10 @@ export function resetTerminalState() {
try {
process.stdout.write(sequences.join(""))
} catch (err) {
// kilocode_change - stdout may already be closed during exit
console.error("resetTerminalState failed", err)
}
}
// kilocode_change end
export namespace Terminal {
export type Colors = Awaited<ReturnType<typeof colors>>