Coding style

- Rename appearance_min to appearance.
This commit is contained in:
Andrew Hamilton 2022-01-18 16:37:17 +10:00
parent 45af588792
commit dad2a59bca
3 changed files with 12 additions and 12 deletions

View file

@ -106,11 +106,11 @@ class Text:
def get_text(self):
return "\n".join(self)
def appearance_min(self):
def appearance(self):
return self.text
def appearance_for(self, dimensions):
return fill3.appearance_resize(self.appearance_min(), dimensions)
return fill3.appearance_resize(self.appearance(), dimensions)
class Code(Text):
@ -144,8 +144,8 @@ class Decor:
def appearance_for(self, dimensions):
return self.decorator(self.widget.appearance_for(dimensions))
def appearance_min(self):
return self.decorator(self.widget.appearance_min())
def appearance(self):
return self.decorator(self.widget.appearance())
def highlight_part(line, start, end):
@ -610,8 +610,8 @@ class Editor:
self.follow_cursor()
fill3.APPEARANCE_CHANGED_EVENT.set()
def appearance_min(self):
return self.decor_widget.appearance_min()
def appearance(self):
return self.decor_widget.appearance()
_HEADER_STYLE = termstr.CharStyle(fg_color=termstr.Color.white, bg_color=termstr.Color.green)

View file

@ -18,4 +18,4 @@ setup(name="diff-edit",
entry_points={"console_scripts": ["diff-edit=diff_edit:main"]},
install_requires=[
"pygments==2.10.0", "docopt==0.6.2",
"fill3 @ git+https://github.com/ahamilton/eris@v2022.01.13#subdirectory=fill3"])
"fill3 @ git+https://github.com/ahamilton/eris@v2022.01.18#subdirectory=fill3"])

View file

@ -15,7 +15,7 @@ class TextWidgetTestCase(unittest.TestCase):
def test_padding(self):
text = editor.Text("a\nbb")
self.assertEqual(text.appearance_min(), ["a ", "bb"])
self.assertEqual(text.appearance(), ["a ", "bb"])
def test_get_line(self):
text = editor.Text("")
@ -27,22 +27,22 @@ class TextWidgetTestCase(unittest.TestCase):
def test_change_line(self):
text = editor.Text("a\nbb")
text[0] = "aaa"
self.assertEqual(text.appearance_min(), ["aaa", "bb "])
self.assertEqual(text.appearance(), ["aaa", "bb "])
def test_insert_line(self):
text = editor.Text("a\nbb")
text.insert(1, "ccc")
self.assertEqual(text.appearance_min(), ["a ", "ccc", "bb "])
self.assertEqual(text.appearance(), ["a ", "ccc", "bb "])
def test_append_line(self):
text = editor.Text("a")
text.append("bb")
self.assertEqual(text.appearance_min(), ["a ", "bb"])
self.assertEqual(text.appearance(), ["a ", "bb"])
def test_replace_lines(self):
text = editor.Text("a\nbb\nc\nd")
text[1:3] = ["e", "f", "g"]
self.assertEqual(text.appearance_min(), ["a", "e", "f", "g", "d"])
self.assertEqual(text.appearance(), ["a", "e", "f", "g", "d"])
def test_len(self):
text = editor.Text("a\nbb\nc\nd")