Skip to content

Extract Marker Bar logic out of the LogWindow.MarkerBar.cs partial #719

Description

@Hirogen

Problem

LogWindow.MarkerBar.cs (about 390 lines, added in #27) is a partial of LogWindow. Splitting the file doesn't shrink the class. Its 20 marker fields sit on LogWindow itself, and any code in the 7,800-line LogWindow.cs can read or change them. LogWindow.cs calls into it from about 26 places. Those fields include:

  • two MarkerIndex instances and the MarkerBar control
  • the timer, the lock, the visibility tuple
  • the generation, revision and content-revision counters, the pending-tail flag, the current frame and the reported errors

The real logic is already in separate classes: MarkerBar draws, and MarkerIndex and MarkerCriteria scan and match. What's left in the partial is coordination: configuring the indexes, the 250 ms timer loop that takes snapshots and renders frames, turning preferences into visibility, the generation checks, error reporting and disposal.

Proposal

Move that coordination into its own class, for example MarkerBarController, which owns the indexes, the timer, the counters and the frame state. LogWindow keeps only the wiring:

  • create it, passing the MarkerBar control and a small host interface or callbacks for:
    • the reader, the file name and the line count
    • whether loading, dead or closing
    • the column-header height and the columnizer columns
    • the current highlight entries and search
    • reporting a status-line error
    • going to a line
  • forward the events it already raises: content changed and tail lines, highlight or search changes, preference changes, DPI changes and disposal. These are the calls to InvalidateMarkerCriteria, MarkMarkerDataChanged, TrackMarkerSearch, ApplyMarkerPreferences and DisposeMarkers.

This matches how the hide-line feature (#338, PR #718) was restructured: VisibleRows and HiddenLinesBar are real classes, and LogWindow only keeps the wiring.

Acceptance criteria

  • LogWindow.MarkerBar.cs is removed, and no marker state fields are left on LogWindow.
  • Marker behaviour is unchanged: MarkerWindowTests and the Core marker tests pass without changing what they check.
  • The controller's snapshot and generation handling can be unit-tested without a real Log Window where that's practical.

Out of scope

Any change to marker behaviour, colours or scanning.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementthis will make things better

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions