Fix various small things
A commit that fixes all of the little things I forgot about, but that are necessary for rendering to function properly. - (attr. lines) reverse lines before extending above - (attr. lines) clamp the AttributedLine offset so that there is always a line with offset 0 - (tree renderer) use meta spaces for the cursor too - (tree renderer) use correct indent text for cursor - (tree renderer) fix mypy error by safely ignoring it - (supply) sort by root id instead of value - (supply) return id, not list of ids
This commit is contained in:
parent
5a606a9191
commit
5e10fcecac
3 changed files with 10 additions and 6 deletions
|
|
@ -156,8 +156,10 @@ class CursorTreeRenderer(Generic[E]):
|
|||
) -> AttributedLines:
|
||||
lines = AttributedLines()
|
||||
width = self._width - len(indent) - self._renderer.meta_width
|
||||
meta_spaces = AT(" " * self._renderer.meta_width)
|
||||
attrs = {"cursor": True, "offset": 0}
|
||||
lines.append_below(attrs, self._renderer.render_cursor(width))
|
||||
lines.append_below(attrs, meta_spaces + indent +
|
||||
self._renderer.render_cursor(width))
|
||||
return lines
|
||||
|
||||
def _render_indent(self,
|
||||
|
|
@ -217,7 +219,7 @@ class CursorTreeRenderer(Generic[E]):
|
|||
lines.lower_offset = -1
|
||||
|
||||
cursor_indent = indent + self._render_indent(cursor_line=True)
|
||||
lines.extend_below(self._render_cursor(indent))
|
||||
lines.extend_below(self._render_cursor(cursor_indent))
|
||||
|
||||
def _render_tree(self, root_id: Id) -> AttributedLines:
|
||||
lines = AttributedLines()
|
||||
|
|
@ -350,8 +352,9 @@ class CursorTreeRenderer(Generic[E]):
|
|||
if self._cursor_id is None and self._anchor_id is None:
|
||||
return self._render_lines_from_cursor()
|
||||
|
||||
working_id: Id
|
||||
if self._anchor_id is None:
|
||||
working_id = self._cursor_id
|
||||
working_id = self._cursor_id # type: ignore
|
||||
else:
|
||||
working_id = self._anchor_id
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue