Title: Feature Request - To Merge Differences · Issue #168 · java-diff-utils/java-diff-utils · GitHub
Open Graph Title: Feature Request - To Merge Differences · Issue #168 · java-diff-utils/java-diff-utils
X Title: Feature Request - To Merge Differences · Issue #168 · java-diff-utils/java-diff-utils
Description: Describe the Feature A new request to consider including whitespace (space in my case) to represent the differences. To Reproduce Steps to reproduce the behavior: Example data --> Included in snippet. simple program snippet import java.u...
Open Graph Description: Describe the Feature A new request to consider including whitespace (space in my case) to represent the differences. To Reproduce Steps to reproduce the behavior: Example data --> Included in snipp...
X Description: Describe the Feature A new request to consider including whitespace (space in my case) to represent the differences. To Reproduce Steps to reproduce the behavior: Example data --> Included in sn...
Opengraph URL: https://github.com/java-diff-utils/java-diff-utils/issues/168
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Feature Request - To Merge Differences","articleBody":"**Describe the Feature**\r\nA new request to consider including whitespace (space in my case) to represent the differences.\r\n\r\n**To Reproduce**\r\nSteps to reproduce the behavior:\r\n1. Example data --\u003e Included in snippet.\r\n2. simple program snippet\r\n```\r\nimport java.util.Arrays;\r\nimport java.util.List;\r\n\r\nimport com.github.difflib.text.DiffRow;\r\nimport com.github.difflib.text.DiffRowGenerator;\r\n\r\npublic class ShowDiffViewUsingJavaDiffUtils {\r\n\r\n static String leftString = \"A sample string to test this tool.\";\r\n static String rightString = \"A sample string is defined here and will be used to test diff library.\";\r\n\r\n public static void main(String[] args) throws Throwable {\r\n\r\n //create a configured DiffRowGenerator\r\n DiffRowGenerator generator = DiffRowGenerator.create()\r\n .ignoreWhiteSpaces(true)\r\n .showInlineDiffs(true)\r\n .mergeOriginalRevised(false)\r\n .inlineDiffByWord(true)\r\n .oldTag(f -\u003e \"--\")\r\n .newTag(f -\u003e \"++\")\r\n .build();\r\n\r\n //compute the differences for two test texts.\r\n List\u003cDiffRow\u003e rows = generator.generateDiffRows(\r\n Arrays.asList(leftString),\r\n Arrays.asList(rightString));\r\n \r\n rows.stream().forEach(r -\u003e {\r\n System.out.println(\"OldLine: \" + r.getOldLine());\r\n System.out.println(\"NewLine: \" + r.getNewLine());\r\n });\r\n\r\n }\r\n\r\n}\r\n\r\n```\r\n3. See error - NA.\r\n\r\n**Expected behavior**\r\nThe output of my program is:\r\n```\r\nOldLine: A sample string to test --this-- --tool--.\r\nNewLine: A sample string ++is defined here and will be used ++to test ++diff++ ++library++.\r\n```\r\n\r\nI would like to have this diff tool to consider whitespace. e.g. consider whitespace between `this tool` for the differences.\r\nExpected output:\r\n```\r\nOldLine: A sample string to test --this tool--.\r\nNewLine: A sample string ++is defined here and will be used ++to test ++diff library++.\r\n```\r\n\r\nI have tried all possible configurations to achieve this, but no luck, hence raising this request. If the feature does exist, please share the details.\r\n\r\n**System**\r\n - Java version - 1.8\r\n - Version - 4.12\r\n","author":{"url":"https://github.com/gvjoshi25","@type":"Person","name":"gvjoshi25"},"datePublished":"2023-05-29T15:03:09.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/168/java-diff-utils/issues/168"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:55c31c6c-c081-101d-c412-f4b00e05ec76 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B6DA:3D0535:1787631:1F97EEF:6969AA31 |
| html-safe-nonce | a45d39af71e4d84fbde3846502fab821b14a78e28fdebe5cb71b764e03528357 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNkRBOjNEMDUzNToxNzg3NjMxOjFGOTdFRUY6Njk2OUFBMzEiLCJ2aXNpdG9yX2lkIjoiOTAzMTUzNzIyNTU2MzIyMDUyOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | e89c3759da4181c1ae1823775a15bbf3aee4aa31e2d066a4f88ba10a8d8b5223 |
| hovercard-subject-tag | issue:1730915211 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/java-diff-utils/java-diff-utils/168/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bc831a1fe9470893377734c753f30a1a9f29c1afb67abb7f8c93df3c638ff5e1/java-diff-utils/java-diff-utils/issues/168 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bc831a1fe9470893377734c753f30a1a9f29c1afb67abb7f8c93df3c638ff5e1/java-diff-utils/java-diff-utils/issues/168 |
| og:image:alt | Describe the Feature A new request to consider including whitespace (space in my case) to represent the differences. To Reproduce Steps to reproduce the behavior: Example data --> Included in snipp... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | gvjoshi25 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 24c4c97a2d520cb286b35e1a4c22d7a4df3c26a2fa28dd7cdf0e65db327b4de7 |
| turbo-cache-control | no-preview |
| go-import | github.com/java-diff-utils/java-diff-utils git https://github.com/java-diff-utils/java-diff-utils.git |
| octolytics-dimension-user_id | 40540835 |
| octolytics-dimension-user_login | java-diff-utils |
| octolytics-dimension-repository_id | 86663812 |
| octolytics-dimension-repository_nwo | java-diff-utils/java-diff-utils |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 86663812 |
| octolytics-dimension-repository_network_root_nwo | java-diff-utils/java-diff-utils |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 124667f43168afb6c9c03b7c02eb5b1d2e1be3d9 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width