Display wide characters correctly.
- Made termstr's length match the on-screen width.
- Achieved by adding a zero width character after each wide
character.
- This fixes ljust and rjust, so that there is correct padding,
otherwise Portal appearances aren't the correct width.
- When getting a sub-string containing half a wide character,
the half character is a space.
- Some wide characters are still broken. e.g. country flags
This commit is contained in:
parent
c4fb3fdfe3
commit
c91beda9b4
3 changed files with 34 additions and 7 deletions
|
|
@ -101,6 +101,11 @@ class TermStrTests(unittest.TestCase):
|
|||
self.assertEqual(foo_bold.ljust(5), foo_bold + TermStr(" "))
|
||||
self.assertEqual(foo_bold.rjust(0), foo_bold)
|
||||
self.assertEqual(foo_bold.rjust(5), TermStr(" ") + foo_bold)
|
||||
baz = TermStr("b👋z")
|
||||
self.assertEqual(len(baz), 4)
|
||||
self.assertEqual(baz[3:], TermStr("z"))
|
||||
self.assertEqual(baz[:2], TermStr("b "))
|
||||
self.assertEqual(baz[2:], TermStr(" z"))
|
||||
|
||||
def test_from_term(self):
|
||||
def test_round_trip(term_str):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue