Skip to content

feat: modern editor UI with Tokyo Night theme and enhanced animations - #27

Merged
unhappychoice merged 6 commits into
mainfrom
feat/modern-editor-ui-18
Nov 10, 2025
Merged

unhappychoice merged 6 commits into
mainfrom
feat/modern-editor-ui-18

Conversation

@unhappychoice

@unhappychoice unhappychoice commented Nov 10, 2025 •

Copy link
Copy Markdown
Owner

close: #18

Summary

  • Centralized Tokyo Night theme system for consistent color management
  • Enhanced editor UI with distance-based opacity and cursor line highlighting
  • File open dialog animation with typing effect
  • Eased cursor movement with cubic easing function
  • Background colors and padding for all panes
  • Fix: removed go.mod from excluded files

Test plan

  • Run the application and verify Tokyo Night theme colors are applied
  • Check that cursor line has proper highlighting with background color
  • Verify distance-based opacity fading around cursor line
  • Test file open dialog animation appears when switching files
  • Confirm cursor movement uses smooth easing animation
  • Verify all panes have proper background colors and padding
  • Check that go.mod files are now shown in diffs

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Introduced a theming system with Tokyo Night color scheme
    • Added smooth, eased cursor movement animations
    • Enhanced file open dialog with multi-step character-by-character typing flow
    • Improved time-travel/state restore so commit metadata, file buffers, and dialogs apply consistently
  • Style

    • Redesigned UI with a left-right split layout
    • Applied consistent theme-aware styling across editor, file tree, terminal, and status bar
    • Updated terminal prompt symbol to "~ "

unhappychoice and others added 5 commits November 10, 2025 14:38
- Add Theme struct with all UI colors (Tokyo Night inspired)
- Move syntax highlight colors from individual files to theme
- Make theme accessible throughout the application
- Update syntax module to use theme colors

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Add distinct background colors for left (darker) and right sides
- Remove vertical separator (background distinction is sufficient)
- Add padding to all panes (horizontal: 2, vertical: 1)
- Update dialog styling with proper padding
- Fix terminal content height to account for padding

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Add OpenFileDialogStart and DialogTypeChar animation steps
- Implement file open dialog with typing animation
- Add eased cursor movement with ease_in_out_cubic function
- Store and apply metadata with ResetState step
- Adjust terminal prompt symbol to "~ "
- Remove CURSOR_MOVE_END_PAUSE constant

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
go.mod should not be excluded from diff display as it's an important
dependency management file that should be tracked.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
…ghting

- Add distance-based opacity for lines around cursor (fade from 1.0 to 0.6)
- Implement cursor line highlighting with theme background color
- Add horizontal padding (2 spaces) on left and right
- Fill cursor line to full width with background color
- Apply opacity blending for non-cursor lines
- Update separator styling and line number rendering
- Use theme colors throughout instead of hardcoded colors
- Add wrap support to Paragraph widget

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 10, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

Implements a Theme system and applies it across panes; restructures UI layout to left/right columns; adds dialog typing animation and easing-based cursor movement; extends AnimationEngine with dialog and pending/current commit metadata and applies pending metadata on ResetState; changes terminal prompt to "~ ".

Changes

Cohort / File(s) Summary
Theme module
src/theme.rs, src/lib.rs, src/main.rs
Add Theme struct with many public color fields, Default -> tokyo_night(); expose pub mod theme in crate root and import in main.rs.
Animation engine
src/animation.rs
Add OpenFileDialogStart and DialogTypeChar steps; replace fixed end-pause with ease-in-out cubic cursor interpolation and per-step timing; add dialog_title, dialog_typing_text, pending_metadata, current_metadata fields; queue ResetState during time-travel and apply pending metadata on reset; clear dialog on file switch; add current_metadata() accessor.
Editor pane
src/panes/editor.rs
render signature now takes &Theme; add distance-based opacity, cursor-line fill, theme-aware colors for line numbers, separators, cursor char; extend HighlightContext with is_cursor_line, theme, distance_opacity; update helper signatures and add apply_opacity.
File tree pane
src/panes/file_tree.rs
render and build_tree_lines accept &Theme and area width; replace hardcoded colors with theme fields; themed full-line background for current file and right-edge padding fill.
Terminal pane
src/panes/terminal.rs
render now takes &Theme; use theme.terminal_* colors; change prompt detection from "$ " to "~ "; block uses padding and theme background; update line composition/wrapping.
Status bar pane
src/panes/status_bar.rs
render now takes &Theme; show multi-line themed metadata (hash, author, date, message) or themed "No commit loaded"; replace borders with padded themed block and styled spans.
UI / layout
src/ui.rs
Add theme: Theme, remove stored metadata; reorganize layout to left/right split with nested vertical sections; update pane render calls to pass theme; add dialog overlay rendering when engine provides title/text.
Syntax colors
src/syntax/mod.rs
TokenType::color signature updated to color(&self, theme: &Theme) and now returns theme-based colors.
Tests
src/git.rs
Remove test assertion requiring go.mod exclusion (test update only).

