Fix interactive TUI startup crash and blank rendering - #12
Open
mparrett wants to merge 4 commits into
Open
Conversation
The TUI crashed immediately on launch: the constructor sized its views with absolute Rects computed from Application.Top.Frame, which isn't laid out until Application.Run(), so Height was 0 and the Rect ctor threw. Beyond that, the curses driver reports a 0x0 terminal on macOS, leaving the UI blank and crashing OpenDialog with a negative width. Switch to computed layout (Dim.Fill/Pos.AnchorEnd), which also makes the UI resize-aware, and use the portable .NET console driver instead of curses. Suspend NLog console logging while the TUI owns the screen so disassembly progress lines no longer draw over the UI. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
DoDisassembly runs on a background task but ran the completion dialog's event loop from that thread, so the dialog never received input and could not be dismissed. Run the dialog via Application.MainLoop.Invoke and route the status/progress updates through it as well. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The .NET console driver doesn't reset terminal modes on shutdown: mouse tracking stayed enabled after exit, so every mouse movement typed SGR report fragments into the shell, and the terminal could be left on the alternate screen. Shut the Application down properly and reset the mouse/alternate-screen/cursor modes explicitly. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The .NET console driver paints directly onto the main screen, so the TUI's last frame (file listings, blank window area) was left behind in the shell after exit. Enter the alternate screen before init so exiting restores whatever the terminal showed before launch. Also reset DECCKM (application cursor keys), which the driver enables but never turns off. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Launching MBBSDASM with no arguments (the interactive Terminal.Gui mode) crashed immediately:
Fixing that surfaced two more defects behind it; all are needed to make the TUI usable end to end:
The constructor sized its views with absolute
Rects computed fromApplication.Top.Frame, but the top-level frame isn't laid out untilApplication.Run(), soHeightwas 0 and theRectconstructor threw. Switched to computed layout (Dim.Fill/Pos.AnchorEnd), which also makes the UI adapt to terminal resizes.On macOS the curses driver reports a 0x0 terminal, which left the whole UI blank and crashed
OpenDialogwithwidth cannot be negative. Switched to the portable .NET console driver (Application.UseSystemConsole = true), which renders correctly on every platform dotnet runs on.DoDisassemblyruns on a background task but ran the completion dialog's event loop from that thread, so the dialog never received input and could not be dismissed — the app had to be killed after every disassembly. The dialog now runs viaApplication.MainLoop.Invoke, and the status/progress updates are marshaled the same way.On exit, the driver leaves mouse tracking enabled — every mouse movement after quitting typed SGR report fragments (
35;12;6M...) into the shell — and can leave the terminal on the alternate screen. The TUI now shuts theApplicationdown and resets those modes explicitly.Also suspended NLog console logging while the TUI owns the screen — the disassembly pipeline's progress log lines were drawing over the UI.
Verified by driving the full interactive flow on macOS (in tmux and in a regular terminal): launch → File → Disassemble → file dialog → options dialog → disassembly of a real-world module DLL → completion dialog → OK → back to a responsive menu → clean exit, with a clean screen throughout and the output file written. Existing suite green.
Independent of #9/#11 — based directly on master.
Visual verification
TUI loads, can decompile and exit.
🤖 Generated with Claude Code