Keep TUI cursor stable after plugin toggle

This commit is contained in:
2026-07-05 14:05:35 -07:00
parent 400e69289c
commit 74ac0a1c1d
3 changed files with 94 additions and 1 deletions
+5
View File
@@ -256,6 +256,9 @@ class PluginHelperTui(App[int]):
self._show_installations()
return
target = self.selected_installation
selected_row: int | None = None
if self.mode == "plugins" and self.plugin_rows:
selected_row = self._cursor_index(len(self.plugin_rows))
self.mode = "plugins"
self._set_title(f"{target.install_label} / {target.instance_name}")
table = self.query_one(DataTable)
@@ -285,6 +288,8 @@ class PluginHelperTui(App[int]):
str(plugin["fileCount"]),
plugin["asset"],
)
if selected_row is not None and self.plugin_rows:
table.move_cursor(row=min(selected_row, len(self.plugin_rows) - 1))
if not preserve_status:
if self.plugin_rows:
back_hint = "" if len(self.choices) == 1 else " b returns to installations."