Skip to content

Commit 91bb5f1

Browse files
committed
fix: In parse_mode=both a connection re-appeared after toggling the list two times
dssh-origin: 49e39da
1 parent 7738fd2 commit 91bb5f1

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

internal/tui/app.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,8 @@ func (m AppModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
277277
name := m.deleteModel.lastDeleted
278278
m.connectModel.RemoveByName(name)
279279
m.editModel.RemoveByName(name)
280+
m.sqliteConns = removeConnByName(m.sqliteConns, name)
281+
m.sshConfigConns = removeConnByName(m.sshConfigConns, name)
280282
m.deleteModel.lastDeleted = ""
281283
m.setStatus(fmt.Sprintf("%q deleted", name), successStyle)
282284
}
@@ -910,6 +912,15 @@ func (m *AppModel) setError(format string, a ...any) {
910912
m.statusMsgRight = false
911913
}
912914

915+
func removeConnByName(conns []model.Connection, name string) []model.Connection {
916+
for i, c := range conns {
917+
if c.Name == name {
918+
return append(conns[:i], conns[i+1:]...)
919+
}
920+
}
921+
return conns
922+
}
923+
913924
func expandTildeTUI(path string) string {
914925
if strings.HasPrefix(path, "~/") {
915926
home, err := os.UserHomeDir()

0 commit comments

Comments
 (0)