Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit88146c6

Browse files
committed
make columnwith 0, meaning no text wrap, the standard
1 parentaed1d31 commit88146c6

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

‎src/main/java/com/github/difflib/text/DiffRowGenerator.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public static class Builder {
7676
privateFunction<Boolean,String>oldTag =f ->f ?"<span class=\"editOldInline\">" :"</span>";
7777
privateFunction<Boolean,String>newTag =f ->f ?"<span class=\"editNewInline\">" :"</span>";
7878

79-
privateintcolumnWidth =80;
79+
privateintcolumnWidth =0;
8080
privatebooleanmergeOriginalRevised =false;
8181
privatebooleaninlineDiffByWord =false;
8282
privatebooleanreportLinesUnchanged =false;

‎src/main/java/com/github/difflib/text/StringUtils.java‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,11 @@ public static List<String> wrapText(List<String> list, int columnWidth) {
5858
* @return the wrapped text
5959
*/
6060
publicstaticStringwrapText(Stringline,intcolumnWidth) {
61-
if (columnWidth <=0) {
62-
thrownewIllegalArgumentException("columnWidth may not be less or equal 0");
61+
if (columnWidth <0) {
62+
thrownewIllegalArgumentException("columnWidth may not be less 0");
63+
}
64+
if (columnWidth ==0) {
65+
returnline;
6366
}
6467
intlength =line.length();
6568
intdelimiter ="<br/>".length();

‎src/test/java/com/github/difflib/text/DiffRowGeneratorTest.java‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ public void testGeneratorWithMergeByWord5() throws DiffException {
173173
.showInlineDiffs(true)
174174
.mergeOriginalRevised(true)
175175
.inlineDiffByWord(true)
176+
.columnWidth(80)
176177
.build();
177178
List<DiffRow>rows =generator.generateDiffRows(Arrays.asList("Test feature"),Arrays.asList("ester feature best"));
178179
print(rows);

‎src/test/java/com/github/difflib/text/StringUtilsTest.java‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616
packagecom.github.difflib.text;
1717

18-
importcom.github.difflib.text.StringUtils;
1918
importjava.util.Collections;
2019
importorg.junit.Test;
2120
importstaticorg.junit.Assert.*;
@@ -62,7 +61,7 @@ public void testWrapText_String_int() {
6261

6362
@Test(expected =IllegalArgumentException.class)
6463
publicvoidtestWrapText_String_int_zero() {
65-
assertEquals("test",StringUtils.wrapText("test",0));
64+
assertEquals("test",StringUtils.wrapText("test",-1));
6665
}
6766

6867
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2026 Movatter.jp