Improvements v0.0.2 #1

Closed
rdenadai wants to merge 0 commits from feature/editor-improvements into main
Owner
No description provided.
- Add theme module with 4 built-in themes: One Dark Pro, Dracula, Monokai Pro, Catppuccin Mocha
- Replace all hardcoded colors in editor.slint and main.slint with theme properties
- Add command palette modal (Ctrl+P) with search filtering
- Wire theme switching: palette -> Rust -> Slint color properties + syntax colors
- Persist selected theme to config (settings.json)
- Default theme: One Dark Pro
- Fix calc-line: use floor instead of round for accurate line hit-testing
- Fix calc-col: clamp to valid range with proper rounding
- Add double-click timeout (400ms Timer) replacing fragile click-count
- Throttle drag updates: only update selection when line/col changes
- Current-line highlight now reactive (line-idx == cursor-line) in Slint
- Remove refresh_styled_lines from click/selection/double-click handlers
- Optimize select_word_at: use byte-level iteration instead of Vec<char>
- Use floor(x / char-width) instead of round(x / char-width - 0.5)
- Clicking anywhere within a character cell now places cursor at that column
- round(x / char-width) places cursor at nearest character boundary
- Left half of char -> cursor before it, right half -> cursor after it
- Before first char shows Col 0, on first char shows Col 1, etc.
- Line remains 1-indexed (Ln 1 for first line)
- Clicking anywhere on a character places cursor at its left edge
- Fixes inability to position cursor before first character on a line
- Selection now highlights only the selected characters, not entire lines
- Selection overlay positioned using char-width * column offsets
- Current-line highlight suppressed only on lines with active selection
- Normalized selection direction (start <= end) for consistent rendering
- Removed unused is-in-selection function
Selection highlighting is now embedded in styled text spans instead of
using absolute-positioned overlays. Each StyledSegment has a 'selected'
field, and spans are split at selection column boundaries during
build_styled_lines. This eliminates char-width accumulation errors that
caused selection highlighting to drift by 2-3px over long lines.

- Add split_segments_for_selection() for column-accurate span splitting
- Add selection-drag callback for real-time selection during mouse drag
- Refresh styled lines on click (clear), drag (update), and double-click
- Add get_normalized_selection() helper for extracting selection state
- Add max-column field to EditorConfig (default: 120)
- Display vertical ruler line at max-column position
- Implement auto-wrap on space when exceeding max-column
- Increase cursor width from 2px to 3px for better visibility
rdenadai closed this pull request 2026-02-08 13:06:26 +00:00

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
rdenadai/ehwaz!1
No description provided.