Conversation
The copy/merge function was using line-based ranges (always column 0), which caused incorrect behavior when merging diffs involving blank lines and newlines. Content was being inserted rather than properly replacing the target range. This fix preserves character offsets from diff-match-patch throughout the pipeline and uses Ace's built-in indexToPosition() for precise character-to-position conversion during merge operations. Fixes #93 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Replace package-lock.json with pnpm-lock.yaml - Update GitHub Actions workflow to use pnpm - Update README installation instructions to show pnpm first Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
New test suites: - blank-lines.cy.js: Tests for blank line merging at start, middle, end - issue-93.cy.js: Reproduces GitHub issue #93, tests bracket integrity - diff-granularity.cy.js: Tests broad vs specific diff grouping New fixtures: - blank-line-start/middle/end.html: Blank line position tests - multiple-blank-lines.html: Multiple consecutive blank lines - issue-93-scenario.html: Exact scenario from the reported issue - diff-granularity.html: Adjacent diffs for granularity testing Fixed existing tests: - Uncommented assertions in ltr-bottom and rtl-bottom tests (now pass with the character offset fix) Test count increased from 26 to 42 (+62%) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
pnpm doesn't automatically install Cypress binary like npm does. Added explicit `pnpm exec cypress install` step and a wait for the server to be ready before running tests. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
ryan-pratt
reviewed
Jan 8, 2026
README.md
Outdated
Comment on lines
26
to
35
| pnpm add @openc3/ace-diff | ||
| pnpm add ace-builds | ||
|
|
||
| # or with npm | ||
| npm i @openc3/ace-diff -S | ||
| npm i ace-builds -S | ||
|
|
||
| … | ||
|
|
||
| # or with yarn | ||
| yarn add @openc3/ace-diff | ||
| yarn add ace-builds |
Collaborator
There was a problem hiding this comment.
Shouldn't the @openc3/ be removed here?
Collaborator
Author
There was a problem hiding this comment.
yeah I'm going to push back to the base ace-diff name
ryan-pratt
reviewed
Jan 8, 2026
Comment on lines
+368
to
+375
| // Get the content to insert using character offsets from the source | ||
| const sourceValue = sourceEditor.ace.getValue() | ||
| const contentToInsert = sourceValue.substring(sourceStartOffset, sourceEndOffset) | ||
|
|
||
| // Use Ace's built-in indexToPosition for precise character-to-position conversion | ||
| const targetDoc = targetEditor.ace.getSession().doc | ||
| const startPos = targetDoc.indexToPosition(targetStartOffset) | ||
| const endPos = targetDoc.indexToPosition(targetEndOffset) |
Collaborator
There was a problem hiding this comment.
Nice, this is much cleaner
ryan-pratt
approved these changes
Jan 8, 2026
ryan-pratt
requested changes
Jan 8, 2026
Collaborator
ryan-pratt
left a comment
There was a problem hiding this comment.
I think the @openc3/ needs to be removed from readme. Otherwise looks good
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Problem
The merge/copy function was using line-based ranges (always column 0), which caused incorrect behavior when merging diffs involving blank lines and newlines. Content was being inserted rather than properly replacing the target range.
Fixes #93
Solution
Store character offsets from diff-match-patch throughout the pipeline and use Ace's built-in
indexToPosition()for precise character-to-position conversion during merge operations.Key Changes
indexToPosition()Test Plan
New Tests Added
blank-lines.cy.jsissue-93.cy.jsdiff-granularity.cy.js🤖 Generated with Claude Code