summaryrefslogtreecommitdiffstats
path: root/zellij-server
diff options
context:
space:
mode:
authorKunal Mohan <kunalmohan99@gmail.com>2021-05-25 13:11:37 +0530
committerKunal Mohan <kunalmohan99@gmail.com>2021-05-25 13:11:37 +0530
commitc60abe6ad634d9889a95c0043bfb0e05105a1e29 (patch)
treeaae5d91a409901cc196c196b6cd34d10c900fd1f /zellij-server
parentcba7c07cd66c15be82e32c3e6766feac88dce3ff (diff)
CHange keybind for Session mode and add comments for clarity
Diffstat (limited to 'zellij-server')
-rw-r--r--zellij-server/src/lib.rs3
-rw-r--r--zellij-server/src/os_input_output.rs5
-rw-r--r--zellij-server/src/tab.rs1
3 files changed, 9 insertions, 0 deletions
diff --git a/zellij-server/src/lib.rs b/zellij-server/src/lib.rs
index 7a5aed1ec..aeb13cb56 100644
--- a/zellij-server/src/lib.rs
+++ b/zellij-server/src/lib.rs
@@ -265,6 +265,9 @@ pub fn start_server(os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) {
}
ServerInstruction::Render(output) => {
if *session_state.read().unwrap() == SessionState::Attached {
+ // Here output is of type Option<String> sent by screen thread.
+ // If `Some(_)`- unwrap it and forward it to the client to render.
+ // If `None`- Send an exit instruction. This is the case when the user closes last Tab/Pane.
if let Some(op) = output {
os_input.send_to_client(ServerToClientMsg::Render(op));
} else {
diff --git a/zellij-server/src/os_input_output.rs b/zellij-server/src/os_input_output.rs
index 51903c9a5..bef3445ff 100644
--- a/zellij-server/src/os_input_output.rs
+++ b/zellij-server/src/os_input_output.rs
@@ -159,6 +159,11 @@ pub trait ServerOsApi: Send + Sync {
fn send_to_client(&self, msg: ServerToClientMsg);
/// Adds a sender to client
fn add_client_sender(&self);
+ /// Send to the temporary client
+ // A temporary client is the one that hasn't been registered as a client yet.
+ // Only the corresponding router thread has access to send messages to it.
+ // This can be the case when the client cannot attach to the session,
+ // so it tries to connect and then exits, hence temporary.
fn send_to_temp_client(&self, msg: ServerToClientMsg);
/// Removes the sender to client
fn remove_client_sender(&self);
diff --git a/zellij-server/src/tab.rs b/zellij-server/src/tab.rs
index 68d01ec09..4a0db153d 100644
--- a/zellij-server/src/tab.rs
+++ b/zellij-server/src/tab.rs
@@ -730,6 +730,7 @@ impl Tab {
{
// we might not have an active terminal if we closed the last pane
// in that case, we should not render as the app is exiting
+ // or if this session is not attached to a client, we do not have to render
return;
}
// if any pane contain widechar, all pane in the same row will messup. We should render them every time