Skip to content

enhance: show status toast when toggling note preview #193

@oobagi

Description

@oobagi

Problem

Pressing "p" to toggle the note preview panel in the browser produces no visual feedback. Other toggle/action commands display a temporary status message in the status bar (e.g., "Copied to clipboard", "Saved", theme changes). The silent toggle breaks the established UX pattern and can make users think the key didn't register.

Context

The "p" handler at internal/browser/browser.go:422-425 simply flips showPreview and returns:

if s == "p" {
    m.showPreview = !m.showPreview
    return m, nil
}

The status message system is already in place and used by other commands:

  • statusMsg type at browser.go:222-223
  • statusText field at line 71, statusGen at line 72
  • scheduleStatusDismiss() at lines 126-134 (4-second auto-dismiss)
  • format.StatusBar() renders it at line 1840
  • Used by: copy, rename, theme change, recents deletion, etc.

Possible approaches

Approach A: Return statusMsg command

  • How: After toggling, return a statusMsg with "Preview on" / "Preview off"
  • Pros: Follows the exact pattern used by all other status messages
  • Cons: None — this is the intended pattern
  • Files: internal/browser/browser.go

Tasks

  • Update "p" handler to return statusMsg with conditional text based on showPreview state
  • Verify toast auto-dismisses after statusTimeout (4s)

Test plan

  • Press "p" to enable preview — status bar shows "Preview on" briefly
  • Press "p" again to disable — status bar shows "Preview off" briefly
  • Message auto-dismisses after ~4 seconds
  • Message does not interfere with subsequent key presses
  • Other status messages still work correctly

Scope

Type: enhancement
Size: small

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