Commit fccb0d2d authored by Terry Jan Reedy's avatar Terry Jan Reedy

Issue #18365: normalize whitespace

parent 16c10704
...@@ -210,7 +210,7 @@ class Text(object): ...@@ -210,7 +210,7 @@ class Text(object):
endline, endchar = startline+1, 0 endline, endchar = startline+1, 0
else: else:
# do not delete terminal \n if index1 == 'insert' # do not delete terminal \n if index1 == 'insert'
return return
else: else:
endline, endchar = self._decode(index2, -1) endline, endchar = self._decode(index2, -1)
# restricting end position to insert position excludes terminal \n # restricting end position to insert position excludes terminal \n
...@@ -219,11 +219,11 @@ class Text(object): ...@@ -219,11 +219,11 @@ class Text(object):
self.data[startline] = self.data[startline][:startchar] + \ self.data[startline] = self.data[startline][:startchar] + \
self.data[startline][endchar:] self.data[startline][endchar:]
elif startline < endline: elif startline < endline:
self.data[startline] = self.data[startline][:startchar] + \ self.data[startline] = self.data[startline][:startchar] + \
self.data[endline][endchar:] self.data[endline][endchar:]
startline += 1 startline += 1
for i in range(startline, endline+1): for i in range(startline, endline+1):
del self.data[startline] del self.data[startline]
def compare(self, index1, op, index2): def compare(self, index1, op, index2):
line1, char1 = self._decode(index1) line1, char1 = self._decode(index1)
......
...@@ -36,7 +36,7 @@ class TextTest(object): ...@@ -36,7 +36,7 @@ class TextTest(object):
self.assertEqual(index(dex), '1.0') self.assertEqual(index(dex), '1.0')
for dex in '1.0 lineend', '1.end', '1.33': for dex in '1.0 lineend', '1.end', '1.33':
self.assertEqual(index(dex), '1.5') self.assertEqual(index(dex), '1.5')
for dex in 'end', '33.44': for dex in 'end', '33.44':
self.assertEqual(index(dex), '3.0') self.assertEqual(index(dex), '3.0')
...@@ -225,4 +225,3 @@ class TkTextTest(TextTest, unittest.TestCase): ...@@ -225,4 +225,3 @@ class TkTextTest(TextTest, unittest.TestCase):
if __name__ == '__main__': if __name__ == '__main__':
unittest.main(verbosity=2, exit=False) unittest.main(verbosity=2, exit=False)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment