feat: tree browser and VS Code-style tabs for clips#192
Merged
Conversation
Replace the flat clip list with a TreeView that mirrors the repository's folder hierarchy, and the single-clip editor pane with a tab strip that supports preview/permanent tabs and dirty indicators. - IClipRepository gains an optional FolderPath on ClipData; filesystem ClipRepository recurses subdirectories and round-trips folder paths on save, rejecting traversal segments. - ClipViewModel gains IsDirty (computed) and caches its Avalonia editor control so tab switches reparent the same instance. - ScriptTextEditor no longer disposes TextMate on visual-tree detach; lifetime is explicit via IDisposable. RegistryOptions and the FM script grammar are parsed once and shared across instances. - Open tabs are realised once into an ItemsControl and toggled via IsVisible, avoiding AvaloniaEdit layout/tokenise work on every switch. - Single-tap in the tree opens a preview tab (italic), double-tap or first edit graduates it to permanent. Dirty dot clears on save.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the flat clip list with a TreeView that mirrors the repository's folder hierarchy, and the single-clip editor pane with a tab strip that supports VS Code-style preview tabs, permanent tabs, and dirty indicators.
What's new
ClipDatagains an optionalFolderPath; the filesystemClipRepositoryrecurses subdirectories, round-trips folder paths on save, cleans up now-empty subdirs, and rejects traversal segments. The hierarchy concept lives on the repository contract so non-filesystem providers can synthesise folders however they want.TreeViewbound to aClipTreeNodeViewModelstructure built from the flat clip collection. Search filters the tree and auto-expands matching branches. Tree template kept compact with existing Fluent2 styling.✕button; closing the active tab picks a neighbour.ClipViewModel.IsDirtycompares the live editor XML against a saved snapshot;MarkSaved()rebases after a bulkCtrl+S. Tab headers show an accent dot while dirty; it clears on save.Performance
Opening the tab-strip naively triggered a visible hitch on every tab switch because
ScriptTextEditorreinstalls TextMate on construction. Three levers applied:ScriptTextEditorno longer tears down TextMate on visual-tree detach; it's nowIDisposableand is only disposed when its owningClipViewModelis removed.ClipViewModelcaches its Avalonia editor control (EditorView) so tab switches can reparent the same instance instead of reconstructing it.FmScriptRegistryOptionscaches the parsed FM script grammar;ScriptTextEditorshares a single staticRegistryOptions/FmScriptRegistryOptionsacross instances.ItemsControland toggled viaIsVisible, so switching is a visibility flip rather than a reparent + AvaloniaEdit layout/tokenise pass.Notes
TabStripdoesn't offer it and pulling in a docking framework was too much churn for this pass. Easy to add later if wanted.SelectedClipnow also fire when the preview slot swaps its clip in place.Closes #160