Handle separate Closed-message

This commit is contained in:
Sofia 2026-07-16 02:58:16 +03:00
parent a7b690ec9f
commit 423abba4c3
3 changed files with 10 additions and 2 deletions

View File

@ -64,6 +64,9 @@ impl INode for NetworkManager {
CliColor::Error, CliColor::Error,
); );
} }
peer.close();
}
teanet::PeerMessage::Closed => {
self.peer = None; self.peer = None;
} }
} }
@ -96,6 +99,11 @@ impl INode for NetworkManager {
); );
} }
} }
teanet::PeerMessage::Closed => {
cli.bind_mut()
.publish_message(format!("Server closed"), CliColor::Info);
self.peer = None;
}
} }
} }
} }

View File

@ -101,7 +101,6 @@ impl CommandLinePanel {
input.clear(); input.clear();
} }
self.handle_command(&command); self.handle_command(&command);
self.scroll_next_update = true;
} }
pub fn publish_message(&mut self, message: String, color: CliColor) { pub fn publish_message(&mut self, message: String, color: CliColor) {
@ -112,6 +111,7 @@ impl CommandLinePanel {
field.append_text(&format!("[color={}]", color.as_str())); field.append_text(&format!("[color={}]", color.as_str()));
field.append_text(&message); field.append_text(&message);
field.append_text("[/color]"); field.append_text("[/color]");
self.scroll_next_update = true;
} }
} }

@ -1 +1 @@
Subproject commit f3429ff4e86bb68b1fe42f908aaf561b3a9f3976 Subproject commit b9e40ceede958b8f79cbb5bff3d1b0fe16454321