Git Product home page Git Product logo

Comments (5)

JackuB avatar JackuB commented on May 24, 2024

I think I know how to fix, but Iā€™m currently travelling so I could get to it in a few days.

Possibly related to #1

from ace-diff.

jackanderson avatar jackanderson commented on May 24, 2024

hmm. nope. that didnt fix the issue. I still get a new difference after copying. It's like it's not initially detecting the blank line as a difference and then once the first difference is resolved then it detects it as a difference. Maybe something to do with the diff simplifier?

from ace-diff.

JackuB avatar JackuB commented on May 24, 2024

Still travelling, but managed to create the smallest possible repro:

start

something else

end

and

starts
mid
end

I will be looking into why this is happening. Pushed the branch here for now https://github.com/ace-diff/ace-diff/tree/JackuB/merge-with-newlines

from ace-diff.

JackuB avatar JackuB commented on May 24, 2024

The issue is with newlines - if you look at the raw output from https://github.com/JackuB/diff-match-patch there is \nend (0 means no change, so it's not part of the patch that's applied)
snimek obrazovky 2018-04-19 v 17 04 16

If you manually move the \n to the previous line 42b957e it would fix the diffing, as now the newline will be part of the patch.

2018-04-19 17_52_12

I think it might be related to this behaviour:

ace-diff/src/index.js

Lines 494 to 497 in 42b957e

// this was added in to hack around an oddity with the Google lib. Sometimes it would include a newline
// as the first char for a diff, other times not - and it would change when you were typing on-the-fly. This
// is used to level things out so the diffs don't appear to shift around
let newContentStartsWithNewline = /^\n/.test(diffText);

from ace-diff.

jackanderson avatar jackanderson commented on May 24, 2024

from ace-diff.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.