Sequence Diagram(s)

sequenceDiagram
    participant Engine as AnimationEngine
    participant UI as UI
    participant Editor as EditorPane
    participant Terminal as TerminalPane
    participant FileTree as FileTreePane

    rect rgb(230,245,255)
    Note over Engine: Open File Dialog Flow
    UI->>Engine: trigger OpenFileDialogStart(file_path)
    Engine->>Engine: set dialog_title, enqueue DialogTypeChar* (per char)
    Engine->>UI: expose dialog_title & dialog_typing_text
    UI->>UI: render dialog overlay (theme)
    end

    rect rgb(245,255,235)
    Note over Engine: Cursor Movement (eased)
    Engine->>Engine: compute eased positions (ease-in-out cubic)
    loop per animation frame
        Engine->>UI: update cursor position
        UI->>Editor: render(theme)
    end
    end

    rect rgb(255,240,240)
    Note over Engine: Time-travel Reset
    UI->>Engine: load_commit(...)
    Engine->>Engine: store pending_metadata, enqueue ResetState
    Engine->>Engine: ResetState -> apply pending_metadata, reset buffers, activate terminal
    Engine->>FileTree: render(theme, current_metadata)
    Engine->>Editor: render(theme)
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

  • Areas needing extra attention:
    • AnimationEngine: correctness of pending → current metadata application and ResetState ordering.
    • Easing implementation: verify interpolation, step timing, and frame-rate independence.
    • Theme field choices across panes: ensure semantic mapping (e.g., terminal vs. status colors) and no regressions in contrast/visibility.
    • Editor opacity/blending logic and highlight precedence (cursor char vs. token highlights).

Possibly related PRs

Poem

🐰 In Tokyo-night hues I hop and write,
Keys ease in, the cursor glows so bright.
Dialogs type, commits drift through air,
Lines fade softly — a rabbit's stare.
Theme stitched, screensaver hums with light. ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main changes: introducing a Tokyo Night theme system, modernizing the editor UI, and adding enhanced animations (easing-based cursor movement, file dialog animations).
Linked Issues check ✅ Passed The PR successfully addresses all major objectives from issue #18: modern editor-like UI with cleaner layout [18], refined display content showing commit metadata [18], enhanced animations including dialog typing and cursor easing [18], and a Tokyo Night theme system [18].
Out of Scope Changes check ✅ Passed All changes are scoped to the stated objectives: theme system implementation, UI/UX modernization, animation enhancements, and removing go.mod exclusion. No unrelated or extraneous modifications detected.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/modern-editor-ui-18

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/ui.rs (1)

254-299: Consider simplifying dialog sizing logic.

The manual width/height calculation and padding logic is functional but could be simplified. The current approach correctly handles edge cases with saturating_sub.

Optional refactor to improve maintainability:

// Define constants for dialog sizing
const MIN_DIALOG_WIDTH: u16 = 60;
const DIALOG_MARGIN: usize = 10;
const DIALOG_CHROME: usize = 4; // borders(2) + padding(2)

let dialog_width = (text.len() + DIALOG_MARGIN)
    .max(MIN_DIALOG_WIDTH as usize)
    .min(size.width.saturating_sub(4) as usize) as u16;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2ec349f and 726cb3e.

📒 Files selected for processing (11)
  • src/animation.rs (11 hunks)
  • src/git.rs (0 hunks)
  • src/lib.rs (1 hunks)
  • src/main.rs (1 hunks)
  • src/panes/editor.rs (11 hunks)
  • src/panes/file_tree.rs (3 hunks)
  • src/panes/status_bar.rs (1 hunks)
  • src/panes/terminal.rs (2 hunks)
  • src/syntax/mod.rs (2 hunks)
  • src/theme.rs (1 hunks)
  • src/ui.rs (6 hunks)
💤 Files with no reviewable changes (1)
  • src/git.rs
🧰 Additional context used
🧬 Code graph analysis (6)
src/ui.rs (1)
src/animation.rs (2)
  • new (49-63)
  • new (215-245)
src/panes/file_tree.rs (2)
src/syntax/mod.rs (3)
  • default (211-213)
  • new (87-96)
  • color (29-45)
src/ui.rs (1)
  • new (46-62)
src/panes/status_bar.rs (4)
src/panes/editor.rs (1)
  • render (30-63)
src/panes/file_tree.rs (1)
  • render (18-47)
src/panes/terminal.rs (1)
  • render (14-78)
src/ui.rs (2)
  • render (172-300)
  • new (46-62)
src/animation.rs (1)
src/ui.rs (1)
  • new (46-62)
src/panes/editor.rs (5)
src/panes/file_tree.rs (1)
  • render (18-47)
src/panes/status_bar.rs (1)
  • render (14-72)
src/panes/terminal.rs (1)
  • render (14-78)
src/ui.rs (2)
  • render (172-300)
  • new (46-62)
src/syntax/mod.rs (3)
  • default (211-213)
  • new (87-96)
  • color (29-45)
src/panes/terminal.rs (5)
src/panes/editor.rs (1)
  • render (30-63)
src/panes/file_tree.rs (1)
  • render (18-47)
src/panes/status_bar.rs (1)
  • render (14-72)
src/ui.rs (2)
  • render (172-300)
  • new (46-62)
src/animation.rs (2)
  • new (49-63)
  • new (215-245)
🔇 Additional comments (28)
src/theme.rs (2)

61-65: LGTM!

Clean delegation to tokyo_night() ensures consistent default theme initialization.


67-127: LGTM!

The Tokyo Night color palette is well-structured and comprehensive. All color values are clearly commented and organized by category, providing good coverage for the UI elements and syntax highlighting.

src/main.rs (1)

5-5: LGTM!

The theme module declaration is correctly placed and enables theme system integration across the codebase.

src/lib.rs (1)

1-2: LGTM!

The public theme module declaration correctly exposes the Theme system for use across the crate and by external consumers.

src/syntax/mod.rs (2)

3-3: LGTM!

The Theme import is necessary for the theme-based color method signature.


29-45: LGTM! Theme-based syntax coloring is properly implemented.

The method signature change from fn color(&self) -> Color to fn color(&self, theme: &Theme) -> Color is a breaking API change, but it's necessary and well-aligned with the PR's objective to introduce a centralized theme system. All token types now correctly delegate to their corresponding theme color fields.

src/panes/status_bar.rs (4)

2-9: LGTM!

Import changes correctly support the theme-based rendering and updated widget usage (Padding, Wrap, Span).


14-28: LGTM! Clean padding-based layout aligns with modern editor aesthetics.

The render signature now accepts a &Theme parameter, enabling consistent theming. The block style uses theme.background_left and uniform padding, moving away from border-heavy designs as intended by PR objectives.


30-65: LGTM! Enhanced commit metadata display improves information visibility.

The multi-line rendering of commit metadata (hash, author, date, and message) with theme-based styling is a significant UX improvement. Filtering empty message lines (lines 50-57) keeps the display clean. The "No commit loaded" fallback is also properly themed.


67-72: LGTM!

The paragraph rendering with Wrap { trim: false } is consistent with other panes and ensures proper text wrapping behavior.

src/ui.rs (2)

23-23: LGTM! Clean theme integration.

The Theme system is properly integrated into the UI struct with sensible defaults.

Also applies to: 42-42, 60-60


175-208: LGTM! Clean layout restructuring.

The two-column layout with proper separators aligns well with the modern editor UI objectives.

src/panes/terminal.rs (2)

2-2: LGTM! Theme integration matches pattern across panes.

The render signature is now consistent with other panes (editor, file_tree, status_bar).

Also applies to: 14-14


39-67: LGTM! Terminal rendering properly themed.

The command line detection ("~ ") is consistent with the prompt generation in animation.rs, and theme colors are correctly applied to commands, cursor, and output.

src/panes/file_tree.rs (3)

2-2: LGTM! Consistent theme integration.

Theme styling and padding are applied consistently across all panes.

Also applies to: 24-24, 27-33


59-65: LGTM! Clear status-to-color mapping.

The file status colors are properly themed and semantically meaningful.


133-173: LGTM! Excellent current-file highlighting.

The background fill calculation properly extends the highlight to the right edge, creating a clean visual indicator for the current file.

src/animation.rs (6)

148-160: LGTM! Clear animation step semantics.

The new variants cleanly model the file-open dialog and state reset behaviors.


204-212: LGTM! Well-designed state separation.

The pending/current metadata pattern cleanly handles the time-travel animation sequence without race conditions.


251-254: LGTM! Clean accessor.

The accessor provides safe read-only access to current metadata.


277-321: LGTM! Proper metadata lifecycle.

The pending metadata is correctly stored before time-travel animation and applied via ResetState, ensuring proper sequencing.


502-567: LGTM! Smooth easing-based cursor movement.

The cubic easing function with duplicate-position filtering creates smooth cursor animation with proper acceleration/deceleration. The distance-based speed multipliers are well-calibrated.


842-852: LGTM! Clean state reset.

ResetState correctly applies pending metadata and resets UI state while preserving terminal history.

src/panes/editor.rs (5)

16-16: LGTM! Context properly extended for theme-aware rendering.

The added fields enable distance-based opacity and cursor line styling.

Also applies to: 25-26


77-85: LGTM! Excellent distance-based opacity.

The opacity gradient (1.0 → 0.6 over 20 lines) creates a nice focus effect around the cursor line without being too aggressive.


362-373: LGTM! Correct alpha blending implementation.

The linear interpolation formula properly blends foreground and background colors based on opacity.


145-166: LGTM! Proper cursor line highlighting.

The background fill calculation correctly accounts for all line components and extends the highlight to the right edge.


301-331: LGTM! Well-structured color application.

The three-tier styling (cursor character, cursor line, normal) is properly implemented with correct opacity blending.

Comment thread src/theme.rs Resolved
Comment thread src/ui.rs Resolved
Editor area is 70% (right column) × 80% (editor pane) = 56% of total
height, not 80% × 80% = 64%. This fixes scroll calculations.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 726cb3e and 0704580.

📒 Files selected for processing (1)
  • src/ui.rs (6 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/ui.rs (1)
src/animation.rs (2)
  • new (49-63)
  • new (215-245)
🔇 Additional comments (5)
src/ui.rs (5)

9-12: LGTM! New imports support dialog rendering and theme integration.

The added imports (Rect, Style, Line, Span, and Theme) are all used appropriately in the new dialog rendering logic and theme-based styling.

Also applies to: 23-23


42-42: LGTM! Theme centralization aligns with PR objectives.

The Theme field is properly initialized and will be passed to all render calls, enabling consistent color management across the UI.

Also applies to: 60-60


108-112: Past issue resolved: viewport height now correctly matches layout.

The viewport height calculation has been fixed to use 0.70 × 0.80 = 56%, which correctly matches the actual editor area (70% right column × 80% editor within that column). This addresses the critical issue raised in the previous review.


175-208: LGTM! Layout restructure achieves modern editor-like appearance.

The horizontal split with nested vertical layouts creates a professional, modern editor-style UI as per the PR objectives. The layout percentages are consistent and properly calculated.


210-253: LGTM! Consistent theme integration across all panes.

The separator rendering and updated render calls properly integrate the theme system. All panes receive theme and metadata where appropriate, ensuring visual consistency.

Comment thread src/ui.rs Resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Significantly improve UI/UX to make it more like a modern editor

1 participant