[PR #617] [MERGED] feat(DiffRenderable): expose line highlighting API #662

Closed
opened 2026-03-02 23:47:34 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/anomalyco/opentui/pull/617
Author: @3000-2
Created: 2/2/2026
Status: Merged
Merged: 2/17/2026
Merged by: @kommander

Base: mainHead: feat/diff-line-highlight-api


📝 Commits (8)

  • 28b43fc feat(DiffRenderable): expose line highlighting API
  • f2a8a92 test(DiffRenderable): add tests for line highlighting API
  • 3040a6c perf(LineNumberRenderable): batch line color updates to reduce re-renders
  • 26e24b3 Merge branch 'main' into feat/diff-line-highlight-api
  • 3a8527a Merge branch 'main' into feat/diff-line-highlight-api
  • 93421c8 Merge branch 'main' into feat/diff-line-highlight-api
  • 79bd869 Merge branch 'main' into feat/diff-line-highlight-api
  • 9a51527 Merge branch 'main' into feat/diff-line-highlight-api

📊 Changes

4 files changed (+199 additions, -0 deletions)

View changed files

📝 packages/core/src/renderables/Diff.test.ts (+73 -0)
📝 packages/core/src/renderables/Diff.ts (+30 -0)
📝 packages/core/src/renderables/LineNumberRenderable.ts (+19 -0)
📝 packages/core/src/renderables/__tests__/LineNumberRenderable.test.ts (+77 -0)

📄 Description

Summary

Add public methods to DiffRenderable for controlling line colors from external code:

Motivation

These methods enable use cases like highlighting the "current hunk" in a diff viewer application. The internal LineNumberRenderable already supports line coloring - this PR simply exposes that capability through the public DiffRenderable API.

Example Usage

// Highlight lines 10-20 with a custom color
diffRenderable.highlightLines(10, 20, "#3a3a5c")

// Clear the highlight
diffRenderable.clearHighlightLines(10, 20)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/anomalyco/opentui/pull/617 **Author:** [@3000-2](https://github.com/3000-2) **Created:** 2/2/2026 **Status:** ✅ Merged **Merged:** 2/17/2026 **Merged by:** [@kommander](https://github.com/kommander) **Base:** `main` ← **Head:** `feat/diff-line-highlight-api` --- ### 📝 Commits (8) - [`28b43fc`](https://github.com/anomalyco/opentui/commit/28b43fcccda3371086310474ac296a25e3f0588a) feat(DiffRenderable): expose line highlighting API - [`f2a8a92`](https://github.com/anomalyco/opentui/commit/f2a8a9235076691403d9b7df4f1135f551f12bc3) test(DiffRenderable): add tests for line highlighting API - [`3040a6c`](https://github.com/anomalyco/opentui/commit/3040a6cf11eb8ac515bd261c9c7d5b4cbbaf2007) perf(LineNumberRenderable): batch line color updates to reduce re-renders - [`26e24b3`](https://github.com/anomalyco/opentui/commit/26e24b3e2bdf329e3a77d9e14bdee460daea3b91) Merge branch 'main' into feat/diff-line-highlight-api - [`3a8527a`](https://github.com/anomalyco/opentui/commit/3a8527abec7dc6ada1ec987a9e9d4f5bce0d9134) Merge branch 'main' into feat/diff-line-highlight-api - [`93421c8`](https://github.com/anomalyco/opentui/commit/93421c8c22528e00021596fe99e66664bd0d43d8) Merge branch 'main' into feat/diff-line-highlight-api - [`79bd869`](https://github.com/anomalyco/opentui/commit/79bd869650c5bd3ec46d86ccfdf37d89bdcd0e93) Merge branch 'main' into feat/diff-line-highlight-api - [`9a51527`](https://github.com/anomalyco/opentui/commit/9a515270f2a67e94acec3bf567bb0dd571d69d04) Merge branch 'main' into feat/diff-line-highlight-api ### 📊 Changes **4 files changed** (+199 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/core/src/renderables/Diff.test.ts` (+73 -0) 📝 `packages/core/src/renderables/Diff.ts` (+30 -0) 📝 `packages/core/src/renderables/LineNumberRenderable.ts` (+19 -0) 📝 `packages/core/src/renderables/__tests__/LineNumberRenderable.test.ts` (+77 -0) </details> ### 📄 Description ## Summary Add public methods to `DiffRenderable` for controlling line colors from external code: ## Motivation These methods enable use cases like highlighting the "current hunk" in a diff viewer application. The internal `LineNumberRenderable` already supports line coloring - this PR simply exposes that capability through the public `DiffRenderable` API. ## Example Usage ```typescript // Highlight lines 10-20 with a custom color diffRenderable.highlightLines(10, 20, "#3a3a5c") // Clear the highlight diffRenderable.clearHighlightLines(10, 20) ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-02 23:47:34 +03:00
Sign in to join this conversation.
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
starred/opentui#662
No description provided.