Fix host navigation to work with alphabetical host ordering
- Fix host_index calculation for localhost to use actual position in sorted list - Remove incorrect assumption that localhost is always at index 0 - Host navigation (Tab key) now works correctly with all hosts in alphabetical order Fixes issue where only 3 of 5 hosts were accessible via Tab navigation.
This commit is contained in:
parent
d349e2742d
commit
959745b51b
@ -146,8 +146,9 @@ impl TuiApp {
|
||||
if !self.available_hosts.is_empty() {
|
||||
if self.available_hosts.contains(&localhost) && !self.user_navigated_away {
|
||||
// Localhost is available and user hasn't navigated away - switch to it
|
||||
self.current_host = Some(localhost);
|
||||
self.host_index = 0; // localhost is always first in sorted_hosts
|
||||
self.current_host = Some(localhost.clone());
|
||||
// Find the actual index of localhost in the sorted list
|
||||
self.host_index = self.available_hosts.iter().position(|h| h == &localhost).unwrap_or(0);
|
||||
} else if self.current_host.is_none() {
|
||||
// No current host - select first available (which is localhost if available)
|
||||
self.current_host = Some(self.available_hosts[0].clone());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user