Skip to content

Make diff pane selectable and jump to raw edit - #2227

Merged
Kitenite merged 21 commits into
mainfrom
kitenite/make-the-diff-pane-view-selectable-and-add-the-rig
Mar 8, 2026
Merged

Kitenite merged 21 commits into
mainfrom
kitenite/make-the-diff-pane-view-selectable-and-add-the-rig

Conversation

@Kitenite

@Kitenite Kitenite commented Mar 8, 2026 •

Copy link
Copy Markdown
Member

Summary

  • make the file viewer diff pane text selectable and add the pane right-click context menu there
  • handle diff double-click natively so raw view opens at the matching line and column for editing
  • preserve selected diff text by stopping the pane focus click when the browser still has an active diff selection
  • preserve updated line and column targets when reusing the same file viewer pane and cover the mapping with a focused unit test

Verification

  • bun test apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/components/FileViewerContent/utils/diff-location.test.ts
  • bunx biome check apps/desktop/src/renderer/screens/main/components/WorkspaceView/ChangesContent/components/LightDiffViewer/LightDiffViewer.tsx apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/FileViewerPane.tsx apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/components/FileViewerContent/FileViewerContent.tsx apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/components/FileViewerContent/utils/diff-location.ts apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/components/FileViewerContent/utils/diff-location.test.ts apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/components/DiffViewerContextMenu/DiffViewerContextMenu.tsx apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/components/DiffViewerContextMenu/index.ts apps/desktop/src/renderer/stores/tabs/store.ts
  • bun run typecheck --filter=@superset/desktop

Summary by CodeRabbit

  • New Features

    • Context menu added to the diff viewer with editor and pane actions.
    • Hover-to-highlight lines and double-click to jump from diff to the corresponding raw file location.
    • Location-aware view switching preserves line/column when moving between diff and raw views.
    • Text selection enabled inside diffs.
  • Tests

    • Added unit tests validating diff-to-raw position mapping.
  • Behavior

    • Preview pane now respects requested line/column when reusing an existing preview.

@coderabbitai

coderabbitai Bot commented Mar 8, 2026 •

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds diff hover events, DOM-to-raw-position mapping utilities and tests, a read-only diff context menu, wiring to open the raw file at a mapped location (including double-click), preview-pane location updates, and diff viewer CSS to allow text selection.

Changes

Cohort / File(s) Summary
LightDiffViewer (events & styling)
apps/desktop/src/renderer/screens/main/components/WorkspaceView/ChangesContent/components/LightDiffViewer/LightDiffViewer.tsx
Added onDiffLineEnter prop forwarded to MultiFileDiff via onLineEnter; added inline unsafeCSS to allow text selection.
Diff location utilities & tests
apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/components/FileViewerContent/utils/diff-location.ts, apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/components/FileViewerContent/utils/diff-location.test.ts
New utilities/types: mapDiffLocationToRawPosition, getColumnFromDiffSelection, getDiffLocationFromTarget, plus unit tests covering various mapping scenarios and column clamping.
Diff viewer context menu
apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/components/DiffViewerContextMenu/DiffViewerContextMenu.tsx, .../DiffViewerContextMenu/index.ts
New DiffViewerContextMenu component and barrel export providing read-only editor actions (copy/select), selection containment checks, clipboard/toast handling, and pane/tab action wiring.
FileViewerContent integration
apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/components/FileViewerContent/FileViewerContent.tsx
Wrapped diff rendering with DiffViewerContextMenu; added diffContainerRef, lastDiffLocationRef, handleDiffLineEnter, double-click → onSwitchToRawAtLocation, selection guards, and imported diff-location utilities.
FileViewerPane API & wiring
apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/FileViewerPane.tsx
switchToMode now accepts optional location?: { line?: number; column?: number }; added handleSwitchToRawAtLocation and passed onSwitchToRawAtLocation into FileViewerContent.
Preview pane update behavior
apps/desktop/src/renderer/stores/tabs/store.ts
When reusing a preview pane, treats options.line/options.column as reasons to update viewer state; computes nextViewMode and updates viewMode, initialLine, and initialColumn when appropriate.

Sequence Diagram

