Skip to content

Commit

Permalink
Fix tree up/down parents not working when directory sits on very firs…
Browse files Browse the repository at this point in the history
…t/last line
darrenburns committed Jul 10, 2024

Verified

This commit was signed with the committer’s verified signature.
darrenburns Darren Burns
1 parent e4553e9 commit 67c1cbd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/posting/widgets/tree.py
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@ class PostingTree(Tree[T]):
def action_cursor_up_parent(self) -> None:
"""Move the cursor to the previous collapsible node."""
start_line = max(self.cursor_line - 1, 0)
for line in range(start_line, 0, -1):
for line in range(start_line, -1, -1):
node = self.get_node_at_line(line)
if node and node.allow_expand:
self.cursor_line = line
@@ -42,7 +42,7 @@ def action_cursor_down_parent(self) -> None:
"""Move the cursor to the next collapsible node."""
max_index = len(self._tree_lines) - 1
start_line = min(self.cursor_line + 1, max_index)
for line in range(start_line, max_index):
for line in range(start_line, max_index + 1):
node = self.get_node_at_line(line)
if node and node.allow_expand:
self.cursor_line = line

0 comments on commit 67c1cbd

Please sign in to comment.