Make frontend request tab list on initialization

This commit is contained in:
Keavon Chambers
2021-07-15 00:07:21 -07:00
parent 2e579a3ac6
commit 0b44a17a5d
3 changed files with 16 additions and 1 deletions

View File

@@ -35,6 +35,7 @@ pub enum DocumentMessage {
CloseAllDocumentsWithConfirmation,
CloseAllDocuments,
NewDocument,
GetOpenDocumentsList,
NextDocument,
PrevDocument,
ExportDocument,
@@ -303,6 +304,11 @@ impl MessageHandler<DocumentMessage, &InputPreprocessor> for DocumentMessageHand
);
responses.push_back(SelectDocument(self.active_document_index).into());
}
GetOpenDocumentsList => {
// Send the list of document tab names
let open_documents = self.documents.iter().map(|doc| doc.name.clone()).collect();
responses.push_back(FrontendMessage::UpdateOpenDocumentsList { open_documents }.into());
}
NextDocument => {
let id = (self.active_document_index + 1) % self.documents.len();
responses.push_back(SelectDocument(id).into());