sequenceDiagram
    participant User
    participant LightDiffViewer
    participant FileViewerContent
    participant FileViewerPane
    participant DiffViewerContextMenu
    participant Editor

    User->>LightDiffViewer: hover on diff line
    LightDiffViewer->>FileViewerContent: onDiffLineEnter(event)
    FileViewerContent->>FileViewerContent: update lastDiffLocationRef

    User->>LightDiffViewer: double-click diff line
    LightDiffViewer->>FileViewerContent: onLineClick / double-click
    FileViewerContent->>FileViewerContent: mapDiffLocationToRawPosition(...)
    FileViewerContent->>FileViewerPane: onSwitchToRawAtLocation(line,column)
    FileViewerPane->>FileViewerPane: switchToMode("raw",{line,column})
    FileViewerPane->>Editor: render raw view at location
    Editor->>User: show raw editor at position

    User->>DiffViewerContextMenu: right-click diff container
    DiffViewerContextMenu->>DiffViewerContextMenu: validate selection, expose actions
    DiffViewerContextMenu->>User: display context menu
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 I hopped the hunks with nimble feet,
Traced line and side where deletions meet,
A double-click leapt me to the raw,
A quiet menu showed the actions I saw,
I nibbled columns neat and kept the selection sweet.

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description provides a clear summary of changes, verification steps, and commit messages but does not follow the provided template structure with Description, Related Issues, Type of Change, Testing, Screenshots, and Additional Notes sections. Restructure the description to match the repository template by adding the required sections (Description, Related Issues, Type of Change, Testing) and populating them with the relevant details from the current summary.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Make diff pane selectable and jump to raw edit' accurately and concisely summarizes the main changes: making the diff pane text selectable and enabling navigation to raw view.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch kitenite/make-the-diff-pane-view-selectable-and-add-the-rig

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.

@cubic-dev-ai cubic-dev-ai 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.

1 issue found across 8 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/components/FileViewerContent/utils/diff-location.ts">

<violation number="1" location="apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/components/FileViewerContent/utils/diff-location.ts:87">
P2: Context lines on the deletion side carry old-file line numbers, but this condition maps them directly to the modified file. When prior hunks have added or removed lines, the old line number no longer matches the new file position, causing the editor to jump to the wrong line on double-click.

The `lineType === "context"` check should not bypass the mapping when `side === "deletions"` — those lines still need old→new translation. One approach: extend `mapDeletedLineToRawLine` to track and match context lines, then simplify this condition to branch solely on `side`.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/components/FileViewerContent/utils/diff-location.ts`:
- Around line 40-75: The function mapDeletedLineToRawLine is treating
chunk.lines, chunk.deletions, and chunk.additions as arrays and calling .length,
but the `@pierre/diffs` types use numbers; fix by removing .length and using the
numeric values directly: when handling chunk.type === "context" increment
currentOldLine and currentNewLine by chunk.lines (number), change the deletion
loop to for (let index = 0; index < chunk.deletions; index += 1) (using
chunk.deletions as a number), and increment currentNewLine by chunk.additions
(number) instead of .length; keep the rest of the logic (parseDiffFromFile,
clampLineNumber, hunk iteration) unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4c58c6df-1731-4e15-8eb7-63f028a60e8d

📥 Commits

Reviewing files that changed from the base of the PR and between 699f3e4 and c0eebe6.

📒 Files selected for processing (8)
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ChangesContent/components/LightDiffViewer/LightDiffViewer.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/FileViewerPane.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/components/DiffViewerContextMenu/DiffViewerContextMenu.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/components/DiffViewerContextMenu/index.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/components/FileViewerContent/FileViewerContent.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/components/FileViewerContent/utils/diff-location.test.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/components/FileViewerContent/utils/diff-location.ts
  • apps/desktop/src/renderer/stores/tabs/store.ts

@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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/components/FileViewerContent/FileViewerContent.tsx (1)

166-190: ⚠️ Potential issue | 🟠 Major

Reset the initial-location guard when leaving Raw mode.

hasAppliedInitialLocationRef survives raw → diff/rendered → raw transitions. When viewMode is not "raw", CodeEditor unmounts (lines 330–577 early-return before the editor at line 595). When switching back to raw with unchanged initialLine/initialColumn, the guard remains true because it is only reset on file/cursor changes (lines 222–230), not on mode changes. The remounted editor then skips revealPosition at line 319, leaving the pane at the wrong scroll position.

Suggested fix
+useEffect(() => {
+	if (viewMode !== "raw") {
+		hasAppliedInitialLocationRef.current = false;
+	}
+}, [viewMode]);
+
 // biome-ignore lint/correctness/useExhaustiveDependencies: Reset cached diff interaction when the file changes
 useEffect(() => {
 	lastDiffLocationRef.current = null;
 }, [filePath]);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/components/FileViewerContent/FileViewerContent.tsx`
around lines 166 - 190, The hasAppliedInitialLocationRef guard persists across
viewMode transitions causing the remounted CodeEditor to skip revealPosition;
update the effects that reset hasAppliedInitialLocationRef (currently tied to
filePath and [initialLine, initialColumn]) to also reset when viewMode changes
back to "raw". Concretely, add viewMode to the dependency array (or add a
separate useEffect watching viewMode) and set
hasAppliedInitialLocationRef.current = false when viewMode === "raw" so that
CodeEditor (component referenced as CodeEditor and the revealPosition call) will
apply the initialLine/initialColumn on remount.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/components/FileViewerContent/FileViewerContent.tsx`:
- Around line 187-208: The ref lastDiffLocationRef is only reset when filePath
changes, but visual diff row indices can change when diffData,
hideUnchangedRegions, or diffViewMode change; update the useEffect that
currently depends on [filePath] (and its comment) to also depend on diffData,
hideUnchangedRegions, and diffViewMode (or any other prop used to compute the
rendered diff) so lastDiffLocationRef.current is cleared whenever the rendered
diff changes, ensuring getDiffSelectionLines() maps to a correct raw position.

---

Outside diff comments:
In
`@apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/components/FileViewerContent/FileViewerContent.tsx`:
- Around line 166-190: The hasAppliedInitialLocationRef guard persists across
viewMode transitions causing the remounted CodeEditor to skip revealPosition;
update the effects that reset hasAppliedInitialLocationRef (currently tied to
filePath and [initialLine, initialColumn]) to also reset when viewMode changes
back to "raw". Concretely, add viewMode to the dependency array (or add a
separate useEffect watching viewMode) and set
hasAppliedInitialLocationRef.current = false when viewMode === "raw" so that
CodeEditor (component referenced as CodeEditor and the revealPosition call) will
apply the initialLine/initialColumn on remount.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 44d143b2-1958-4cfb-b3fc-d1a4c2943bfb

📥 Commits

Reviewing files that changed from the base of the PR and between c0eebe6 and 04845ee.

📒 Files selected for processing (1)
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/components/FileViewerContent/FileViewerContent.tsx

@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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/components/FileViewerContent/utils/diff-location.ts`:
- Around line 67-97: The function fails to shift old-side lines that fall after
earlier hunks because it returns the raw lineNumber unchanged; fix by carrying a
cumulative line delta across diff.hunks (e.g., track lineDelta or update
cumulative offsets rather than resetting per hunk) and apply that delta to the
fallback return; specifically, when iterating diff.hunks (and using
currentOldLine/currentNewLine), accumulate (hunk.additions.length -
hunk.deletions.length) into a lineDelta and return clampLineNumber(lineNumber +
lineDelta, modifiedLines) instead of clampLineNumber(lineNumber, modifiedLines).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4431c261-4fff-49c1-9e48-87af93895a40

📥 Commits

Reviewing files that changed from the base of the PR and between bfe2505 and 9cdb7b7.

📒 Files selected for processing (3)
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/components/FileViewerContent/FileViewerContent.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/components/FileViewerContent/utils/diff-location.test.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/components/FileViewerContent/utils/diff-location.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/components/FileViewerContent/utils/diff-location.test.ts

@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.

🧹 Nitpick comments (1)
apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/components/FileViewerContent/utils/diff-location.test.ts (1)

7-11: Extract the repeated FileContents fixture.

A tiny helper would keep each case focused on the mapping behavior instead of re-declaring the same object shape six times.

