Skip to content

feat(tui): add terminal highlighting improvements#391

Merged
CSRessel merged 7 commits intomainfrom
feature/terminal-highlighting
Mar 24, 2026
Merged

feat(tui): add terminal highlighting improvements#391
CSRessel merged 7 commits intomainfrom
feature/terminal-highlighting

Conversation

@CSRessel
Copy link
Copy Markdown
Collaborator

@CSRessel CSRessel commented Mar 24, 2026

Summary

  • Diff rendering: Shaded green/red backgrounds via terminal color level detection (truecolor/256-color/ANSI-16) with light/dark theme awareness. Gracefully falls back to foreground-only colors on basic terminals.
  • Syntax highlighting: Replace tree-sitter-bash with syntect+two-face for multi-language theme-aware highlighting (~250 languages, Catppuccin Mocha default). Used in both bash command rendering and markdown fenced code blocks.
  • Markdown rendering: Fenced code block syntax highlighting with language detection from info strings, local file link rendering with cwd-relative paths, and URL-preserving adaptive word wrapping.

Test plan

  • 1024 nori-tui tests pass (1023 unit + 1 integration), 0 failures
  • 0 clippy warnings (cargo clippy -p nori-tui --all-features --tests)
  • just fmt clean
  • Self-review: fixed panic-on-malformed-code, simplified RwLock to OnceLock, removed orphaned workspace dep
  • CI passes
  • E2E tests pass (cargo test -p tui-pty-e2e)

CSRessel and others added 7 commits March 24, 2026 01:14
Port three TUI rendering improvements:

1. Diff rendering: shaded green/red backgrounds via terminal color level
   detection (truecolor/256-color/ansi16) with light/dark theme awareness.
   Falls back to foreground-only colors on ANSI-16 terminals.

2. Syntax highlighting: replace tree-sitter-bash with syntect+two-face
   for multi-language theme-aware highlighting (~250 languages, Catppuccin
   Mocha default). Used in both bash command rendering and markdown fenced
   code blocks.

3. Markdown rendering: fenced code block syntax highlighting with language
   detection from info strings, local file link rendering with cwd-relative
   paths, and URL-preserving adaptive word wrapping.
🤖 Generated with [Nori](https://noriagentic.com)

Co-Authored-By: Nori <contact@tilework.tech>
- Update rustls-webpki 0.103.4 -> 0.103.10 (RUSTSEC-2026-0049)
- Ignore RUSTSEC-2026-0002 (lru 0.12.x pinned by ratatui fork)
🤖 Generated with [Nori](https://noriagentic.com)

Co-Authored-By: Nori <contact@tilework.tech>
Apply the background color to gutter spans and pad each diff line with
trailing spaces to fill the complete rendering width. This ensures the
green/red tint covers from left edge to right edge, not just behind
the text content.
🤖 Generated with [Nori](https://noriagentic.com)

Co-Authored-By: Nori <contact@tilework.tech>
The background tint now covers the complete line from left to right:
- prefix_lines propagates Line background color onto prefix spans
- push_wrapped_diff_line pads to width + outer_pad so trailing space
  accounts for the 4-char indent that prefix_lines will prepend
🤖 Generated with [Nori](https://noriagentic.com)

Co-Authored-By: Nori <contact@tilework.tech>
@CSRessel CSRessel merged commit 49000b0 into main Mar 24, 2026
3 checks passed
@CSRessel CSRessel deleted the feature/terminal-highlighting branch March 24, 2026 18:56
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.

1 participant