-
Notifications
You must be signed in to change notification settings - Fork 71
Open
Description
Currently, doxx copies entire views (full document, complete outline, or all search
results) when using the copy functionality (c
key). Users often want to copy just
specific portions of text, making the current all-or-nothing approach less practical for
many use cases.
Proposed Solution
Implement text selection capabilities that allow users to select and copy specific portions
of document content.
Implementation Options
Option 1: Mouse Selection (Recommended)
- Interaction: Click and drag to select text
- Visual feedback: Highlight selected text with different background color
- Copy: Press
c
to copy selected text to clipboard - Pros: Intuitive, familiar to most users
- Cons: Requires mouse support, coordinate mapping complexity
Option 2: Keyboard Selection (Vim-like)
- Interaction:
- Press
v
to enter visual selection mode - Use arrow keys to expand/contract selection
- Press
c
orEnter
to copy selection - Press
Esc
to exit selection mode
- Press
- Visual feedback: Highlight selected text
- Pros: Keyboard-only workflow, familiar to vim users
- Cons: Learning curve for non-vim users
Option 3: Line-based Selection
- Interaction:
- Press
Shift + ↑/↓
to select entire lines/paragraphs - Press
c
to copy selected lines
- Press
- Visual feedback: Highlight selected lines
- Pros: Simpler to implement, good for structured content
- Cons: Less granular than character-level selection
Technical Considerations
Challenges
- Coordinate mapping: Convert terminal grid coordinates back to document content
positions - Content types: Handle selection across headings, paragraphs, lists, and tables
- Text wrapping: Manage selection across wrapped lines
- Visual rendering: Implement selection highlighting in ratatui
- Multi-view support: Selection behavior in Document, Outline, and Search views
Implementation Details
- Extend
App
struct with selection state (selection_start
,selection_end
,
selection_active
) - Add selection rendering in UI components
- Modify copy functionality to use selected text when available
- Handle edge cases (empty selection, invalid ranges, etc.)
User Experience
Keyboard Shortcuts (Proposed)
v
- Enter visual selection mode (Option 2)c
- Copy selected text (or full view if no selection)Esc
- Clear selection / exit selection mode- Arrow keys - Expand/contract selection in visual mode
- Mouse drag - Select text (Option 1)
Visual Indicators
- Selected text highlighted with inverted colors or different background
- Status bar indicator when in selection mode
- Selection bounds clearly visible
Benefits
- Improved usability: Copy only what you need
- Better workflow: Reduce need to paste and then select in external apps
- Competitive advantage: Feature not available in basic document viewers
- Professional feel: Expected feature in modern terminal applications
Priority
Phase 3 - After AI integration is complete. This is a significant UX enhancement that
requires careful implementation but would greatly improve the user experience.
Acceptance Criteria
- Users can select text using chosen interaction method
- Selected text is visually highlighted
- Copy functionality works with selected text
- Selection works across all view modes (Document, Outline, Search)
- Selection handles different content types (headings, paragraphs, lists, tables)
- Clear visual feedback for selection state
- Intuitive keyboard shortcuts
- Proper handling of edge cases
Related Issues
- Depends on stable core functionality
- May interact with future search highlighting features
- Could integrate with planned vim-like navigation enhancements
Metadata
Metadata
Assignees
Labels
No labels