Coding style

- Rename appearance to appearance_for.
This commit is contained in:
Andrew Hamilton 2022-01-18 16:32:58 +10:00
parent d9e95c1485
commit 45af588792
2 changed files with 8 additions and 8 deletions

View file

@ -332,7 +332,7 @@ class DiffEditor:
line[-1] = ""
return columns
def appearance(self, dimensions):
def appearance_for(self, dimensions):
width, height = self.last_dimensions = dimensions
if self.diff is None:
self.update_diff()
@ -340,8 +340,8 @@ class DiffEditor:
divider_width = 3
left_width = (width - divider_width) // 2
right_width = width - divider_width - left_width
left_appearance = self.left_editor.appearance((left_width, height))
right_appearance = self.right_editor.appearance((right_width, height))
left_appearance = self.left_editor.appearance_for((left_width, height))
right_appearance = self.right_editor.appearance_for((right_width, height))
inactive_appearance = (right_appearance if self.left_editor is self.editors[0]
else left_appearance)
inactive_appearance[0] = highlight_str(inactive_appearance[0], termstr.Color.black, 0.5)

View file

@ -109,7 +109,7 @@ class Text:
def appearance_min(self):
return self.text
def appearance(self, dimensions):
def appearance_for(self, dimensions):
return fill3.appearance_resize(self.appearance_min(), dimensions)
@ -141,8 +141,8 @@ class Decor:
self.widget = widget
self.decorator = decorator
def appearance(self, dimensions):
return self.decorator(self.widget.appearance(dimensions))
def appearance_for(self, dimensions):
return self.decorator(self.widget.appearance_for(dimensions))
def appearance_min(self):
return self.decorator(self.widget.appearance_min())
@ -623,13 +623,13 @@ class Editor:
return (termstr.TermStr(" " + path_part, self._HEADER_STYLE).bold() +
termstr.TermStr(cursor_position + " ", self._HEADER_STYLE))
def appearance(self, dimensions):
def appearance_for(self, dimensions):
width, height = dimensions
is_changed = self.text_widget.actual_text != self.original_text
header = self.get_header(self.path, width, self.cursor_x, self.cursor_y, is_changed)
self.last_width = width
self.last_height = height
result = [header] + self.view_widget.appearance((width, height - 1))
result = [header] + self.view_widget.appearance_for((width, height - 1))
return result
KEY_MAP = {