mirror of
https://github.com/anomalyco/opentui.git
synced 2026-04-25 13:06:00 +03:00
[PR #621] feat(diff): add SlottableDiff #664
Labels
No labels
bug
core
documentation
feature
good first issue
help wanted
pull-request
question
react
solid
tmux
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/opentui#664
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/anomalyco/opentui/pull/621
Author: @ishaksebsib
Created: 2/3/2026
Status: 🔄 Open
Base:
main← Head:feat/slottableDiff📝 Commits (6)
4dcb052feat(diff): add interactive diff with slot support69dfb1efeat(examples): add example for interactive diff using SlottableDiffbf4130fperf(core): optimize SlottableDiff with surgical slot updates74dd8bffix(diff): ensure syntax-highlighted lines fill full background09dc50cperf(diff): add virtualization when enabled only visible diifs are rendered85eab04feat(diff): support wrapMode📊 Changes
7 files changed (+1763 additions, -30 deletions)
View changed files
📝
packages/core/src/renderables/Diff.ts(+30 -30)➕
packages/core/src/renderables/DiffLine.ts(+465 -0)➕
packages/core/src/renderables/SlottableDiff.ts(+959 -0)📝
packages/core/src/renderables/index.ts(+2 -0)📝
packages/solid/examples/components/ExampleSelector.tsx(+9 -0)➕
packages/solid/examples/components/interactive-diff-demo.tsx(+294 -0)📝
packages/solid/src/elements/index.ts(+4 -0)📄 Description
Summary
Adds a new
SlottableDiffRenderablecomponent that renders each diff line as a separate interactive element, enabling slots for inline content like comment boxes.Why
The existing
DiffRenderablecomponent renders the entire diff as a monolithicCodeRenderable, which provides excellent performance for viewing but doesn't allow for interactivity. Each line is just part of a large text buffer with no individual identity or click handling.Changes
DiffLineRenderablecomponent for individual diff lines with click support, line numbers, and syntax highlightingSlottableDiffRenderablethat extendsDiffRenderablewithinsertSlot()/removeSlot()/onLineClickmethods for injecting arbitrary content between linesprotectedto enable inheritance by SlottableDiffinteractive-diff-demo.tsxexamples showing click-to-comment functionality *interactive using the portal patternFeatures
onLineClickcallbackPerformance
virtualizeis enabled, only the visible range is rendered with configurableoverscanpadding._visualRowsarray and usesinsertBefore()to place slots at the exact position (O(1) operation)insertSlot()checks if the slot already exists and only performs manipulation when necessaryExample Use Case
Interactive code review where users can click on diff lines to add inline comments, similar to GitHub's PR review interface.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.