diff --git a/Doc/library/difflib.rst b/Doc/library/difflib.rst --- a/Doc/library/difflib.rst +++ b/Doc/library/difflib.rst @@ -99,17 +99,18 @@ diffs. For comparing directories and fil broken and wrapped, defaults to ``None`` where lines are not wrapped. *linejunk* and *charjunk* are optional keyword arguments passed into ``ndiff()`` (used by :class:`HtmlDiff` to generate the side by side HTML differences). See ``ndiff()`` documentation for argument default values and descriptions. The following methods are public: - .. method:: make_file(fromlines, tolines, fromdesc='', todesc='', context=False, numlines=5) + .. method:: make_file(fromlines, tolines, fromdesc='', todesc='', context=False, \ + numlines=5, charset='utf-8') Compares *fromlines* and *tolines* (lists of strings) and returns a string which is a complete HTML file containing a table showing line by line differences with inter-line and intra-line changes highlighted. *fromdesc* and *todesc* are optional keyword arguments to specify from/to file column header strings (both default to an empty string). @@ -118,16 +119,19 @@ diffs. For comparing directories and fil ``False`` to show the full files. *numlines* defaults to ``5``. When *context* is ``True`` *numlines* controls the number of context lines which surround the difference highlights. When *context* is ``False`` *numlines* controls the number of lines which are shown before a difference highlight when using the "next" hyperlinks (setting to zero would cause the "next" hyperlinks to place the next difference highlight at the top of the browser without any leading context). + .. versionchanged:: 3.5 + Added the *charset* keyword argument. + .. method:: make_table(fromlines, tolines, fromdesc='', todesc='', context=False, numlines=5) Compares *fromlines* and *tolines* (lists of strings) and returns a string which is a complete HTML table showing line by line differences with inter-line and intra-line changes highlighted. The arguments for this method are the same as those for the :meth:`make_file` method. diff --git a/Lib/difflib.py b/Lib/difflib.py --- a/Lib/difflib.py +++ b/Lib/difflib.py @@ -1588,70 +1588,101 @@ def _mdiff(fromlines, tolines, context=N # If another change within the context, extend the context if found_diff: lines_to_write = context-1 else: lines_to_write -= 1 yield from_line, to_line, found_diff -_file_template = """ - - +_file_template = """\ + - - - - + + HTML output by difflib + -
%(table)s%(legend)s

AltStyle によって変換されたページ (->オリジナル) /

- """ _styles = """ - table.diff {font-family:Courier; border:medium;} - .diff_header {background-color:#e0e0e0} - td.diff_header {text-align:right} - .diff_next {background-color:#c0c0c0} - .diff_add {background-color:#aaffaa} - .diff_chg {background-color:#ffff77} - .diff_sub {background-color:#ffaaaa}""" + .nowrap { + white-space: nowrap; + } + table.diff { + font-family: Courier; + border: medium; + border-collapse: collapse; + border: 1px solid #000; + } + table.legends { + border-collapse: collapse; + font: normal 14px arial, sans; + margin-top: 25px; + } + table.legends tr td, + table.legends tr th { + padding: 5px; + } + table.diff tr td, + table.diff tr th { + padding: 0; + border-right: 1px solid #000; + } + .diff_header { + background-color: #e0e0e0; + } + td.diff_header { + text-align: right; + } + .diff_next { + background-color: #c0c0c0; + } + .diff_add { + background-color: #aaffaa; + } + .diff_chg { + background-color:#ffff77; + } + .diff_sub { + background-color: #ffaaaa; + } +""" _table_template = """ - - - + %(header_row)s %(data_rows)s """ _legend = """ - - - - +
Legends
- - - - -
Colors
Added
Changed
Deleted
- - - - -
Links
(f)irst change
(n)ext change
(t)op
+ + + + + + + + + + + + + + + + + + +
Legends
ColorsLinks
Added(f)irst change
Changed(n)ext change
Deleted(t)op
""" class HtmlDiff(object): """For producing HTML side by side comparison with change highlights. This class can be used to create an HTML table (or a complete HTML file containing the table) showing a side by side, line by line comparison of text with inter-line and intra-line change highlights. The table can @@ -1683,39 +1714,41 @@ class HtmlDiff(object): HtmlDiff() to generate the side by side HTML differences). See ndiff() documentation for argument default values and descriptions. """ self._tabsize = tabsize self._wrapcolumn = wrapcolumn self._linejunk = linejunk self._charjunk = charjunk - def make_file(self,fromlines,tolines,fromdesc='',todesc='',context=False, - numlines=5): + def make_file(self, fromlines, tolines, fromdesc='', todesc='', + context=False, numlines=5, charset='utf-8'): """Returns HTML file of side by side comparison with change highlights Arguments: fromlines -- list of "from" lines tolines -- list of "to" lines fromdesc -- "from" file column header string todesc -- "to" file column header string context -- set to True for contextual differences (defaults to False which shows full differences). numlines -- number of context lines. When context is set True, controls number of lines displayed before and after the change. When context is False, controls the number of lines to place the "next" link anchors before the next change (so click of "next" link jumps to just before the change). + charset -- charset of the HTML document """ return self._file_template % dict( - styles = self._styles, - legend = self._legend, - table = self.make_table(fromlines,tolines,fromdesc,todesc, - context=context,numlines=numlines)) + styles=self._styles, + legend=self._legend, + table=self.make_table(fromlines, tolines, fromdesc, todesc, + context=context, numlines=numlines), + charset=charset) def _tab_newline_replace(self,fromlines,tolines): """Returns from/to line lists with tabs expanded and newlines removed. Instead of tab characters being replaced by the number of spaces needed to fill in to the next tab stop, this function will fill the space with tab characters. This is done so that the difference algorithms can identify changes in a file when tabs are replaced by @@ -1854,17 +1887,17 @@ class HtmlDiff(object): # handle blank lines where linenum is '>' or '' id = '' # replace those things that would get confused with HTML symbols text=text.replace("&","&").replace(">",">").replace("<","<") # make space non-breakable so they don't get compressed or line wrapped text = text.replace(' ',' ').rstrip() - return '%s%s' \ + return '%s%s' \ % (id,linenum,text) def _make_prefix(self): """Create unique anchor prefixes""" # Generate a unique anchor prefix so multiple tables # can exist on the same HTML page without conflicts. fromprefix = "from%d_" % HtmlDiff._default_prefix @@ -1974,19 +2007,19 @@ class HtmlDiff(object): # generated for the first line if i> 0: s.append(' \n \n') else: s.append( fmt % (next_id[i],next_href[i],fromlist[i], next_href[i],tolist[i])) if fromdesc or todesc: header_row = '%s%s%s%s' % ( - '
', + '
', '%s' % fromdesc, - '
', + '
', '%s' % todesc) else: header_row = '' table = self._table_template % dict( data_rows=''.join(s), header_row=header_row, prefix=self._prefix[1]) diff --git a/Lib/test/test_difflib.py b/Lib/test/test_difflib.py --- a/Lib/test/test_difflib.py +++ b/Lib/test/test_difflib.py @@ -209,16 +209,29 @@ class TestSFpatches(unittest.TestCase): def test_recursion_limit(self): # Check if the problem described in patch #1413711 exists. limit = sys.getrecursionlimit() old = [(i%2 and "K:%d" or "V:A:%d") % i for i in range(limit*2)] new = [(i%2 and "K:%d" or "V:B:%d") % i for i in range(limit*2)] difflib.SequenceMatcher(None, old, new).get_opcodes() + def test_make_file_default_charset(self): + html_diff = difflib.HtmlDiff() + output = html_diff.make_file(patch914575_from1.splitlines(), + patch914575_to1.splitlines()) + self.assertIn('', output) + + def test_make_file_iso88591_charset(self): + html_diff = difflib.HtmlDiff() + output = html_diff.make_file(patch914575_from1.splitlines(), + patch914575_to1.splitlines(), + charset='iso-8859-1') + self.assertIn('', output) + class TestOutputFormat(unittest.TestCase): def test_tab_delimiter(self): args = ['one', 'two', 'Original', 'Current', '2005-01-26 23:30:50', '2010-04-02 10:20:52'] ud = difflib.unified_diff(*args, lineterm='') self.assertEqual(list(ud)[0:2], [ "--- Original\t2005-01-26 23:30:50", diff --git a/Lib/test/test_difflib_expect.html b/Lib/test/test_difflib_expect.html --- a/Lib/test/test_difflib_expect.html +++ b/Lib/test/test_difflib_expect.html @@ -1,526 +1,517 @@ - - - + - - - - + + HTML output by difflib + - - - - - +

from
to
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

from
to
f 1f 1
n 2 1. Beautiful is beTTer than ugly.n 2 1. Beautiful is better than ugly.
3 2. Explicit is better than implicit.
4 3. Simple is better than complex.3 3. Simple is better than complex.
5 4. Complex is better than complicated.4 4. Complicated is better than complex.
5 5. Flat is better than nested.
61236123
71237123
81238123
91239123
1012310123
1112311123
1212312123
1312313123
1412314123
1512315123
1616
n 17 1. Beautiful is beTTer than ugly.n 17 1. Beautiful is better than ugly.
18 2. Explicit is better than implicit.
19 3. Simple is better than complex.18 3. Simple is better than complex.
20 4. Complex is better than complicated.19 4. Complicated is better than complex.
20 5. Flat is better than nested.
2112321123
2212322123
2312323123
2412324123
2512325123
2612326123
2712327123
2812328123
2912329123
3012330123
3131
t 32 1. Beautiful is beTTer than ugly.t 32 1. Beautiful is better than ugly.
33 2. Explicit is better than implicit.
34 3. Simple is better than complex.33 3. Simple is better than complex.
35 4. Complex is better than complicated.34 4. Complicated is better than complex.
35 5. Flat is better than nested.
3612336123
3712337123
3812338123
3912339123
4012340123
4112341123
4212342123
4312343123
4412344123
4512345123
f 1f 1
n 2 1. Beautiful is beTTer than ugly.n 2 1. Beautiful is better than ugly.
3 2. Explicit is better than implicit.
4 3. Simple is better than complex.3 3. Simple is better than complex.
5 4. Complex is better than complicated.4 4. Complicated is better than complex.
5 5. Flat is better than nested.
61236123
71237123
81238123
91239123
1012310123
1112311123
1212312123
1312313123
1412314123
1512315123
1616
n 17 1. Beautiful is beTTer than ugly.n 17 1. Beautiful is better than ugly.
18 2. Explicit is better than implicit.
19 3. Simple is better than complex.18 3. Simple is better than complex.
20 4. Complex is better than complicated.19 4. Complicated is better than complex.
20 5. Flat is better than nested.
2112321123
2212322123
2312323123
2412324123
2512325123
2612326123
2712327123
2812328123
2912329123
3012330123
3131
t 32 1. Beautiful is beTTer than ugly.t 32 1. Beautiful is better than ugly.
33 2. Explicit is better than implicit.
34 3. Simple is better than complex.33 3. Simple is better than complex.
35 4. Complex is better than complicated.34 4. Complicated is better than complex.
35 5. Flat is better than nested.
3612336123
3712337123
3812338123
3912339123
4012340123
4112341123
4212342123
4312343123
4412344123
4512345123
- - - - +
Legends
- - - - -
Colors
Added
Changed
Deleted
- - - - -
Links
(f)irst change
(n)ext change
(t)op
+ + + + + + + + + + + + + + + + + + +
Legends
ColorsLinks
Added(f)irst change
Changed(n)ext change
Deleted(t)op

Context (first diff within numlines=5(default))

- - - - +

from
to
+ - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + +

from
to
f 1f 1
n 2 1. Beautiful is beTTer than ugly.n 2 1. Beautiful is better than ugly.
3 2. Explicit is better than implicit.
4 3. Simple is better than complex.3 3. Simple is better than complex.
5 4. Complex is better than complicated.4 4. Complicated is better than complex.
5 5. Flat is better than nested.
61236123
71237123
81238123
91239123
1012310123
f 1f 1
n 2 1. Beautiful is beTTer than ugly.n 2 1. Beautiful is better than ugly.
3 2. Explicit is better than implicit.
4 3. Simple is better than complex.3 3. Simple is better than complex.
5 4. Complex is better than complicated.4 4. Complicated is better than complex.
5 5. Flat is better than nested.
61236123
71237123
81238123
91239123
1012310123
1212312123
1312313123
1412314123
1512315123
1616
n 17 1. Beautiful is beTTer than ugly.n 17 1. Beautiful is better than ugly.
18 2. Explicit is better than implicit.
19 3. Simple is better than complex.18 3. Simple is better than complex.
20 4. Complex is better than complicated.19 4. Complicated is better than complex.
20 5. Flat is better than nested.
2112321123
2212322123
2312323123
2412324123
2512325123
1212312123
1312313123
1412314123
1512315123
1616
n 17 1. Beautiful is beTTer than ugly.n 17 1. Beautiful is better than ugly.
18 2. Explicit is better than implicit.
19 3. Simple is better than complex.18 3. Simple is better than complex.
20 4. Complex is better than complicated.19 4. Complicated is better than complex.
20 5. Flat is better than nested.
2112321123
2212322123
2312323123
2412324123
2512325123
2712327123
2812328123
2912329123
3012330123
3131
t 32 1. Beautiful is beTTer than ugly.t 32 1. Beautiful is better than ugly.
33 2. Explicit is better than implicit.
34 3. Simple is better than complex.33 3. Simple is better than complex.
35 4. Complex is better than complicated.34 4. Complicated is better than complex.
35 5. Flat is better than nested.
3612336123
3712337123
3812338123
3912339123
4012340123
2712327123
2812328123
2912329123
3012330123
3131
t 32 1. Beautiful is beTTer than ugly.t 32 1. Beautiful is better than ugly.
33 2. Explicit is better than implicit.
34 3. Simple is better than complex.33 3. Simple is better than complex.
35 4. Complex is better than complicated.34 4. Complicated is better than complex.
35 5. Flat is better than nested.
3612336123
3712337123
3812338123
3912339123
4012340123

Context (first diff after numlines=5(default))

- - - - +

from
to
+ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + +

from
to
74567456
84568456
94569456
1045610456
1111
n 12 1. Beautiful is beTTer than ugly.n 12 1. Beautiful is better than ugly.
13 2. Explicit is better than implicit.
14 3. Simple is better than complex.13 3. Simple is better than complex.
15 4. Complex is better than complicated.14 4. Complicated is better than complex.
15 5. Flat is better than nested.
1612316123
1712317123
1812318123
1912319123
2012320123
74567456
84568456
94569456
1045610456
1111
n 12 1. Beautiful is beTTer than ugly.n 12 1. Beautiful is better than ugly.
13 2. Explicit is better than implicit.
14 3. Simple is better than complex.13 3. Simple is better than complex.
15 4. Complex is better than complicated.14 4. Complicated is better than complex.
15 5. Flat is better than nested.
1612316123
1712317123
1812318123
1912319123
2012320123
2212322123
2312323123
2412324123
2512325123
2626
n 27 1. Beautiful is beTTer than ugly.n 27 1. Beautiful is better than ugly.
28 2. Explicit is better than implicit.
29 3. Simple is better than complex.28 3. Simple is better than complex.
30 4. Complex is better than complicated.29 4. Complicated is better than complex.
30 5. Flat is better than nested.
3112331123
3212332123
3312333123
3412334123
3512335123
2212322123
2312323123
2412324123
2512325123
2626
n 27 1. Beautiful is beTTer than ugly.n 27 1. Beautiful is better than ugly.
28 2. Explicit is better than implicit.
29 3. Simple is better than complex.28 3. Simple is better than complex.
30 4. Complex is better than complicated.29 4. Complicated is better than complex.
30 5. Flat is better than nested.
3112331123
3212332123
3312333123
3412334123
3512335123
3712337123
3812338123
3912339123
4012340123
4141
t 42 1. Beautiful is beTTer than ugly.t 42 1. Beautiful is better than ugly.
43 2. Explicit is better than implicit.
44 3. Simple is better than complex.43 3. Simple is better than complex.
45 4. Complex is better than complicated.44 4. Complicated is better than complex.
45 5. Flat is better than nested.
4612346123
4712347123
4812348123
4912349123
5012350123
3712337123
3812338123
3912339123
4012340123
4141
t 42 1. Beautiful is beTTer than ugly.t 42 1. Beautiful is better than ugly.
43 2. Explicit is better than implicit.
44 3. Simple is better than complex.43 3. Simple is better than complex.
45 4. Complex is better than complicated.44 4. Complicated is better than complex.
45 5. Flat is better than nested.
4612346123
4712347123
4812348123
4912349123
5012350123

Context (numlines=6)

- - - - +

from
to
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

from
to
f 1f 1
n 2 1. Beautiful is beTTer than ugly.n 2 1. Beautiful is better than ugly.
3 2. Explicit is better than implicit.
4 3. Simple is better than complex.3 3. Simple is better than complex.
5 4. Complex is better than complicated.4 4. Complicated is better than complex.
5 5. Flat is better than nested.
61236123
71237123
81238123
91239123
1012310123
1112311123
1212312123
1312313123
1412314123
1512315123
1616
n 17 1. Beautiful is beTTer than ugly.n 17 1. Beautiful is better than ugly.
18 2. Explicit is better than implicit.
19 3. Simple is better than complex.18 3. Simple is better than complex.
20 4. Complex is better than complicated.19 4. Complicated is better than complex.
20 5. Flat is better than nested.
2112321123
2212322123
2312323123
2412324123
2512325123
2612326123
2712327123
2812328123
2912329123
3012330123
3131
t 32 1. Beautiful is beTTer than ugly.t 32 1. Beautiful is better than ugly.
33 2. Explicit is better than implicit.
34 3. Simple is better than complex.33 3. Simple is better than complex.
35 4. Complex is better than complicated.34 4. Complicated is better than complex.
35 5. Flat is better than nested.
3612336123
3712337123
3812338123
3912339123
4012340123
4112341123
f 1f 1
n 2 1. Beautiful is beTTer than ugly.n 2 1. Beautiful is better than ugly.
3 2. Explicit is better than implicit.
4 3. Simple is better than complex.3 3. Simple is better than complex.
5 4. Complex is better than complicated.4 4. Complicated is better than complex.
5 5. Flat is better than nested.
61236123
71237123
81238123
91239123
1012310123
1112311123
1212312123
1312313123
1412314123
1512315123
1616
n 17 1. Beautiful is beTTer than ugly.n 17 1. Beautiful is better than ugly.
18 2. Explicit is better than implicit.
19 3. Simple is better than complex.18 3. Simple is better than complex.
20 4. Complex is better than complicated.19 4. Complicated is better than complex.
20 5. Flat is better than nested.
2112321123
2212322123
2312323123
2412324123
2512325123
2612326123
2712327123
2812328123
2912329123
3012330123
3131
t 32 1. Beautiful is beTTer than ugly.t 32 1. Beautiful is better than ugly.
33 2. Explicit is better than implicit.
34 3. Simple is better than complex.33 3. Simple is better than complex.
35 4. Complex is better than complicated.34 4. Complicated is better than complex.
35 5. Flat is better than nested.
3612336123
3712337123
3812338123
3912339123
4012340123
4112341123

Context (numlines=0)

- - - - +

from
to
+ - - - - - + + + + + - - - - - + + + + + - - - - - + + + + +

from
to
n 2 1. Beautiful is beTTer than ugly.n 2 1. Beautiful is better than ugly.
3 2. Explicit is better than implicit.
4 3. Simple is better than complex.3 3. Simple is better than complex.
5 4. Complex is better than complicated.4 4. Complicated is better than complex.
5 5. Flat is better than nested.
n 2 1. Beautiful is beTTer than ugly.n 2 1. Beautiful is better than ugly.
3 2. Explicit is better than implicit.
4 3. Simple is better than complex.3 3. Simple is better than complex.
5 4. Complex is better than complicated.4 4. Complicated is better than complex.
5 5. Flat is better than nested.
n 17 1. Beautiful is beTTer than ugly.n 17 1. Beautiful is better than ugly.
18 2. Explicit is better than implicit.
19 3. Simple is better than complex.18 3. Simple is better than complex.
20 4. Complex is better than complicated.19 4. Complicated is better than complex.
20 5. Flat is better than nested.
n 17 1. Beautiful is beTTer than ugly.n 17 1. Beautiful is better than ugly.
18 2. Explicit is better than implicit.
19 3. Simple is better than complex.18 3. Simple is better than complex.
20 4. Complex is better than complicated.19 4. Complicated is better than complex.
20 5. Flat is better than nested.
t 32 1. Beautiful is beTTer than ugly.t 32 1. Beautiful is better than ugly.
33 2. Explicit is better than implicit.
34 3. Simple is better than complex.33 3. Simple is better than complex.
35 4. Complex is better than complicated.34 4. Complicated is better than complex.
35 5. Flat is better than nested.
t 32 1. Beautiful is beTTer than ugly.t 32 1. Beautiful is better than ugly.
33 2. Explicit is better than implicit.
34 3. Simple is better than complex.33 3. Simple is better than complex.
35 4. Complex is better than complicated.34 4. Complicated is better than complex.
35 5. Flat is better than nested.

Same Context

- - - - +

from
to
+

from
to
t No Differences Found t No Differences Found

Same Full

- - - - +

from
to
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

from
to
t 1t 1
2 1. Beautiful is beTTer than ugly.2 1. Beautiful is beTTer than ugly.
3 2. Explicit is better than implicit.3 2. Explicit is better than implicit.
4 3. Simple is better than complex.4 3. Simple is better than complex.
5 4. Complex is better than complicated.5 4. Complex is better than complicated.
61236123
71237123
81238123
91239123
1012310123
1112311123
1212312123
1312313123
1412314123
1512315123
1616
17 1. Beautiful is beTTer than ugly.17 1. Beautiful is beTTer than ugly.
18 2. Explicit is better than implicit.18 2. Explicit is better than implicit.
19 3. Simple is better than complex.19 3. Simple is better than complex.
20 4. Complex is better than complicated.20 4. Complex is better than complicated.
2112321123
2212322123
2312323123
2412324123
2512325123
2612326123
2712327123
2812328123
2912329123
3012330123
3131
32 1. Beautiful is beTTer than ugly.32 1. Beautiful is beTTer than ugly.
33 2. Explicit is better than implicit.33 2. Explicit is better than implicit.
34 3. Simple is better than complex.34 3. Simple is better than complex.
35 4. Complex is better than complicated.35 4. Complex is better than complicated.
3612336123
3712337123
3812338123
3912339123
4012340123
4112341123
4212342123
4312343123
4412344123
4512345123
t 1t 1
2 1. Beautiful is beTTer than ugly.2 1. Beautiful is beTTer than ugly.
3 2. Explicit is better than implicit.3 2. Explicit is better than implicit.
4 3. Simple is better than complex.4 3. Simple is better than complex.
5 4. Complex is better than complicated.5 4. Complex is better than complicated.
61236123
71237123
81238123
91239123
1012310123
1112311123
1212312123
1312313123
1412314123
1512315123
1616
17 1. Beautiful is beTTer than ugly.17 1. Beautiful is beTTer than ugly.
18 2. Explicit is better than implicit.18 2. Explicit is better than implicit.
19 3. Simple is better than complex.19 3. Simple is better than complex.
20 4. Complex is better than complicated.20 4. Complex is better than complicated.
2112321123
2212322123
2312323123
2412324123
2512325123
2612326123
2712327123
2812328123
2912329123
3012330123
3131
32 1. Beautiful is beTTer than ugly.32 1. Beautiful is beTTer than ugly.
33 2. Explicit is better than implicit.33 2. Explicit is better than implicit.
34 3. Simple is better than complex.34 3. Simple is better than complex.
35 4. Complex is better than complicated.35 4. Complex is better than complicated.
3612336123
3712337123
3812338123
3912339123
4012340123
4112341123
4212342123
4312343123
4412344123
4512345123

Empty Context

- - - - +

from
to
+

from
to
t No Differences Found t No Differences Found

Empty Full

- - - - +

from
to
+

from
to
t Empty File t Empty File

tabsize=2

- - - + -
f 1 f 1
-
t 2 Line 1: preceeded by from:[tt] to:[ssss] t 2 Line 1: preceeded by from:[tt] to:[ssss]
-
3 Line 2: preceeded by from:[sstt] to:[sssst] 3 Line 2: preceeded by from:[sstt] to:[sssst]
-
4 Line 3: preceeded by from:[sstst] to:[ssssss] 4 Line 3: preceeded by from:[sstst] to:[ssssss]
-
5 Line 4: has from:[sst] to:[sss] after : 5 Line 4: has from:[sst] to:[sss] after :
-
6 Line 5: has from:[t] to:[ss] at end 6 Line 5: has from:[t] to:[ss] at end
+
f 1 f 1
+
t 2 Line 1: preceeded by from:[tt] to:[ssss] t 2 Line 1: preceeded by from:[tt] to:[ssss]
+
3 Line 2: preceeded by from:[sstt] to:[sssst] 3 Line 2: preceeded by from:[sstt] to:[sssst]
+
4 Line 3: preceeded by from:[sstst] to:[ssssss] 4 Line 3: preceeded by from:[sstst] to:[ssssss]
+
5 Line 4: has from:[sst] to:[sss] after : 5 Line 4: has from:[sst] to:[sss] after :
+
6 Line 5: has from:[t] to:[ss] at end 6 Line 5: has from:[t] to:[ss] at end

tabsize=default

- - - + -
f 1 f 1
-
t 2 Line 1: preceeded by from:[tt] to:[ssss] t 2 Line 1: preceeded by from:[tt] to:[ssss]
-
3 Line 2: preceeded by from:[sstt] to:[sssst] 3 Line 2: preceeded by from:[sstt] to:[sssst]
-
4 Line 3: preceeded by from:[sstst] to:[ssssss] 4 Line 3: preceeded by from:[sstst] to:[ssssss]
-
5 Line 4: has from:[sst] to:[sss] after : 5 Line 4: has from:[sst] to:[sss] after :
-
6 Line 5: has from:[t] to:[ss] at end 6 Line 5: has from:[t] to:[ss] at end
+
f 1 f 1
+
t 2 Line 1: preceeded by from:[tt] to:[ssss] t 2 Line 1: preceeded by from:[tt] to:[ssss]
+
3 Line 2: preceeded by from:[sstt] to:[sssst] 3 Line 2: preceeded by from:[sstt] to:[sssst]
+
4 Line 3: preceeded by from:[sstst] to:[ssssss] 4 Line 3: preceeded by from:[sstst] to:[ssssss]
+
5 Line 4: has from:[sst] to:[sss] after : 5 Line 4: has from:[sst] to:[sss] after :
+
6 Line 5: has from:[t] to:[ss] at end 6 Line 5: has from:[t] to:[ss] at end

Context (wrapcolumn=14,numlines=0)

- - - + -
n 4 line 2 n 4 line 2 adde
-
> d
+
n 4 line 2 n 4 line 2 adde
+
> d
-
n 6 line 4 chang n 6 line 4 chanG
-
> ed > Ed
-
7 line 5 chang 7 line 5a chanG
-
> ed > ed
-
8 line 6 chang 8 line 6a chang
-
> ed > Ed
+
n 6 line 4 chang n 6 line 4 chanG
+
> ed > Ed
+
7 line 5 chang 7 line 5a chanG
+
> ed > ed
+
8 line 6 chang 8 line 6a chang
+
> ed > Ed
-
n 10 line 8 subtra n 10 line 8
-
> cted
+
n 10 line 8 subtra n 10 line 8
+
> cted
-
t 12 12345678901234 t 12 1234567890
-
> 56789012345689
-
> 012345
-
13 short line 13 another long l
-
> ine that needs
-
> to be wrapped
-
14 just fits in!! 14 just fitS in!!
-
15 just fits in t 15 just fits in t
-
> wo lines yup!! > wo lineS yup!!
+
t 12 12345678901234 t 12 1234567890
+
> 56789012345689
+
> 012345
+
13 short line 13 another long l
+
> ine that needs
+
> to be wrapped
+
14 just fits in!! 14 just fitS in!!
+
15 just fits in t 15 just fits in t
+
> wo lines yup!! > wo lineS yup!!

wrapcolumn=14,splitlines()

- - - + -
f 1 line 0 f 1 line 0
-
2 12345678901234 2 12345678901234
-
> 56789012345689 > 56789012345689
-
> 012345 > 012345
-
3 line 1 3 line 1
-
n 4 line 2 n 4 line 2 adde
-
> d
-
5 line 3 5 line 3
-
n 6 line 4 chang n 6 line 4 chanG
-
> ed > Ed
-
7 line 5 chang 7 line 5a chanG
-
> ed > ed
-
8 line 6 chang 8 line 6a chang
-
> ed > Ed
-
9 line 7 9 line 7
-
n 10 line 8 subtra n 10 line 8
-
> cted
-
11 line 9 11 line 9
-
t 12 12345678901234 t 12 1234567890
-
> 56789012345689
-
> 012345
-
13 short line 13 another long l
-
> ine that needs
-
> to be wrapped
-
14 just fits in!! 14 just fitS in!!
-
15 just fits in t 15 just fits in t
-
> wo lines yup!! > wo lineS yup!!
-
16 the end 16 the end
+
f 1 line 0 f 1 line 0
+
2 12345678901234 2 12345678901234
+
> 56789012345689 > 56789012345689
+
> 012345 > 012345
+
3 line 1 3 line 1
+
n 4 line 2 n 4 line 2 adde
+
> d
+
5 line 3 5 line 3
+
n 6 line 4 chang n 6 line 4 chanG
+
> ed > Ed
+
7 line 5 chang 7 line 5a chanG
+
> ed > ed
+
8 line 6 chang 8 line 6a chang
+
> ed > Ed
+
9 line 7 9 line 7
+
n 10 line 8 subtra n 10 line 8
+
> cted
+
11 line 9 11 line 9
+
t 12 12345678901234 t 12 1234567890
+
> 56789012345689
+
> 012345
+
13 short line 13 another long l
+
> ine that needs
+
> to be wrapped
+
14 just fits in!! 14 just fitS in!!
+
15 just fits in t 15 just fits in t
+
> wo lines yup!! > wo lineS yup!!
+
16 the end 16 the end

wrapcolumn=14,splitlines(True)

- - - + -
f 1 line 0 f 1 line 0
-
2 12345678901234 2 12345678901234
-
> 56789012345689 > 56789012345689
-
> 012345 > 012345
-
3 line 1 3 line 1
-
n 4 line 2 n 4 line 2 adde
-
> d
-
5 line 3 5 line 3
-
n 6 line 4 chang n 6 line 4 chanG
-
> ed > Ed
-
7 line 5 chang 7 line 5a chanG
-
> ed > ed
-
8 line 6 chang 8 line 6a chang
-
> ed > Ed
-
9 line 7 9 line 7
-
n 10 line 8 subtra n 10 line 8
-
> cted
-
11 line 9 11 line 9
-
t 12 12345678901234 t 12 1234567890
-
> 56789012345689
-
> 012345
-
13 short line 13 another long l
-
> ine that needs
-
> to be wrapped
-
14 just fits in!! 14 just fitS in!!
-
15 just fits in t 15 just fits in t
-
> wo lines yup!! > wo lineS yup!!
-
16 the end 16 the end
+
f 1 line 0 f 1 line 0
+
2 12345678901234 2 12345678901234
+
> 56789012345689 > 56789012345689
+
> 012345 > 012345
+
3 line 1 3 line 1
+
n 4 line 2 n 4 line 2 adde
+
> d
+
5 line 3 5 line 3
+
n 6 line 4 chang n 6 line 4 chanG
+
> ed > Ed
+
7 line 5 chang 7 line 5a chanG
+
> ed > ed
+
8 line 6 chang 8 line 6a chang
+
> ed > Ed
+
9 line 7 9 line 7
+
n 10 line 8 subtra n 10 line 8
+
> cted
+
11 line 9 11 line 9
+
t 12 12345678901234 t 12 1234567890
+
> 56789012345689
+
> 012345
+
13 short line 13 another long l
+
> ine that needs
+
> to be wrapped
+
14 just fits in!! 14 just fitS in!!
+
15 just fits in t 15 just fits in t
+
> wo lines yup!! > wo lineS yup!!
+
16 the end 16 the end
- \ No newline at end of file