Skip to content

feat: hide checked items toggle for view mode #220

@oobagi

Description

@oobagi

Problem

There's no way to collapse completed checklist items out of sight. When a note has many checked todos, the live/unchecked items get buried. Users want a toggle — primarily in view mode, possibly in edit mode — that hides Checked == true checklist blocks entirely.

Context

  • Existing HideChecked config key in internal/config/config.go:18 is misleadingly named — it actually drives sort-to-bottom via m.sortChecked / sortCheckedToBottom(), not hiding. See project memory Sort-checked and the 2026-04-08 work.
  • View-mode rendering: internal/editor/editor.go viewMode flag (line 103) and render paths around lines 2540 / 2773 / 2891 / 2909 / 3035.
  • Block iteration for rendering happens over m.blocks; hiding likely means skipping blocks with Type == block.Checklist && Checked == true during render and viewport layout.

Approach

  1. Rename or disambiguate: either rename the existing config key to SortChecked and introduce a new HideChecked key, or keep HideChecked meaning "hide" and rename the sort-to-bottom flag. Pick whichever minimizes migration pain; document in CHANGELOG.
  2. Add a runtime toggle (keybind, e.g., Ctrl+Shift+H, or via footer popup) that flips the in-memory flag for the current session.
  3. In the view-mode render pipeline, skip hidden blocks. Viewport height calculation must exclude them too, so scrolling stays correct.
  4. Decide edit-mode behavior: either supported symmetrically or scoped to view mode only for v1. Recommend view-mode-only first — editing a list while items vanish is confusing.

Tasks

  • Resolve the HideChecked config-name conflict (migration + CHANGELOG note).
  • Add rendering skip for checked checklist blocks when the flag is on.
  • Fix viewport/scroll math so hidden blocks don't leave gaps.
  • Add a keybind + footer popup toggle.
  • Decide + implement edit-mode behavior (or explicitly defer).
  • Tests for: all-hidden note, mixed, nested checklist children of hidden parents, toggle round-trip.

Acceptance criteria

  • Toggling "hide checked" in view mode immediately removes checked items from the rendered output.
  • Scrolling, block count indicators, and cursor positioning remain correct.
  • Underlying .note file is not mutated by toggling.
  • Config persists the preference across sessions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions