chore(conductor): Add new track 'Advanced Text Viewer with Syntax Highlighting'
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
# Track text_viewer_rich_rendering_20260313 Context
|
||||
|
||||
- [Specification](./spec.md)
|
||||
- [Implementation Plan](./plan.md)
|
||||
- [Metadata](./metadata.json)
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"track_id": "text_viewer_rich_rendering_20260313",
|
||||
"type": "feature",
|
||||
"status": "new",
|
||||
"created_at": "2026-03-13T14:22:00Z",
|
||||
"updated_at": "2026-03-13T14:22:00Z",
|
||||
"description": "Make the text viewer support syntax highlighting and markdown for different text types. Whatever feeds the text viewer new context must specify the type to use otherwise fallback to just regular text visualization without highlighting or markdown rendering."
|
||||
}
|
||||
29
conductor/tracks/text_viewer_rich_rendering_20260313/plan.md
Normal file
29
conductor/tracks/text_viewer_rich_rendering_20260313/plan.md
Normal file
@@ -0,0 +1,29 @@
|
||||
# Implementation Plan: Advanced Text Viewer with Syntax Highlighting
|
||||
|
||||
## Phase 1: State & Interface Update
|
||||
- [ ] Task: Audit `src/gui_2.py` to ensure all `text_viewer_*` state variables are explicitly initialized in `App.__init__`.
|
||||
- [ ] Task: Implement: Update `App.__init__` to initialize `self.show_text_viewer`, `self.text_viewer_title`, `self.text_viewer_content`, and new `self.text_viewer_type` (defaulting to "text").
|
||||
- [ ] Task: Implement: Update `self.text_viewer_wrap` (defaulting to True) to allow independent word wrap.
|
||||
- [ ] Task: Implement: Update `_render_text_viewer(self, label: str, content: str, text_type: str = "text")` signature and caller usage.
|
||||
- [ ] Task: Conductor - User Manual Verification 'Phase 1: State & Interface Update' (Protocol in workflow.md)
|
||||
|
||||
## Phase 2: Core Rendering Logic (Code & MD)
|
||||
- [ ] Task: Write Tests: Create a simulation test in `tests/test_gui_text_viewer.py` to verify the viewer opens and switches rendering paths based on `text_type`.
|
||||
- [ ] Task: Implement: In `src/gui_2.py`, refactor the text viewer window loop to:
|
||||
- Use `MarkdownRenderer.render` if `text_type == "markdown"`.
|
||||
- Use a cached `ImGuiColorTextEdit.TextEditor` if `text_type` matches a code language.
|
||||
- Fallback to `imgui.input_text_multiline` for plain text.
|
||||
- [ ] Task: Implement: Ensure the `TextEditor` instance is properly cached using a unique key for the text viewer to maintain state.
|
||||
- [ ] Task: Conductor - User Manual Verification 'Phase 2: Core Rendering Logic' (Protocol in workflow.md)
|
||||
|
||||
## Phase 3: UI Features (Copy, Line Numbers, Wrap)
|
||||
- [ ] Task: Write Tests: Update `tests/test_gui_text_viewer.py` to verify the copy-to-clipboard functionality and word wrap toggle.
|
||||
- [ ] Task: Implement: Add a "Copy" button to the text viewer title bar or a small toolbar at the top of the window.
|
||||
- [ ] Task: Implement: Add a "Word Wrap" checkbox inside the text viewer window.
|
||||
- [ ] Task: Implement: Configure the `TextEditor` instance to show line numbers and be read-only.
|
||||
- [ ] Task: Conductor - User Manual Verification 'Phase 3: UI Features' (Protocol in workflow.md)
|
||||
|
||||
## Phase 4: Integration & Rollout
|
||||
- [ ] Task: Implement: Update all existing calls to `_render_text_viewer` in `src/gui_2.py` (e.g., in `_render_files_panel`, `_render_tool_calls_panel`) to pass the correct `text_type` based on file extension or content.
|
||||
- [ ] Task: Implement: Add "Markdown Preview" support for system prompt presets using the new text viewer logic.
|
||||
- [ ] Task: Conductor - User Manual Verification 'Phase 4: Integration & Rollout' (Protocol in workflow.md)
|
||||
30
conductor/tracks/text_viewer_rich_rendering_20260313/spec.md
Normal file
30
conductor/tracks/text_viewer_rich_rendering_20260313/spec.md
Normal file
@@ -0,0 +1,30 @@
|
||||
# Specification: Advanced Text Viewer with Syntax Highlighting
|
||||
|
||||
## Overview
|
||||
Enhance the existing "Text Viewer" popup panel in the Manual Slop GUI to support rich rendering, including syntax highlighting for various code types and Markdown rendering. The viewer will transition from a basic text/multiline input to a specialized component leveraging the project's hybrid rendering pattern.
|
||||
|
||||
## Functional Requirements
|
||||
- **Rich Rendering Support:**
|
||||
- **Code:** Integration with `ImGuiColorTextEdit` for syntax highlighting (Python, PowerShell, JSON, TOML, etc.).
|
||||
- **Markdown:** Integration with `imgui_markdown` for rendering formatted text and documents.
|
||||
- **Fallback:** Plain text rendering for unknown or unspecified types.
|
||||
- **Explicit Type Specification:**
|
||||
- The component/function triggering the viewer (e.g., `_render_text_viewer`) must provide an explicit `text_type` parameter (e.g., "python", "markdown", "text").
|
||||
- **Enhanced UI Features:**
|
||||
- **Line Numbers:** Display line numbers in the gutter when viewing code.
|
||||
- **Copy Button:** A dedicated button to copy the entire content to the clipboard.
|
||||
- **Independent Word Wrap:** A toggle within the viewer window to enable/disable word wrapping specifically for that instance, overriding the global GUI setting if necessary.
|
||||
- **Persistent Sizing:** The viewer should maintain its size/position via ImGui's standard `.ini` persistence.
|
||||
|
||||
## Technical Implementation
|
||||
- Update `App` state in `src/gui_2.py` to store `text_viewer_type`.
|
||||
- Modify `_render_text_viewer` signature to accept `text_type`.
|
||||
- Update the rendering loop in `_gui_func` to switch between `MarkdownRenderer` logic and `TextEditor` logic based on `text_viewer_type`.
|
||||
- Ensure proper caching of `TextEditor` instances to maintain scroll position and selection state while the viewer is open.
|
||||
|
||||
## Acceptance Criteria
|
||||
- [ ] Clicking a preview button for a Python file opens the viewer with syntax highlighting and line numbers.
|
||||
- [ ] Clicking a preview for a `.md` file renders it as formatted Markdown.
|
||||
- [ ] The "Copy" button correctly copies text to the OS clipboard.
|
||||
- [ ] The word wrap toggle works immediately without affecting other panels.
|
||||
- [ ] Unsupported types gracefully fall back to standard plain text.
|
||||
Reference in New Issue
Block a user