♻️ Suggested cleanup
+const makeContents = (original: string, modified: string): FileContents => ({
+	original,
+	modified,
+	language: "text",
+});
+
 describe("mapDiffLocationToRawPosition", () => {
 	it("keeps addition-side clicks on the same modified line", () => {
-		const contents: FileContents = {
-			original: "one\ntwo\nthree",
-			modified: "one\ntwo changed\nthree",
-			language: "text",
-		};
+		const contents = makeContents("one\ntwo\nthree", "one\ntwo changed\nthree");

Also applies to: 28-32, 48-52, 68-72, 88-92, 108-112

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/components/FileViewerContent/utils/diff-location.test.ts`
around lines 7 - 11, Tests repeat the same FileContents fixture multiple times;
extract a small helper (e.g., createFileContents or makeFileContents) that
returns the base FileContents object and use it in each test instead of
re-declaring the literal. Update occurrences that declare const contents:
FileContents = { original: "one\n...", modified: "...", language: "text" } to
call the helper and, when needed, override fields with object spread (e.g., {
...createFileContents(), modified: "..." }) so each case remains focused on
mapping behavior; reference the FileContents type and the existing contents
declarations in diff-location.test.ts when making the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/components/FileViewerContent/utils/diff-location.test.ts`:
- Around line 7-11: Tests repeat the same FileContents fixture multiple times;
extract a small helper (e.g., createFileContents or makeFileContents) that
returns the base FileContents object and use it in each test instead of
re-declaring the literal. Update occurrences that declare const contents:
FileContents = { original: "one\n...", modified: "...", language: "text" } to
call the helper and, when needed, override fields with object spread (e.g., {
...createFileContents(), modified: "..." }) so each case remains focused on
mapping behavior; reference the FileContents type and the existing contents
declarations in diff-location.test.ts when making the change.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4579f6a5-65af-407f-ab2b-fdf56bc591d5

📥 Commits

Reviewing files that changed from the base of the PR and between 9cdb7b7 and 837e8ce.

📒 Files selected for processing (2)
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/components/FileViewerContent/utils/diff-location.test.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/components/FileViewerContent/utils/diff-location.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/components/FileViewerContent/utils/diff-location.ts

@cubic-dev-ai cubic-dev-ai 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.

1 issue found across 4 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/components/FileViewerContent/FileViewerContent.tsx">

<violation number="1" location="apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/components/FileViewerContent/FileViewerContent.tsx:268">
P2: `handleDiffLineEnter` stores `diffContainerRef.current` (the entire scrollable container) as `lineElement`, but downstream helpers like `getDiffCodeElement` call `lineElement.querySelector('[data-code]')` expecting a single-line element. When this ref is later consumed by `openRawFromDiffLocation` without an explicit column (the `location.column ??` fallback branch), the query hits the first `[data-code]` in the whole diff instead of the hovered line, potentially producing an incorrect column.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@cubic-dev-ai cubic-dev-ai 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.

1 issue found across 11 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/desktop/src/renderer/stores/tabs/store.ts">

<violation number="1" location="apps/desktop/src/renderer/stores/tabs/store.ts:733">
P2: `shouldUpdateViewerState` doesn't account for the new `selectionStartLine`/`selectionEndLine` options. If a caller passes only selection range properties (without `line`/`column` or a viewMode change), the guard evaluates to false and the store update is skipped, silently discarding the selection.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

options.line ?? existingFileViewer.initialLine,
initialColumn:
options.column ?? existingFileViewer.initialColumn,
initialSelectionStartLine:

@cubic-dev-ai cubic-dev-ai Bot Mar 8, 2026 •

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.

P2: shouldUpdateViewerState doesn't account for the new selectionStartLine/selectionEndLine options. If a caller passes only selection range properties (without line/column or a viewMode change), the guard evaluates to false and the store update is skipped, silently discarding the selection.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/desktop/src/renderer/stores/tabs/store.ts, line 733:

<comment>`shouldUpdateViewerState` doesn't account for the new `selectionStartLine`/`selectionEndLine` options. If a caller passes only selection range properties (without `line`/`column` or a viewMode change), the guard evaluates to false and the store update is skipped, silently discarding the selection.</comment>

<file context>
@@ -730,6 +730,12 @@ export const useTabsStore = create<TabsStore>()(
 													options.line ?? existingFileViewer.initialLine,
 												initialColumn:
 													options.column ?? existingFileViewer.initialColumn,
+												initialSelectionStartLine:
+													options.selectionStartLine ??
+													existingFileViewer.initialSelectionStartLine,
</file context>
Fix with Cubic

@cubic-dev-ai cubic-dev-ai 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.

1 issue found across 3 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/desktop/src/renderer/screens/main/components/WorkspaceView/components/CodeEditor/CodeEditor.tsx">

<violation number="1" location="apps/desktop/src/renderer/screens/main/components/WorkspaceView/components/CodeEditor/CodeEditor.tsx:158">
P2: This `console.debug` with the `[DiffEditHereDebug]` tag looks like leftover development instrumentation. It fires on every `revealPosition` call and logs internal editor state that isn't useful outside debugging this feature. Remove it before merging.

(Based on your team's feedback about removing excessive logs and dead comments proactively.) [FEEDBACK_USED]</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@cubic-dev-ai cubic-dev-ai 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.

1 issue found across 6 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/components/FileViewerContent/utils/diff-location.ts">

<violation number="1" location="apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/components/FileViewerContent/utils/diff-location.ts:117">
P3: The fallback column measurement uses code-point indexing (`Array.from`) but the rest of the file uses UTF-16 column indexing (`.length`). This can produce incorrect jump columns for lines containing emoji/astral characters.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@Kitenite
Kitenite merged commit 262b9f4 into main Mar 8, 2026
7 checks passed
@Kitenite
Kitenite deleted the kitenite/make-the-diff-pane-view-selectable-and-add-the-rig branch March 8, 2026 21:38
@github-actions

github-actions Bot commented Mar 8, 2026

Copy link
Copy Markdown
Contributor

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ✅ Neon database branch
  • ⚠️ Electric Fly.io app

Thank you for your contribution! 🎉

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