summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDjLegolas <djlegolas@protonmail.com>2022-08-01 20:10:27 +0300
committerCalum Lind <calumlind+deluge@gmail.com>2023-02-27 17:39:00 +0000
commit7336877928559c8b5ef6d8c5a9cb9fdc521bbed6 (patch)
treef50472e8a46ccaf89ae74a5bdd09565c6e173c9b
parent543fce4f296d65526c746e2bf8ba7a89c906ff87 (diff)
downloaddeluge-7336877928559c8b5ef6d8c5a9cb9fdc521bbed6.tar.gz
deluge-7336877928559c8b5ef6d8c5a9cb9fdc521bbed6.tar.bz2
deluge-7336877928559c8b5ef6d8c5a9cb9fdc521bbed6.zip
[console] Fix host deletion
The host id didn't receive correctly and the indexing was not being updated correctly. Closes: https://github.com/deluge-torrent/deluge/pull/393
-rw-r--r--deluge/ui/console/modes/connectionmanager.py3
-rw-r--r--deluge/ui/console/widgets/popup.py2
2 files changed, 3 insertions, 2 deletions
diff --git a/deluge/ui/console/modes/connectionmanager.py b/deluge/ui/console/modes/connectionmanager.py
index 6cf5e79b5..ce8b6f554 100644
--- a/deluge/ui/console/modes/connectionmanager.py
+++ b/deluge/ui/console/modes/connectionmanager.py
@@ -197,7 +197,8 @@ class ConnectionManager(BaseMode, PopupsHandler):
if chr(c) == 'q':
return
elif chr(c) == 'D':
- host_id = self.popup.current_selection()[1]
+ host_index = self.popup.current_selection()
+ host_id = self.popup.inputs[host_index].name
self.delete_host(host_id)
return
elif chr(c) == 'a':
diff --git a/deluge/ui/console/widgets/popup.py b/deluge/ui/console/widgets/popup.py
index 90ecaaf06..07d667d27 100644
--- a/deluge/ui/console/widgets/popup.py
+++ b/deluge/ui/console/widgets/popup.py
@@ -251,7 +251,7 @@ class SelectablePopup(BaseInputPane, Popup):
def set_selection(self, index):
"""Set a selected index"""
- self.active_input = index
+ self.active_input = min(index, len(self.inputs) - 1)
def add_line(
self,