11 Commits

Author SHA1 Message Date
JiXieShi e9a58dc363 fix: insert CSI u handler into model.go + add tui tests
The previous commit defined parseCSIuBytes but failed to insert the
handler into Update(). Now properly inserted before the textinput
fallback. Add 10 test cases for parseCSIuBytes covering ctrl+alt+f/c/
m/p/h, ctrl+shift+c, alt+c, and invalid sequences.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-24 03:30:43 +08:00
JiXieShi b1c499b340 fix: TUI CSI u key parsing and console escape sequence order
- TUI: Add parseCSIuBytes to handle CSI u sequences that bubbletea
  v1.3.6 returns as []byte (unknownCSISequenceMsg). Parses codepoint
  and modifier bits to reconstruct key string for hotkey routing.
- Console: Reorder escape parser checks. Check 2-byte non-CSI
  sequences first, then CSI terminator only after ESC[ introducer.
  Fixes CSI u sequences being truncated at '[' byte (0x5b).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-24 03:25:40 +08:00
JiXieShi 319ed108d8 fix: panel handler default returns false for hotkey passthrough
Previously all three panel handlers (forward/plugin/mode) returned
true for unrecognized keys, swallowing Ctrl+Alt+M/F/P/H combos.
Now return false so hotkeys can switch panels without closing.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-24 03:06:18 +08:00
JiXieShi 4112e3fb03 fix: log path format, panel hotkey passthrough, TUI hint styling
- Fix log path default: $s→%s, show available fmt fields in prompt
- Panel handlers default return false (allows Ctrl+Alt+M/F/P/H to
  switch panels without closing current one)
- TUI bottom hints: replace Faint with Bold + brighter colors
  (suggest=cyan, status=bright white, hotkeys=bright gray)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-24 02:58:41 +08:00
JiXieShi 885f6a68cf fix: restore Ctrl+Alt+Key hotkeys and dedup normalizeHotkey
- Call enableVTInput after tea.NewProgram to restore VT input mode
  on Windows (bubbletea v1 conInputReader disables it, breaking
  Ctrl+Alt+Key combos)
- Move normalizeHotkey to internal/config.NormalizeHotkey, eliminate
  duplicate implementations in tui and console packages
- Remove unused Sess() getter from App

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-24 02:45:30 +08:00
JiXieShi 9bfb664838 fix: form label cleanup and hotkey passthrough
- Remove duplicate labels from renderForm (textinput.Prompt already shows label)
- Pass modifier key combos through form handler to global hotkey handlers
- Update forward form footer for clarity

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-24 02:28:53 +08:00
JiXieShi 7b6f4f03ab fix: simplify forward form to 2 fields, fix centering
- Revert fillScreen to Left/Top (normal terminal behavior)
- Simplify startForwardForm to 2 fields: Type (Tab cycle) + Address
- Remove splitAddr/netSplit helpers
- Add huh form library dependency for future use

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-24 02:23:48 +08:00
JiXieShi 939c3d5a29 fix: center main view content using terminal size
Change fillScreen from lipgloss.Left to lipgloss.Center for horizontal
positioning so content is centered based on actual terminal dimensions.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-24 02:15:02 +08:00
JiXieShi a4996ba3e7 feat: multi-field forward form with Tab cycling
Replace single-line prompt with form-based forward input:
- Separate Type/Host/Port fields
- Tab/Shift+Tab cycles focus, Tab on Type field cycles mode values
- Address auto-split into host+port for edit
- COM port excludes port field
- Form render with focused field indicator

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-24 02:13:18 +08:00
JiXieShi 30d6c2bc3c feat: add TCP Server, UDP Server, and COM port forwarding modes
Extend Mode constants (3=TCPServer, 4=UDPServer, 5=COMPort) with
explicit values. Refactor Target to support multiple connection types
(listener+conns map, packetConn, serialPort). Add acceptLoop,
readLoopPacket, readLoopSerial. Mode-aware Broadcast dispatches to
all accepted conns (TCP-S), known remotes (UDP-S), or serial port.
Update flag help, command completions, and TUI panel hints.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-23 23:10:02 +08:00
JiXieShi d8fc9d7374 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>
2026-05-23 22:46:02 +08:00