-
-
Notifications
You must be signed in to change notification settings - Fork 651
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deduplicate code in zellij-server screen #1453
Deduplicate code in zellij-server screen #1453
Conversation
Also I read in one of the previously existent comments that |
7b10993
to
cdf3e93
Compare
@jaeheonji I fixed the merge conflicts, could you restart the pipelines, please? Also I hope I didn't miss any of the newly added commands... |
which is a convenience function to send the `UnblockInputThread` signal to the zellij server.
as a convenience macro that attempts to get the currently active tab. If the tab is found, it executes a closure (passed by the caller) on this tab. Otherwise, a standardized error message is printed to the error log. This standardizes and deduplicates the loads of: ``` if let Some(active_tab) = screen.get_active_tab_mut(client_id) { active_tab.$FUNCTION(...); } else { log::error!("Active tab not found for client id: {:?}", client_id); } ``` previously present in the code.
cdf3e93
to
f949cb9
Compare
Hey @har7an ! The third refactor (with the render) while very important both for readability and even performance, is not necessarily a trivial one. Maybe it is, but there's quite some hidden and implied behaviour around when and how many times we render. I'd definitely like to address that part separately. Since I'm going on vacation for a couple of weeks now - how about we separate that particular piece out and go ahead with the first two refactors if @jaeheonji think they're good? (I haven't looked through the code myself) Then we can potentially tackle the rendering as a separate issue (and I think we can even include some more performance and readbility optimizations there). |
Humm, I was suspecting there's more to it. :)
That's fine by me. I understand that you will want to have a look at the rendering mechanism first before you make any decisions regarding that? In this case I won't be looking at it any further until you return. In the meantime if you know of some other files that contain amounts of repetition similar to |
f949cb9
to
929d93d
Compare
@imsnif I dropped the third commit, I have it stashed locally in case we want to come back to it some day. Enjoy your vacation! |
Hi,
this is an attempt to deduplicate the code for
Screen
in zellij-server. It's made up of three distinct "improvements" (if I didn't mess up the partial adds, mind):screen.render()
to the bottom of the inner loop after the match, so it is always executed by those match arms that don't explicitly "opt-out" (by callingcontinue
).I hope that this aids the codes readability. Happy to take any feedback you can give me!