aboutsummaryrefslogtreecommitdiff
path: root/app/ui/tui.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/ui/tui.py')
-rw-r--r--app/ui/tui.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/app/ui/tui.py b/app/ui/tui.py
index 19764ab..a4854b0 100644
--- a/app/ui/tui.py
+++ b/app/ui/tui.py
@@ -348,7 +348,9 @@ class Frame:
# Optional scroll-indicator formatter: called as
# scroll_label(scroll, total_lines, visible) whenever the frame
# draws its border while the content overflows. None keeps the
- # compact default " x/y " (used by menus, trees, the browser).
+ # compact default (used by menus, forms, trees, the browser):
+ # with a cursor it reads " highlighted/entries ", without one
+ # " first-visible-line/total-lines ".
self.scroll_label = None
try:
curses.curs_set(0)
@@ -543,7 +545,16 @@ class Frame:
indicator = self.scroll_label(self.scroll, total_lines,
visible)
else:
- indicator = f" {self.scroll + 1}/{total_lines} "
+ # With a cursor the label counts selectable rows: which
+ # entry is highlighted (the Nth option of a menu, the
+ # Nth field of a form, a tree node). Frames without a
+ # cursor keep the first-visible-line reading.
+ selectable = self.selectable()
+ if self.cursor is not None and self.cursor in selectable:
+ indicator = f" {selectable.index(self.cursor) + 1}/" \
+ f"{len(selectable)} "
+ else:
+ indicator = f" {self.scroll + 1}/{total_lines} "
_addstr(scr, y0, max(x0 + 1, x0 + dialog_w - 1 - len(indicator)),
indicator, theme["dim"])