editor: Fix syntax highlighting of wide characters in tabs

- Needed a wide character aware expandtabs.
This commit is contained in:
Andrew Hamilton 2022-03-06 22:43:21 +10:00
parent 8b93c3ae4e
commit 7986f1c7d9
2 changed files with 33 additions and 4 deletions

View file

@ -69,6 +69,16 @@ class TextWidgetTestCase(unittest.TestCase):
self.assertEqual(editor.expand_str_inverse("\tb"), [0, 0, 1, 1, 1, 1, 1, 1, 2])
class ExpandTabsTestCase(unittest.TestCase):
def test_expand_tabs(self):
self.assertEqual(editor.expandtabs(""), "")
self.assertEqual(editor.expandtabs("a"), "a")
self.assertEqual(editor.expandtabs("a\tb"), "a b")
self.assertEqual(editor.expandtabs("a♓\tb"), "a♓ b")
self.assertEqual(editor.expandtabs("c\na♓\tb"), "c\na♓ b")
class EditorTestCase(unittest.TestCase):
def setUp(self):