Skip to content

Cmd+← / back navigation in Directory Preview discards unsaved file edits without prompt #3442

Description

@swordsm

Problem

When browsing files in Directory Preview mode and editing a file (e.g., a markdown file), pressing Cmd+← (or clicking the back arrow) navigates back to the directory listing and silently discards all unsaved edits — no confirmation, no prompt.

Steps to Reproduce

  1. Open a directory in Wave Terminal (Directory Preview)
  2. Click a .md file to open it for inline editing
  3. Type some content but do not press Cmd+S
  4. Press Cmd+← or click the back arrow in the toolbar

Expected: A dialog appears: "You have unsaved changes. Save before leaving?" with options to Save / Discard / Cancel.

Actual: Navigation back happens immediately, all unsaved edits are lost.

Context

  • There is no shortcut or gesture that currently closes the editor with a save prompt — the dirty-state check simply doesn't exist on the Directory Preview back-navigation path
  • This is a data-loss risk for anyone using the built-in file editing in directory preview

Suggested Fix

Add a dirty-state check to the Directory Preview back-navigation handler. When there are unsaved edits in the current file preview/edit view, prompt the user before navigating back.

Related

  • Existing "confirm close" settings (tab:confirmclose, window:confirmclose, app:confirmquit) only cover tab/window/app-level close, not intra-widget navigation back
  • ~/.waveterm/config/keybindings.json allows remapping keys but can't add conditional logic (e.g., "check dirty state before executing back command")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions