Coding style
- Rename appearance_min to appearance.
This commit is contained in:
parent
45af588792
commit
dad2a59bca
3 changed files with 12 additions and 12 deletions
|
|
@ -106,11 +106,11 @@ class Text:
|
||||||
def get_text(self):
|
def get_text(self):
|
||||||
return "\n".join(self)
|
return "\n".join(self)
|
||||||
|
|
||||||
def appearance_min(self):
|
def appearance(self):
|
||||||
return self.text
|
return self.text
|
||||||
|
|
||||||
def appearance_for(self, dimensions):
|
def appearance_for(self, dimensions):
|
||||||
return fill3.appearance_resize(self.appearance_min(), dimensions)
|
return fill3.appearance_resize(self.appearance(), dimensions)
|
||||||
|
|
||||||
|
|
||||||
class Code(Text):
|
class Code(Text):
|
||||||
|
|
@ -144,8 +144,8 @@ class Decor:
|
||||||
def appearance_for(self, dimensions):
|
def appearance_for(self, dimensions):
|
||||||
return self.decorator(self.widget.appearance_for(dimensions))
|
return self.decorator(self.widget.appearance_for(dimensions))
|
||||||
|
|
||||||
def appearance_min(self):
|
def appearance(self):
|
||||||
return self.decorator(self.widget.appearance_min())
|
return self.decorator(self.widget.appearance())
|
||||||
|
|
||||||
|
|
||||||
def highlight_part(line, start, end):
|
def highlight_part(line, start, end):
|
||||||
|
|
@ -610,8 +610,8 @@ class Editor:
|
||||||
self.follow_cursor()
|
self.follow_cursor()
|
||||||
fill3.APPEARANCE_CHANGED_EVENT.set()
|
fill3.APPEARANCE_CHANGED_EVENT.set()
|
||||||
|
|
||||||
def appearance_min(self):
|
def appearance(self):
|
||||||
return self.decor_widget.appearance_min()
|
return self.decor_widget.appearance()
|
||||||
|
|
||||||
_HEADER_STYLE = termstr.CharStyle(fg_color=termstr.Color.white, bg_color=termstr.Color.green)
|
_HEADER_STYLE = termstr.CharStyle(fg_color=termstr.Color.white, bg_color=termstr.Color.green)
|
||||||
|
|
||||||
|
|
|
||||||
2
setup.py
2
setup.py
|
|
@ -18,4 +18,4 @@ setup(name="diff-edit",
|
||||||
entry_points={"console_scripts": ["diff-edit=diff_edit:main"]},
|
entry_points={"console_scripts": ["diff-edit=diff_edit:main"]},
|
||||||
install_requires=[
|
install_requires=[
|
||||||
"pygments==2.10.0", "docopt==0.6.2",
|
"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"])
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ class TextWidgetTestCase(unittest.TestCase):
|
||||||
|
|
||||||
def test_padding(self):
|
def test_padding(self):
|
||||||
text = editor.Text("a\nbb")
|
text = editor.Text("a\nbb")
|
||||||
self.assertEqual(text.appearance_min(), ["a ", "bb"])
|
self.assertEqual(text.appearance(), ["a ", "bb"])
|
||||||
|
|
||||||
def test_get_line(self):
|
def test_get_line(self):
|
||||||
text = editor.Text("")
|
text = editor.Text("")
|
||||||
|
|
@ -27,22 +27,22 @@ class TextWidgetTestCase(unittest.TestCase):
|
||||||
def test_change_line(self):
|
def test_change_line(self):
|
||||||
text = editor.Text("a\nbb")
|
text = editor.Text("a\nbb")
|
||||||
text[0] = "aaa"
|
text[0] = "aaa"
|
||||||
self.assertEqual(text.appearance_min(), ["aaa", "bb "])
|
self.assertEqual(text.appearance(), ["aaa", "bb "])
|
||||||
|
|
||||||
def test_insert_line(self):
|
def test_insert_line(self):
|
||||||
text = editor.Text("a\nbb")
|
text = editor.Text("a\nbb")
|
||||||
text.insert(1, "ccc")
|
text.insert(1, "ccc")
|
||||||
self.assertEqual(text.appearance_min(), ["a ", "ccc", "bb "])
|
self.assertEqual(text.appearance(), ["a ", "ccc", "bb "])
|
||||||
|
|
||||||
def test_append_line(self):
|
def test_append_line(self):
|
||||||
text = editor.Text("a")
|
text = editor.Text("a")
|
||||||
text.append("bb")
|
text.append("bb")
|
||||||
self.assertEqual(text.appearance_min(), ["a ", "bb"])
|
self.assertEqual(text.appearance(), ["a ", "bb"])
|
||||||
|
|
||||||
def test_replace_lines(self):
|
def test_replace_lines(self):
|
||||||
text = editor.Text("a\nbb\nc\nd")
|
text = editor.Text("a\nbb\nc\nd")
|
||||||
text[1:3] = ["e", "f", "g"]
|
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):
|
def test_len(self):
|
||||||
text = editor.Text("a\nbb\nc\nd")
|
text = editor.Text("a\nbb\nc\nd")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue