Keep TUI cursor stable after plugin toggle
This commit is contained in:
@@ -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."
|
||||
|
||||
Reference in New Issue
Block a user