Skip to content

Markdown view tabs (:view file.md) cannot be reloaded #3

Closed

Description

@ernestrc

Opening a .md file with :view installs a read-only markdown tab. Reloading that tab fails: both :reloadfile and the filesystem watcher auto-reload report failed to reload tab: cannot reload this content.

Steps to reproduce

  1. Open a markdown file with :view README.md.
  2. Change the file on disk.
  3. Run :reloadfile (or wait for the FS watcher).

Actual: the notification failed to reload tab: cannot reload this content appears and the view keeps the stale content.
Expected: the rendered markdown updates to the new file contents.

Root cause

Markdown view tabs are constructed with a nil tab closer, so they have no workspace.FlusherCloser. Component.ReloadTab rejects any tab whose closer is nil and returns ErrInvalidReload before any reload work happens. The markdown handler itself already supports content replacement via SetComponent, so the machinery for reloading exists, it just is not wired.

Where to look

  • internal/text/component.go - newViewTab (passes nil as the closer), openFileTab, loadView / loadMarkdown, and ReloadTab.
  • internal/handler/markdown/handler.go - SetComponent, the content-swap mechanism a reload would use.
  • internal/text/flusher_closer.go - editorFlusherCloser, the existing FlusherCloser implementation to mirror for the channel and event-loop dispatch patterns.

Notes for contributors

The shape of the fix is a FlusherCloser for markdown view tabs: Flush/ForceFlush are no-ops, Reload re-reads and re-parses the file and swaps the component, and LastFlush reports the file modtime so the FS-watcher de-duplication keeps working. Once a non-nil closer is wired, ReloadTab needs no changes.

Constraints worth respecting: the read/parse happens off the event loop, but the UI mutation must be scheduled back onto the host event loop, and any goroutine must run under debug.CapturePanicReport. Tests should cover both :reloadfile and the FS-watcher path.

Activity

  1. added
    bug
    help wanted
    on Sep 11, 2026
  2. added a commit that references this issue on Sep 15, 2026
    241cfc3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bughelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions