Skip to content

Collapse redundant ternary in revealFrequencyIfNeeded comfortMargin (cleanup, post-#3030) #3033

Description

@ten9876

Background

After PR #3030 (fix for #2941) changed the revealOffscreen branch to return kRevealComfortEdgeMarginFrac instead of 0.0, the ternary at src/gui/MainWindow.cpp:12238-12241 has redundant first/third branches that both return the same value:

```cpp
const double comfortMargin =
revealOffscreen ? kRevealComfortEdgeMarginFrac // <-- same...
: isSpectrumClick ? kSpectrumClickEdgeMarginFrac
: kRevealComfortEdgeMarginFrac; // <-- ...as this
```

Proposed cleanup

Collapse to:

```cpp
const double comfortMargin = isSpectrumClick
? kSpectrumClickEdgeMarginFrac
: kRevealComfortEdgeMarginFrac;
```

The revealOffscreen variable is still needed for triggerEdgeMarginFrac a few lines later, so leave the computation in place — just drop it from the comfortMargin ternary.

Pull the explanatory comment forward from #3030 with a note that off-screen-indicator clicks share the default reveal margin, since the explicit branch is going away.

Why this is a follow-up, not a fix-up to #3030

Effort

~2 minutes. Single-file, single-hunk, no test impact.

Metadata

Metadata

Assignees

No one assigned

    Labels

    GUIUser interfaceenhancementImprovement to existing featuregood first issueGood for newcomersmaintainer-reviewRequires maintainer review before any action is takenspectrumPanadapter and waterfall

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions