Fix compiler warnings (#4053)
* chore(cargo): Update dependencies for xtask subcommand to remove warnings about unknown compiler attributes. * deps(xtask): Remove `lazy_static` as dependency, since the code we need can now be expressed using rusts `std` builtin types. * fix(xtask): Hide deprecated args so the compiler doesn't complain about dead code any more. * fix(xtask): Remove needless borrow. * fix: Remove dead code across the codebase, as discovered by the rust compiler. * fix(server): Log previously ignored errors. * fix(xtask): Remove needless `format!` calls. * fix(xtask): Remove superfluous return statement. * fix(client): Remove unused enum variant from `ClientInstruction` and all code attached to it. * fix(server): Restore functions needed in tests. * chore: Apply rustfmt. * fix(server): Add missing code. * fix: Remove leftover warnings. * CHANGELOG: Add MR #4026. * fix(xtask): Pin `xshell` to version 0.2.2 because release 0.2.3 changed the way stdin is handled, breaking interactive command invocations (such as we use).
This commit is contained in:
parent
92e209a307
commit
502af243e0
22 changed files with 144 additions and 207 deletions
|
|
@ -44,6 +44,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
|||
* fix(grid): out of bounds removal when app does not update its scroll region on resize (https://github.com/zellij-org/zellij/pull/4045)
|
||||
* fix(plugins): prevent paging plugins from cache at runtime (https://github.com/zellij-org/zellij/pull/4044)
|
||||
* fix(ui): add split right/down shortcut hints to the status-bar (https://github.com/zellij-org/zellij/pull/4046)
|
||||
* chore(repo): remove compile warnings (https://github.com/zellij-org/zellij/pull/4026)
|
||||
|
||||
## [0.41.2] - 2024-11-19
|
||||
* fix(input): keypresses not being identified properly with kitty keyboard protocol in some terminals (https://github.com/zellij-org/zellij/pull/3725)
|
||||
|
|
|
|||
19
Cargo.lock
generated
19
Cargo.lock
generated
|
|
@ -463,7 +463,7 @@ dependencies = [
|
|||
"cap-primitives",
|
||||
"cap-std",
|
||||
"io-lifetimes 2.0.3",
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -491,7 +491,7 @@ dependencies = [
|
|||
"ipnet",
|
||||
"maybe-owned",
|
||||
"rustix 0.38.44",
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.59.0",
|
||||
"winx",
|
||||
]
|
||||
|
||||
|
|
@ -1171,7 +1171,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1852,7 +1852,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "2285ddfe3054097ef4b2fe909ef8c3bcd1ea52a8f0d274416caebeef39f04a65"
|
||||
dependencies = [
|
||||
"io-lifetimes 2.0.3",
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -3173,7 +3173,7 @@ dependencies = [
|
|||
"libc",
|
||||
"linux-raw-sys 0.4.15",
|
||||
"once_cell",
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -5102,18 +5102,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "xflags"
|
||||
version = "0.3.1"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c4554b580522d0ca238369c16b8f6ce34524d61dafe7244993754bbd05f2c2ea"
|
||||
checksum = "7d9e15fbb3de55454b0106e314b28e671279009b363e6f1d8e39fdc3bf048944"
|
||||
dependencies = [
|
||||
"xflags-macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "xflags-macros"
|
||||
version = "0.3.1"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f58e7b3ca8977093aae6b87b6a7730216fc4c53a6530bab5c43a783cd810c1a8"
|
||||
checksum = "672423d4fea7ffa2f6c25ba60031ea13dc6258070556f125cc4d790007d4a155"
|
||||
|
||||
[[package]]
|
||||
name = "xshell"
|
||||
|
|
@ -5135,7 +5135,6 @@ name = "xtask"
|
|||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"lazy_static",
|
||||
"prost-build",
|
||||
"toml 0.5.10",
|
||||
"which",
|
||||
|
|
|
|||
|
|
@ -6,9 +6,14 @@ edition = "2021"
|
|||
|
||||
[dependencies]
|
||||
anyhow = "1.0"
|
||||
lazy_static = "1.4"
|
||||
# TODO(hartan): Update this once we get a new release. See:
|
||||
# <https://github.com/matklad/xshell/issues/63>
|
||||
xshell = "= 0.2.2"
|
||||
xflags = "0.3.1"
|
||||
xflags = "0.3.2"
|
||||
which = "4.2"
|
||||
toml = "0.5"
|
||||
prost-build = "0.11.9"
|
||||
|
||||
[lints.rust]
|
||||
# Only required because we need to fix `xshell` to `=0.2.2`
|
||||
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(trick_rust_analyzer_into_highlighting_interpolated_bits)'] }
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ pub fn build(sh: &Shell, flags: flags::Build) -> anyhow::Result<()> {
|
|||
std::process::exit(1);
|
||||
}
|
||||
|
||||
for WorkspaceMember { crate_name, .. } in crate::WORKSPACE_MEMBERS
|
||||
for WorkspaceMember { crate_name, .. } in crate::workspace_members()
|
||||
.iter()
|
||||
.filter(|member| member.build)
|
||||
{
|
||||
|
|
@ -32,10 +32,8 @@ pub fn build(sh: &Shell, flags: flags::Build) -> anyhow::Result<()> {
|
|||
if flags.no_plugins {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
if flags.plugins_only {
|
||||
continue;
|
||||
}
|
||||
} else if flags.plugins_only {
|
||||
continue;
|
||||
}
|
||||
|
||||
// zellij-utils requires protobuf definition files to be present. Usually these are
|
||||
|
|
@ -153,7 +151,7 @@ pub fn manpage(sh: &Shell) -> anyhow::Result<()> {
|
|||
|
||||
let project_root = crate::project_root();
|
||||
let asset_dir = &project_root.join("assets").join("man");
|
||||
sh.create_dir(&asset_dir).context(err_context)?;
|
||||
sh.create_dir(asset_dir).context(err_context)?;
|
||||
let _pd = sh.push_dir(asset_dir);
|
||||
|
||||
cmd!(sh, "{mandown} {project_root}/docs/MANPAGE.md 1")
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ fn e2e_build(sh: &Shell) -> anyhow::Result<()> {
|
|||
|
||||
sh.remove_path(&data_dir)
|
||||
.and_then(|_| sh.create_dir(&data_dir))
|
||||
.and_then(|_| sh.create_dir(&data_dir.join("plugins")))
|
||||
.and_then(|_| sh.create_dir(data_dir.join("plugins")))
|
||||
.context(err_context)?;
|
||||
|
||||
for plugin in plugins {
|
||||
|
|
@ -119,15 +119,15 @@ fn e2e_test(sh: &Shell, args: Vec<OsString>) -> anyhow::Result<()> {
|
|||
|
||||
// plugin system tests are run here because they're medium-slow
|
||||
let _pd = sh.push_dir(Path::new("zellij-server"));
|
||||
println!("");
|
||||
let msg = format!(">> Testing Plugin System");
|
||||
println!();
|
||||
let msg = ">> Testing Plugin System".to_string();
|
||||
crate::status(&msg);
|
||||
println!("{}", msg);
|
||||
|
||||
cmd!(sh, "{cargo} test -- --ignored --nocapture --test-threads 1")
|
||||
.args(args.clone())
|
||||
.run()
|
||||
.with_context(|| format!("Failed to run tests for the Plugin System"))?;
|
||||
.with_context(|| "Failed to run tests for the Plugin System".to_string())?;
|
||||
Ok(())
|
||||
})
|
||||
.context(err_context)
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ pub fn clippy(sh: &Shell, _flags: flags::Clippy) -> anyhow::Result<()> {
|
|||
.and_then(|_| crate::cargo())
|
||||
.context("failed to run task 'clippy'")?;
|
||||
|
||||
for WorkspaceMember { crate_name, .. } in crate::WORKSPACE_MEMBERS.iter() {
|
||||
for WorkspaceMember { crate_name, .. } in crate::workspace_members().iter() {
|
||||
let _pd = sh.push_dir(Path::new(crate_name));
|
||||
// Tell the user where we are now
|
||||
println!();
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ xflags::xflags! {
|
|||
cmd xtask {
|
||||
/// Deprecation warning. Compatibility to transition from `cargo make`.
|
||||
cmd deprecated {
|
||||
repeated args: OsString
|
||||
repeated _args: OsString
|
||||
}
|
||||
|
||||
/// Tasks for the CI
|
||||
|
|
@ -128,7 +128,7 @@ pub enum XtaskCmd {
|
|||
|
||||
#[derive(Debug)]
|
||||
pub struct Deprecated {
|
||||
pub args: Vec<OsString>,
|
||||
pub _args: Vec<OsString>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ pub fn format(sh: &Shell, flags: flags::Format) -> anyhow::Result<()> {
|
|||
.and_then(|_| crate::cargo())
|
||||
.context("failed to run task 'format'")?;
|
||||
|
||||
for WorkspaceMember { crate_name, .. } in crate::WORKSPACE_MEMBERS.iter() {
|
||||
for WorkspaceMember { crate_name, .. } in crate::workspace_members().iter() {
|
||||
let _pd = sh.push_dir(Path::new(crate_name));
|
||||
// Tell the user where we are now
|
||||
println!();
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ use anyhow::Context;
|
|||
use std::{
|
||||
env,
|
||||
path::{Path, PathBuf},
|
||||
sync::OnceLock,
|
||||
time::Instant,
|
||||
};
|
||||
use xshell::Shell;
|
||||
|
|
@ -28,24 +29,72 @@ pub struct WorkspaceMember {
|
|||
build: bool,
|
||||
}
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
pub static ref WORKSPACE_MEMBERS: Vec<WorkspaceMember> = vec![
|
||||
WorkspaceMember{crate_name: "default-plugins/compact-bar", build: true},
|
||||
WorkspaceMember{crate_name: "default-plugins/status-bar", build: true},
|
||||
WorkspaceMember{crate_name: "default-plugins/strider", build: true},
|
||||
WorkspaceMember{crate_name: "default-plugins/tab-bar", build: true},
|
||||
WorkspaceMember{crate_name: "default-plugins/fixture-plugin-for-tests", build: true},
|
||||
WorkspaceMember{crate_name: "default-plugins/session-manager", build: true},
|
||||
WorkspaceMember{crate_name: "default-plugins/configuration", build: true},
|
||||
WorkspaceMember{crate_name: "default-plugins/plugin-manager", build: true},
|
||||
WorkspaceMember{crate_name: "default-plugins/about", build: true},
|
||||
WorkspaceMember{crate_name: "zellij-utils", build: false},
|
||||
WorkspaceMember{crate_name: "zellij-tile-utils", build: false},
|
||||
WorkspaceMember{crate_name: "zellij-tile", build: false},
|
||||
WorkspaceMember{crate_name: "zellij-client", build: false},
|
||||
WorkspaceMember{crate_name: "zellij-server", build: false},
|
||||
WorkspaceMember{crate_name: ".", build: true},
|
||||
];
|
||||
fn workspace_members() -> &'static Vec<WorkspaceMember> {
|
||||
static WORKSPACE_MEMBERS: OnceLock<Vec<WorkspaceMember>> = OnceLock::new();
|
||||
WORKSPACE_MEMBERS.get_or_init(|| {
|
||||
vec![
|
||||
WorkspaceMember {
|
||||
crate_name: "default-plugins/compact-bar",
|
||||
build: true,
|
||||
},
|
||||
WorkspaceMember {
|
||||
crate_name: "default-plugins/status-bar",
|
||||
build: true,
|
||||
},
|
||||
WorkspaceMember {
|
||||
crate_name: "default-plugins/strider",
|
||||
build: true,
|
||||
},
|
||||
WorkspaceMember {
|
||||
crate_name: "default-plugins/tab-bar",
|
||||
build: true,
|
||||
},
|
||||
WorkspaceMember {
|
||||
crate_name: "default-plugins/fixture-plugin-for-tests",
|
||||
build: true,
|
||||
},
|
||||
WorkspaceMember {
|
||||
crate_name: "default-plugins/session-manager",
|
||||
build: true,
|
||||
},
|
||||
WorkspaceMember {
|
||||
crate_name: "default-plugins/configuration",
|
||||
build: true,
|
||||
},
|
||||
WorkspaceMember {
|
||||
crate_name: "default-plugins/plugin-manager",
|
||||
build: true,
|
||||
},
|
||||
WorkspaceMember {
|
||||
crate_name: "default-plugins/about",
|
||||
build: true,
|
||||
},
|
||||
WorkspaceMember {
|
||||
crate_name: "zellij-utils",
|
||||
build: false,
|
||||
},
|
||||
WorkspaceMember {
|
||||
crate_name: "zellij-tile-utils",
|
||||
build: false,
|
||||
},
|
||||
WorkspaceMember {
|
||||
crate_name: "zellij-tile",
|
||||
build: false,
|
||||
},
|
||||
WorkspaceMember {
|
||||
crate_name: "zellij-client",
|
||||
build: false,
|
||||
},
|
||||
WorkspaceMember {
|
||||
crate_name: "zellij-server",
|
||||
build: false,
|
||||
},
|
||||
WorkspaceMember {
|
||||
crate_name: ".",
|
||||
build: true,
|
||||
},
|
||||
]
|
||||
})
|
||||
}
|
||||
|
||||
fn main() -> anyhow::Result<()> {
|
||||
|
|
|
|||
|
|
@ -317,7 +317,7 @@ pub fn publish(sh: &Shell, flags: flags::Publish) -> anyhow::Result<()> {
|
|||
}
|
||||
|
||||
// Publish all the crates
|
||||
for WorkspaceMember { crate_name, .. } in crate::WORKSPACE_MEMBERS.iter() {
|
||||
for WorkspaceMember { crate_name, .. } in crate::workspace_members().iter() {
|
||||
if crate_name.contains("plugin") || crate_name.contains("xtask") {
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,15 +20,15 @@ pub fn test(sh: &Shell, flags: flags::Test) -> anyhow::Result<()> {
|
|||
)
|
||||
.context(err_context)?;
|
||||
|
||||
for WorkspaceMember { crate_name, .. } in crate::WORKSPACE_MEMBERS.iter() {
|
||||
for WorkspaceMember { crate_name, .. } in crate::workspace_members().iter() {
|
||||
// the workspace root only contains e2e tests, skip it
|
||||
if *crate_name == "." {
|
||||
if crate_name == &"." {
|
||||
continue;
|
||||
}
|
||||
|
||||
let _pd = sh.push_dir(Path::new(crate_name));
|
||||
// Tell the user where we are now
|
||||
println!("");
|
||||
println!();
|
||||
let msg = format!(">> Testing '{}'", crate_name);
|
||||
crate::status(&msg);
|
||||
println!("{}", msg);
|
||||
|
|
@ -60,9 +60,9 @@ pub fn host_target_triple(sh: &Shell) -> anyhow::Result<String> {
|
|||
return None;
|
||||
}
|
||||
if let Some((_, triple)) = line.split_once(": ") {
|
||||
return Some(triple.to_string());
|
||||
Some(triple.to_string())
|
||||
} else {
|
||||
return None;
|
||||
None
|
||||
}
|
||||
})
|
||||
.collect::<Vec<String>>();
|
||||
|
|
|
|||
|
|
@ -46,15 +46,14 @@ pub(crate) enum ClientInstruction {
|
|||
UnblockInputThread,
|
||||
Exit(ExitReason),
|
||||
Connected,
|
||||
ActiveClients(Vec<ClientId>),
|
||||
StartedParsingStdinQuery,
|
||||
DoneParsingStdinQuery,
|
||||
Log(Vec<String>),
|
||||
LogError(Vec<String>),
|
||||
SwitchSession(ConnectToSession),
|
||||
SetSynchronizedOutput(Option<SyncOutput>),
|
||||
UnblockCliPipeInput(String), // String -> pipe name
|
||||
CliPipeOutput(String, String), // String -> pipe name, String -> output
|
||||
UnblockCliPipeInput(()), // String -> pipe name
|
||||
CliPipeOutput((), ()), // String -> pipe name, String -> output
|
||||
QueryTerminalSize,
|
||||
WriteConfigToDisk { config: String },
|
||||
}
|
||||
|
|
@ -66,17 +65,16 @@ impl From<ServerToClientMsg> for ClientInstruction {
|
|||
ServerToClientMsg::Render(buffer) => ClientInstruction::Render(buffer),
|
||||
ServerToClientMsg::UnblockInputThread => ClientInstruction::UnblockInputThread,
|
||||
ServerToClientMsg::Connected => ClientInstruction::Connected,
|
||||
ServerToClientMsg::ActiveClients(clients) => ClientInstruction::ActiveClients(clients),
|
||||
ServerToClientMsg::Log(log_lines) => ClientInstruction::Log(log_lines),
|
||||
ServerToClientMsg::LogError(log_lines) => ClientInstruction::LogError(log_lines),
|
||||
ServerToClientMsg::SwitchSession(connect_to_session) => {
|
||||
ClientInstruction::SwitchSession(connect_to_session)
|
||||
},
|
||||
ServerToClientMsg::UnblockCliPipeInput(pipe_name) => {
|
||||
ClientInstruction::UnblockCliPipeInput(pipe_name)
|
||||
ServerToClientMsg::UnblockCliPipeInput(_pipe_name) => {
|
||||
ClientInstruction::UnblockCliPipeInput(())
|
||||
},
|
||||
ServerToClientMsg::CliPipeOutput(pipe_name, output) => {
|
||||
ClientInstruction::CliPipeOutput(pipe_name, output)
|
||||
ServerToClientMsg::CliPipeOutput(_pipe_name, _output) => {
|
||||
ClientInstruction::CliPipeOutput((), ())
|
||||
},
|
||||
ServerToClientMsg::QueryTerminalSize => ClientInstruction::QueryTerminalSize,
|
||||
ServerToClientMsg::WriteConfigToDisk { config } => {
|
||||
|
|
@ -94,7 +92,6 @@ impl From<&ClientInstruction> for ClientContext {
|
|||
ClientInstruction::Render(_) => ClientContext::Render,
|
||||
ClientInstruction::UnblockInputThread => ClientContext::UnblockInputThread,
|
||||
ClientInstruction::Connected => ClientContext::Connected,
|
||||
ClientInstruction::ActiveClients(_) => ClientContext::ActiveClients,
|
||||
ClientInstruction::Log(_) => ClientContext::Log,
|
||||
ClientInstruction::LogError(_) => ClientContext::LogError,
|
||||
ClientInstruction::StartedParsingStdinQuery => ClientContext::StartedParsingStdinQuery,
|
||||
|
|
|
|||
|
|
@ -92,7 +92,6 @@ pub enum ServerInstruction {
|
|||
ClientId,
|
||||
),
|
||||
ConnStatus(ClientId),
|
||||
ActiveClients(ClientId),
|
||||
Log(Vec<String>, ClientId),
|
||||
LogError(Vec<String>, ClientId),
|
||||
SwitchSession(ConnectToSession, ClientId),
|
||||
|
|
@ -133,7 +132,6 @@ impl From<&ServerInstruction> for ServerContext {
|
|||
ServerInstruction::DetachSession(..) => ServerContext::DetachSession,
|
||||
ServerInstruction::AttachClient(..) => ServerContext::AttachClient,
|
||||
ServerInstruction::ConnStatus(..) => ServerContext::ConnStatus,
|
||||
ServerInstruction::ActiveClients(_) => ServerContext::ActiveClients,
|
||||
ServerInstruction::Log(..) => ServerContext::Log,
|
||||
ServerInstruction::LogError(..) => ServerContext::LogError,
|
||||
ServerInstruction::SwitchSession(..) => ServerContext::SwitchSession,
|
||||
|
|
@ -1045,15 +1043,6 @@ pub fn start_server(mut os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) {
|
|||
let _ = os_input.send_to_client(client_id, ServerToClientMsg::Connected);
|
||||
remove_client!(client_id, os_input, session_state);
|
||||
},
|
||||
ServerInstruction::ActiveClients(client_id) => {
|
||||
let client_ids = session_state.read().unwrap().client_ids();
|
||||
send_to_client!(
|
||||
client_id,
|
||||
os_input,
|
||||
ServerToClientMsg::ActiveClients(client_ids),
|
||||
session_state
|
||||
);
|
||||
},
|
||||
ServerInstruction::Log(lines_to_log, client_id) => {
|
||||
send_to_client!(
|
||||
client_id,
|
||||
|
|
|
|||
|
|
@ -2033,8 +2033,11 @@ impl<'a> TiledPaneGrid<'a> {
|
|||
return None;
|
||||
}
|
||||
StackedPanes::new(self.panes.clone())
|
||||
.combine_vertically_aligned_panes_to_stack(&pane_id, neighboring_pane_ids_above);
|
||||
StackedPanes::new(self.panes.clone()).expand_pane(&pane_id);
|
||||
.combine_vertically_aligned_panes_to_stack(&pane_id, neighboring_pane_ids_above)
|
||||
.non_fatal();
|
||||
StackedPanes::new(self.panes.clone())
|
||||
.expand_pane(&pane_id)
|
||||
.non_fatal();
|
||||
Some(vec![*pane_id])
|
||||
}
|
||||
pub fn unstack_pane_up(&mut self, pane_id: &PaneId) -> Option<Vec<PaneId>> {
|
||||
|
|
@ -2114,8 +2117,11 @@ impl<'a> TiledPaneGrid<'a> {
|
|||
return None;
|
||||
}
|
||||
StackedPanes::new(self.panes.clone())
|
||||
.combine_vertically_aligned_panes_to_stack(&pane_id, neighboring_pane_ids_below);
|
||||
StackedPanes::new(self.panes.clone()).expand_pane(&pane_id);
|
||||
.combine_vertically_aligned_panes_to_stack(&pane_id, neighboring_pane_ids_below)
|
||||
.non_fatal();
|
||||
StackedPanes::new(self.panes.clone())
|
||||
.expand_pane(&pane_id)
|
||||
.non_fatal();
|
||||
Some(vec![*pane_id])
|
||||
}
|
||||
pub fn direct_neighboring_pane_ids_to_the_left(&self, root_pane_id: &PaneId) -> Vec<PaneId> {
|
||||
|
|
@ -2184,11 +2190,12 @@ impl<'a> TiledPaneGrid<'a> {
|
|||
{
|
||||
return None;
|
||||
}
|
||||
StackedPanes::new(self.panes.clone()).combine_horizontally_aligned_panes_to_stack(
|
||||
&pane_id,
|
||||
neighboring_pane_ids_to_the_left,
|
||||
);
|
||||
StackedPanes::new(self.panes.clone()).expand_pane(&pane_id);
|
||||
StackedPanes::new(self.panes.clone())
|
||||
.combine_horizontally_aligned_panes_to_stack(&pane_id, neighboring_pane_ids_to_the_left)
|
||||
.non_fatal();
|
||||
StackedPanes::new(self.panes.clone())
|
||||
.expand_pane(&pane_id)
|
||||
.non_fatal();
|
||||
Some(vec![*pane_id])
|
||||
}
|
||||
pub fn direct_neighboring_pane_ids_to_the_right(&self, root_pane_id: &PaneId) -> Vec<PaneId> {
|
||||
|
|
@ -2260,11 +2267,15 @@ impl<'a> TiledPaneGrid<'a> {
|
|||
if neighboring_pane_ids_to_the_right.is_empty() {
|
||||
return None;
|
||||
}
|
||||
StackedPanes::new(self.panes.clone()).combine_horizontally_aligned_panes_to_stack(
|
||||
&pane_id,
|
||||
neighboring_pane_ids_to_the_right,
|
||||
);
|
||||
StackedPanes::new(self.panes.clone()).expand_pane(&pane_id);
|
||||
StackedPanes::new(self.panes.clone())
|
||||
.combine_horizontally_aligned_panes_to_stack(
|
||||
&pane_id,
|
||||
neighboring_pane_ids_to_the_right,
|
||||
)
|
||||
.non_fatal();
|
||||
StackedPanes::new(self.panes.clone())
|
||||
.expand_pane(&pane_id)
|
||||
.non_fatal();
|
||||
Some(vec![*pane_id])
|
||||
}
|
||||
pub fn next_stack_id(&self) -> usize {
|
||||
|
|
@ -2282,74 +2293,6 @@ impl<'a> TiledPaneGrid<'a> {
|
|||
.set_geom(geom_of_active_pane);
|
||||
Ok(())
|
||||
}
|
||||
fn get_vertically_aligned_pane_id_above(&self, pane_id: &PaneId) -> Option<PaneId> {
|
||||
let Some(pane_geom) = self.get_pane_geom(pane_id) else {
|
||||
return None;
|
||||
};
|
||||
let panes = self.panes.borrow();
|
||||
let stacked_panes = StackedPanes::new(self.panes.clone());
|
||||
let pane_geom = if pane_geom.is_stacked() {
|
||||
stacked_panes
|
||||
.position_and_size_of_stack(pane_id)
|
||||
.unwrap_or(pane_geom)
|
||||
} else {
|
||||
pane_geom
|
||||
};
|
||||
panes.iter().find_map(|(candidate_pane_id, p)| {
|
||||
if !p.selectable() {
|
||||
return None;
|
||||
}
|
||||
let candidate_geom = p.current_geom();
|
||||
let candidate_geom = if candidate_geom.is_stacked() {
|
||||
stacked_panes
|
||||
.position_and_size_of_stack(candidate_pane_id)
|
||||
.unwrap_or(candidate_geom)
|
||||
} else {
|
||||
candidate_geom
|
||||
};
|
||||
if candidate_geom.y + candidate_geom.rows.as_usize() == pane_geom.y
|
||||
&& candidate_geom.x == pane_geom.x
|
||||
&& candidate_geom.cols.as_usize() == pane_geom.cols.as_usize()
|
||||
{
|
||||
return Some(p.pid());
|
||||
}
|
||||
return None;
|
||||
})
|
||||
}
|
||||
fn get_vertically_aligned_pane_id_below(&self, pane_id: &PaneId) -> Option<PaneId> {
|
||||
let Some(pane_geom) = self.get_pane_geom(pane_id) else {
|
||||
return None;
|
||||
};
|
||||
let panes = self.panes.borrow();
|
||||
let stacked_panes = StackedPanes::new(self.panes.clone());
|
||||
let pane_geom = if pane_geom.is_stacked() {
|
||||
stacked_panes
|
||||
.position_and_size_of_stack(pane_id)
|
||||
.unwrap_or(pane_geom)
|
||||
} else {
|
||||
pane_geom
|
||||
};
|
||||
panes.iter().find_map(|(candidate_pane_id, p)| {
|
||||
if !p.selectable() {
|
||||
return None;
|
||||
}
|
||||
let candidate_geom = p.current_geom();
|
||||
let candidate_geom = if candidate_geom.is_stacked() {
|
||||
stacked_panes
|
||||
.position_and_size_of_stack(candidate_pane_id)
|
||||
.unwrap_or(candidate_geom)
|
||||
} else {
|
||||
candidate_geom
|
||||
};
|
||||
if candidate_geom.y == pane_geom.y + pane_geom.rows.as_usize()
|
||||
&& candidate_geom.x == pane_geom.x
|
||||
&& candidate_geom.cols.as_usize() == pane_geom.cols.as_usize()
|
||||
{
|
||||
return Some(p.pid());
|
||||
}
|
||||
return None;
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
pub fn split(direction: SplitDirection, rect: &PaneGeom) -> Option<(PaneGeom, PaneGeom)> {
|
||||
|
|
|
|||
|
|
@ -639,7 +639,6 @@ impl<'a> PluginLoader<'a> {
|
|||
.filter_map(|export| export.clone().into_func().map(|_| export.name()))
|
||||
{
|
||||
if function_name.ends_with("_worker") {
|
||||
let plugin_config = self.plugin.clone();
|
||||
let (mut store, instance) =
|
||||
self.create_plugin_instance_and_wasi_env_for_worker()?;
|
||||
|
||||
|
|
@ -650,7 +649,7 @@ impl<'a> PluginLoader<'a> {
|
|||
.call(&mut store, ())
|
||||
.with_context(err_context)?;
|
||||
|
||||
let worker = RunningWorker::new(store, instance, &function_name, plugin_config);
|
||||
let worker = RunningWorker::new(store, instance, &function_name);
|
||||
let worker_sender = plugin_worker(worker);
|
||||
workers.insert(function_name.into(), worker_sender);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,29 +5,21 @@ use wasmtime::{Instance, Store};
|
|||
use zellij_utils::async_channel::{unbounded, Receiver, Sender};
|
||||
use zellij_utils::async_std::task;
|
||||
use zellij_utils::errors::prelude::*;
|
||||
use zellij_utils::input::plugins::PluginConfig;
|
||||
use zellij_utils::plugin_api::message::ProtobufMessage;
|
||||
use zellij_utils::prost::Message;
|
||||
|
||||
pub struct RunningWorker {
|
||||
pub instance: Instance,
|
||||
pub name: String,
|
||||
pub plugin_config: PluginConfig,
|
||||
pub store: Store<PluginEnv>,
|
||||
}
|
||||
|
||||
impl RunningWorker {
|
||||
pub fn new(
|
||||
store: Store<PluginEnv>,
|
||||
instance: Instance,
|
||||
name: &str,
|
||||
plugin_config: PluginConfig,
|
||||
) -> Self {
|
||||
pub fn new(store: Store<PluginEnv>, instance: Instance, name: &str) -> Self {
|
||||
RunningWorker {
|
||||
store,
|
||||
instance,
|
||||
name: name.into(),
|
||||
plugin_config,
|
||||
}
|
||||
}
|
||||
pub fn send_message(&mut self, message: String, payload: String) -> Result<()> {
|
||||
|
|
|
|||
|
|
@ -1188,9 +1188,6 @@ pub(crate) fn route_thread_main(
|
|||
let _ = to_server.send(ServerInstruction::DetachSession(client_id));
|
||||
should_break = true;
|
||||
},
|
||||
ClientToServerMsg::ListClients => {
|
||||
let _ = to_server.send(ServerInstruction::ActiveClients(client_id));
|
||||
},
|
||||
ClientToServerMsg::ConfigWrittenToDisk(config) => {
|
||||
let _ = to_server
|
||||
.send(ServerInstruction::ConfigWrittenToDisk(client_id, config));
|
||||
|
|
|
|||
|
|
@ -186,7 +186,6 @@ pub(crate) struct Tab {
|
|||
viewport: Rc<RefCell<Viewport>>, // includes all non-UI panes
|
||||
display_area: Rc<RefCell<Size>>, // includes all panes (including eg. the status bar and tab bar in the default layout)
|
||||
character_cell_size: Rc<RefCell<Option<SizeInPixels>>>,
|
||||
stacked_resize: Rc<RefCell<bool>>,
|
||||
sixel_image_store: Rc<RefCell<SixelImageStore>>,
|
||||
os_api: Box<dyn ServerOsApi>,
|
||||
pub senders: ThreadSenders,
|
||||
|
|
@ -206,7 +205,6 @@ pub(crate) struct Tab {
|
|||
// it seems that optimization is possible using `active_panes`
|
||||
focus_pane_id: Option<PaneId>,
|
||||
copy_on_select: bool,
|
||||
last_mouse_hold_position: Option<Position>,
|
||||
terminal_emulator_colors: Rc<RefCell<Palette>>,
|
||||
terminal_emulator_color_codes: Rc<RefCell<HashMap<usize, String>>>,
|
||||
pids_waiting_resize: HashSet<u32>, // u32 is the terminal_id
|
||||
|
|
@ -691,7 +689,6 @@ impl Tab {
|
|||
viewport,
|
||||
display_area,
|
||||
character_cell_size,
|
||||
stacked_resize,
|
||||
sixel_image_store,
|
||||
synchronize_is_active: false,
|
||||
os_api,
|
||||
|
|
@ -709,7 +706,6 @@ impl Tab {
|
|||
clipboard_provider,
|
||||
focus_pane_id: None,
|
||||
copy_on_select: copy_options.copy_on_select,
|
||||
last_mouse_hold_position: None,
|
||||
terminal_emulator_colors,
|
||||
terminal_emulator_color_codes,
|
||||
pids_waiting_resize: HashSet::new(),
|
||||
|
|
@ -3898,6 +3894,7 @@ impl Tab {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub fn handle_right_mouse_release(
|
||||
&mut self,
|
||||
position: &Position,
|
||||
|
|
@ -3907,7 +3904,6 @@ impl Tab {
|
|||
format!("failed to handle right mouse release at position {position:?} for client {client_id}")
|
||||
};
|
||||
|
||||
self.last_mouse_hold_position = None;
|
||||
let active_pane = self.get_active_pane_or_floating_pane_mut(client_id);
|
||||
if let Some(active_pane) = active_pane {
|
||||
let mut relative_position = active_pane.relative_position(position);
|
||||
|
|
@ -3931,6 +3927,7 @@ impl Tab {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
fn handle_middle_mouse_release(
|
||||
&mut self,
|
||||
position: &Position,
|
||||
|
|
@ -3940,7 +3937,6 @@ impl Tab {
|
|||
format!("failed to handle middle mouse release at position {position:?} for client {client_id}")
|
||||
};
|
||||
|
||||
self.last_mouse_hold_position = None;
|
||||
let active_pane = self.get_active_pane_or_floating_pane_mut(client_id);
|
||||
if let Some(active_pane) = active_pane {
|
||||
let mut relative_position = active_pane.relative_position(position);
|
||||
|
|
|
|||
|
|
@ -64,9 +64,6 @@ impl SwapLayouts {
|
|||
pub fn reset_floating_damage(&mut self) {
|
||||
self.is_floating_damaged = false;
|
||||
}
|
||||
pub fn reset_tiled_damage(&mut self) {
|
||||
self.is_tiled_damaged = false;
|
||||
}
|
||||
pub fn is_floating_damaged(&self) -> bool {
|
||||
self.is_floating_damaged
|
||||
}
|
||||
|
|
@ -280,31 +277,4 @@ impl SwapLayouts {
|
|||
}
|
||||
None
|
||||
}
|
||||
pub fn best_effort_tiled_layout(
|
||||
&mut self,
|
||||
tiled_panes: &TiledPanes,
|
||||
) -> Option<TiledPaneLayout> {
|
||||
for swap_layout in self.swap_tiled_layouts.iter() {
|
||||
for (_constraint, layout) in swap_layout.0.iter() {
|
||||
let focus_layout_if_not_focused = true;
|
||||
let display_area = self.display_area.borrow();
|
||||
// TODO: reuse the assets from position_panes_in_space here?
|
||||
let pane_count = tiled_panes.visible_panes_count();
|
||||
let display_area = PaneGeom::from(&*display_area);
|
||||
if layout
|
||||
.position_panes_in_space(
|
||||
&display_area,
|
||||
Some(pane_count),
|
||||
false,
|
||||
focus_layout_if_not_focused,
|
||||
)
|
||||
.is_ok()
|
||||
{
|
||||
return Some(layout.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
log::error!("Could not find layout that would fit on screen!");
|
||||
None
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,7 +82,13 @@ impl TerminalBytes {
|
|||
let mut buf = [0u8; 65536];
|
||||
loop {
|
||||
match self.deadline_read(&mut buf).await {
|
||||
ReadResult::Ok(0) | ReadResult::Err(_) => break, // EOF or error
|
||||
// EOF
|
||||
ReadResult::Ok(0) => break,
|
||||
// Some error occured
|
||||
ReadResult::Err(err) => {
|
||||
log::error!("{}", err);
|
||||
break;
|
||||
},
|
||||
ReadResult::Timeout => {
|
||||
let time_to_send_render = self
|
||||
.async_send_to_screen(ScreenInstruction::Render)
|
||||
|
|
|
|||
|
|
@ -450,7 +450,6 @@ pub enum ClientContext {
|
|||
ServerError,
|
||||
SwitchToMode,
|
||||
Connected,
|
||||
ActiveClients,
|
||||
Log,
|
||||
LogError,
|
||||
OwnClientId,
|
||||
|
|
@ -477,7 +476,6 @@ pub enum ServerContext {
|
|||
DetachSession,
|
||||
AttachClient,
|
||||
ConnStatus,
|
||||
ActiveClients,
|
||||
Log,
|
||||
LogError,
|
||||
SwitchSession,
|
||||
|
|
|
|||
|
|
@ -92,7 +92,6 @@ pub enum ClientToServerMsg {
|
|||
ClientExited,
|
||||
KillSession,
|
||||
ConnStatus,
|
||||
ListClients,
|
||||
ConfigWrittenToDisk(Config),
|
||||
FailedToWriteConfigToDisk(Option<PathBuf>),
|
||||
}
|
||||
|
|
@ -104,7 +103,6 @@ pub enum ServerToClientMsg {
|
|||
UnblockInputThread,
|
||||
Exit(ExitReason),
|
||||
Connected,
|
||||
ActiveClients(Vec<ClientId>),
|
||||
Log(Vec<String>),
|
||||
LogError(Vec<String>),
|
||||
SwitchSession(ConnectToSession),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue