Skip to content

TUI scan view: Ctrl+C after completion mislabels the scan "Aborted", notices push the status off-screen, and rendering cost grows quadratically #43

Closed

Description

@TMHSDigital

Why it matters

The scan screen is the TUI's main view, and several problems show up on real (especially recursive) scans.

  1. Ctrl+C after a scan has finished calls cancel() and sets aborted = true. The status line flips from "Done" to "Aborted" for a scan that completed successfully, and the program doesn't quit (only q does). The README key table says Ctrl+C means "abort scan / quit", so users press it and see a wrong verdict.
  2. Wildcard and error notices are unbounded and rendered above a fixed-height viewport. A recursive scan emits one wildcard DNS at X; skipping recursive expansion line per wildcard branch, plus cap notices. Each one adds a line while the viewport stays at height-8, so the progress bar and status line get pushed below the alt-screen and disappear.
  3. O(n²) result rendering. Every result re-styles and re-joins the whole result list (strings.Join(m.results, "\n") followed by SetContent). With thousands of hits, the UI falls behind the event stream. Because the TUI consumes events one message at a time, that slowness also back-pressures the scan workers through the events channel.
  4. Paths typed into the form, such as ~/lists/words.txt, are not tilde-expanded (there is no shell), so they fail with "cannot read wordlist".

Evidence

  • internal/tui/model.go:169-175: the ctrl+c handler doesn't check m.scanView.done.
  • internal/tui/scan_view.go:82-86,117-119: messages grows without limit and is rendered above the viewport.
  • internal/tui/scan_view.go:42,65: the viewport height ignores len(messages). Related: TUI scan viewport height goes negative on terminals shorter than 9 rows #37, where the same arithmetic goes negative.
  • internal/tui/scan_view.go:68-75: full re-join and re-render on every result.
  • internal/tui/form.go:330,389: wordlist and output paths are used verbatim.

Suggested approach

  • ctrl+c when done → tea.Quit. While running → abort as today.
  • Cap rendered notices (for example the last 3, plus a "+N more" counter) and subtract their height when sizing the viewport.
  • Keep results in a ring buffer or a capped slice, and append incrementally (or rebuild content only on a tick or batch) instead of re-joining every message.
  • Expand a leading ~/ with os.UserHomeDir() for both path fields.

Done when

  • Ctrl+C on a finished scan quits and never relabels it.
  • With 50 notices and 10k results the progress bar and status line stay visible, and render time per event is constant (a benchmark or test in scan_view_test.go).
  • ~/... paths work in the form.

Activity

  1. added
    bug
    priority: medium
    area: tui
    on Oct 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: tuibugpriority: medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions