Skip to content

Commit

Permalink
Add going to currently selecte path and going up.
Browse files Browse the repository at this point in the history
  • Loading branch information
Heiner committed Aug 29, 2022
1 parent 34b4db1 commit b21ab6c
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions filesizeview.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,11 @@ def __init__(self, mainwin, _dir, draw_frame):
if self._path_index < len(self._selected_path) - 1:
self._path_index += 1
self.write_path()
elif ch == ord("u"):
if len(self._selected_path) > 2:
self.go_to_file(self._selected_path[-2])
elif ch == ord("\n"):
self.go_to_file(self._selected_path[self._path_index])
elif ch == ord("\t"): # Select next sibling based on msg window.
self.select_sibling_path()
elif ch == curses.KEY_UP or ch == ord("k"):
Expand Down Expand Up @@ -417,14 +422,18 @@ def select_sibling_path(self):
if len(path) == 1:
if not path[0].files:
return
win = path[0].files[0].window
else:
directory, curfile = path[-2:]
index = directory.files.index(curfile)
index += 1
index %= len(directory.files)
win = directory.files[index].window
y, x = win.getbegyx()
return self.go_to_file(path[0].files[0])

directory, curfile = path[-2:]
index = directory.files.index(curfile)
index += 1
index %= len(directory.files)
self.go_to_file(directory.files[index])

def go_to_file(self, f):
if not f:
return
y, x = f.window.getbegyx()
self.set_cursor(y, x)

def write_path(self):
Expand Down

0 comments on commit b21ab6c

Please sign in to comment.