Repository navigation
Description
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
- Open a markdown file with
:view README.md. - Change the file on disk.
- 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(passesnilas the closer),openFileTab,loadView/loadMarkdown, andReloadTab.internal/handler/markdown/handler.go-SetComponent, the content-swap mechanism a reload would use.internal/text/flusher_closer.go-editorFlusherCloser, the existingFlusherCloserimplementation 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
Fix Markdown view tab reloads (unstablebuild#56)