aboutsummaryrefslogtreecommitdiffstats
path: root/src/server
diff options
context:
space:
mode:
authorKunal Mohan <kunalmohan99@gmail.com>2021-04-28 21:13:19 +0530
committerKunal Mohan <kunalmohan99@gmail.com>2021-05-04 20:48:16 +0530
commit42079f8d048fc2ec4dad9b135efb93e31cf2ecb6 (patch)
tree0b976b61742f205601d44d68cdc269f50acb62d2 /src/server
parentUse interprocess crate for IPC (diff)
downloadsl0ppij-42079f8d048fc2ec4dad9b135efb93e31cf2ecb6.tar.gz
sl0ppij-42079f8d048fc2ec4dad9b135efb93e31cf2ecb6.tar.xz
sl0ppij-42079f8d048fc2ec4dad9b135efb93e31cf2ecb6.zip
Refactor CommandIsExecuting to have a single variant
Diffstat (limited to 'src/server')
-rw-r--r--src/server/mod.rs38
1 files changed, 15 insertions, 23 deletions
diff --git a/src/server/mod.rs b/src/server/mod.rs
index 7164930c..904093f0 100644
--- a/src/server/mod.rs
+++ b/src/server/mod.rs
@@ -43,9 +43,7 @@ pub enum ServerInstruction {
NewClient(PositionAndSize),
Action(Action),
Render(Option<String>),
- DoneClosingPane,
- DoneOpeningNewPane,
- DoneUpdatingTabs,
+ UnblockInputThread,
ClientExit,
}
@@ -132,14 +130,8 @@ pub fn start_server(os_input: Box<dyn ServerOsApi>, opts: CliArgs) -> thread::Jo
.send(PtyInstruction::NewTab)
.unwrap();
}
- ServerInstruction::DoneClosingPane => {
- os_input.send_to_client(ClientInstruction::DoneClosingPane);
- }
- ServerInstruction::DoneOpeningNewPane => {
- os_input.send_to_client(ClientInstruction::DoneOpeningNewPane);
- }
- ServerInstruction::DoneUpdatingTabs => {
- os_input.send_to_client(ClientInstruction::DoneUpdatingTabs);
+ ServerInstruction::UnblockInputThread => {
+ os_input.send_to_client(ClientInstruction::UnblockInputThread);
}
ServerInstruction::ClientExit => {
*sessions.write().unwrap() = None;
@@ -313,13 +305,13 @@ fn init_session(
PtyInstruction::ClosePane(id) => {
pty_bus.close_pane(id);
send_server_instructions
- .send(ServerInstruction::DoneClosingPane)
+ .send(ServerInstruction::UnblockInputThread)
.unwrap();
}
PtyInstruction::CloseTab(ids) => {
pty_bus.close_tab(ids);
send_server_instructions
- .send(ServerInstruction::DoneClosingPane)
+ .send(ServerInstruction::UnblockInputThread)
.unwrap();
}
PtyInstruction::Exit => {
@@ -382,21 +374,21 @@ fn init_session(
screen.get_active_tab_mut().unwrap().new_pane(pid);
screen
.send_server_instructions
- .send(ServerInstruction::DoneOpeningNewPane)
+ .send(ServerInstruction::UnblockInputThread)
.unwrap();
}
ScreenInstruction::HorizontalSplit(pid) => {
screen.get_active_tab_mut().unwrap().horizontal_split(pid);
screen
.send_server_instructions
- .send(ServerInstruction::DoneOpeningNewPane)
+ .send(ServerInstruction::UnblockInputThread)
.unwrap();
}
ScreenInstruction::VerticalSplit(pid) => {
screen.get_active_tab_mut().unwrap().vertical_split(pid);
screen
.send_server_instructions
- .send(ServerInstruction::DoneOpeningNewPane)
+ .send(ServerInstruction::UnblockInputThread)
.unwrap();
}
ScreenInstruction::WriteCharacter(bytes) => {
@@ -493,49 +485,49 @@ fn init_session(
screen.new_tab(pane_id);
screen
.send_server_instructions
- .send(ServerInstruction::DoneUpdatingTabs)
+ .send(ServerInstruction::UnblockInputThread)
.unwrap();
}
ScreenInstruction::SwitchTabNext => {
screen.switch_tab_next();
screen
.send_server_instructions
- .send(ServerInstruction::DoneUpdatingTabs)
+ .send(ServerInstruction::UnblockInputThread)
.unwrap();
}
ScreenInstruction::SwitchTabPrev => {
screen.switch_tab_prev();
screen
.send_server_instructions
- .send(ServerInstruction::DoneUpdatingTabs)
+ .send(ServerInstruction::UnblockInputThread)
.unwrap();
}
ScreenInstruction::CloseTab => {
screen.close_tab();
screen
.send_server_instructions
- .send(ServerInstruction::DoneUpdatingTabs)
+ .send(ServerInstruction::UnblockInputThread)
.unwrap();
}
ScreenInstruction::ApplyLayout(layout, new_pane_pids) => {
screen.apply_layout(Layout::new(layout), new_pane_pids);
screen
.send_server_instructions
- .send(ServerInstruction::DoneUpdatingTabs)
+ .send(ServerInstruction::UnblockInputThread)
.unwrap();
}
ScreenInstruction::GoToTab(tab_index) => {
screen.go_to_tab(tab_index as usize);
screen
.send_server_instructions
- .send(ServerInstruction::DoneUpdatingTabs)
+ .send(ServerInstruction::UnblockInputThread)
.unwrap();
}
ScreenInstruction::UpdateTabName(c) => {
screen.update_active_tab_name(c);
screen
.send_server_instructions
- .send(ServerInstruction::DoneUpdatingTabs)
+ .send(ServerInstruction::UnblockInputThread)
.unwrap();
}
ScreenInstruction::ChangeMode(mode_info) => {