refactor: split termapp into proper internal packages

Replace monolithic internal/termapp with proper separation:
- internal/app: App struct, lifecycle, output loops
- internal/command: CommandHost interface, Dispatcher, handlers
- internal/tui: Model, hotkeys, panels, render (with panelError + border fixes)
- internal/console: RunConsole, escape parsing, entry point logic
- cmd/serialterminal: thin main() calling console.Run()

Eliminate global vars (cfg, sess, out) via dependency injection.
Break App->CommandDispatcher cycle via CommandHost interface.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
JiXieShi
2026-05-23 22:46:02 +08:00
parent daad844d4f
commit d8fc9d7374
22 changed files with 859 additions and 2080 deletions
+14
View File
@@ -0,0 +1,14 @@
//go:build windows
package console
import "golang.org/x/sys/windows"
func enableVTInput(fd int) {
var mode uint32
if err := windows.GetConsoleMode(windows.Handle(fd), &mode); err != nil {
return
}
mode |= windows.ENABLE_VIRTUAL_TERMINAL_INPUT
_ = windows.SetConsoleMode(windows.Handle(fd), mode)
}