Giter Site home page Giter Site logo

Comments (3)

wumpz avatar wumpz commented on June 2, 2024

Could you give an example diff file. I implement it and make a test. However, PRs are welcome.

from java-diff-utils.

kuoruan avatar kuoruan commented on June 2, 2024

Sure:

https://github.com/java-diff-utils/java-diff-utils/commit/281c073c56a0cd0052963562e007c51ce2994983.diff

--- a/java-diff-utils/src/main/java/com/github/difflib/UnifiedDiffUtils.java
+++ b/java-diff-utils/src/main/java/com/github/difflib/UnifiedDiffUtils.java
@@ -420,11 +420,11 @@ private static void insertOrig(List<List<String>> diffList, List<String> result,
                 int end = nexMap.get("revRow") - 2;
                 insert(result, getOrigList(original, start, end));
             }
+            int start = map.get("orgRow") + map.get("orgDel") - 1;
+            start = start == -1 ? 0 : start;
             if (simb.contains("@@ -1,") && null == nexSimb && map.get("orgDel") != original.size()) {
-                insert(result, getOrigList(original, 0, original.size() - 1));
+                insert(result, getOrigList(original, start, original.size() - 1));
             } else if (null == nexSimb && (map.get("orgRow") + map.get("orgDel") - 1) < original.size()) {
-                int start = map.get("orgRow") + map.get("orgDel") - 1;
-                start = start == -1 ? 0 : start;
                 insert(result, getOrigList(original, start, original.size() - 1));
             }
         }

from java-diff-utils.

github-actions avatar github-actions commented on June 2, 2024

Stale issue message

from java-diff-utils.

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.