Warning and duplication cleanups (#4857)

* cleanup compilation warnings

* consolidate EditScrollbackRaw into EditScrollback
This commit is contained in:
Aram Drevekenin
2026-03-16 10:37:45 +01:00
committed by GitHub
parent a1e2247547
commit 91e7297b63
29 changed files with 142 additions and 179 deletions
@@ -2,6 +2,7 @@ use serde::{Deserialize, Serialize};
use std::collections::BTreeMap;
#[allow(unused_imports)]
use std::io::prelude::*;
#[allow(unused_imports)] // Action is used in non-test code paths (run_action call)
use zellij_tile::prelude::actions::Action;
use zellij_tile::prelude::*;
@@ -19,6 +20,7 @@ struct State {
explicit_string_to_render: Option<String>,
}
#[allow(dead_code)] // used when compiled as wasm plugin, not in native test target
#[derive(Default, Serialize, Deserialize)]
struct TestWorker {
number_of_messages_received: usize,
+2
View File
@@ -149,6 +149,8 @@ impl ZellijPlugin for State {
self.close_on_selection = true;
} else {
// Filepicker callback mode: send result back to caller.
#[allow(unused_variables)]
// pipe_id is used inside #[cfg(target_family = "wasm")] block
if let PipeSource::Cli(pipe_id) = &pipe_message.source {
#[cfg(target_family = "wasm")]
block_cli_pipe_input(pipe_id);
+2
View File
@@ -224,6 +224,8 @@ impl State {
#[cfg(target_family = "wasm")]
close_self();
},
#[allow(unused_variables)]
// pipe_id is used inside #[cfg(target_family = "wasm")] blocks
Some((PipeSource::Cli(pipe_id), _args)) => {
#[cfg(target_family = "wasm")]
cli_pipe_output(pipe_id, &selected_path.display().to_string());
+1 -1
View File
@@ -246,7 +246,7 @@ fn individual_messages_client(
}
pub fn start_subscribe_client(
mut os_input: Box<dyn ClientOsApi>,
os_input: Box<dyn ClientOsApi>,
session_name: &str,
subscribe_cli: SubscribeCli,
) {
+1
View File
@@ -342,6 +342,7 @@ impl ClientInfo {
pub(crate) enum InputInstruction {
KeyEvent(InputEvent, Vec<u8>),
KeyWithModifierEvent(KeyWithModifier, Vec<u8>, bool), // bool = is_kitty_keyboard_protocol
#[allow(dead_code)] // constructed in stdin_handler_windows.rs (Windows-only)
MouseEvent(zellij_utils::input::mouse::MouseEvent),
AnsiStdinInstructions(Vec<AnsiStdinInstruction>),
StartedParsing,
+1
View File
@@ -54,6 +54,7 @@ use utils::should_use_https;
use uuid::Uuid;
use websocket_handlers::{ws_handler_control, ws_handler_terminal};
#[allow(dead_code)] // used in #[cfg(not(unix))] code path
const DEFAULT_SERVER_STARTUP_TIMEOUT_SECS: u64 = 10;
pub fn start_web_client(
+1 -4
View File
@@ -1,10 +1,7 @@
use axum::extract::ws::Message;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::sync::{
atomic::{AtomicBool, Ordering},
Arc, Mutex,
};
use std::sync::{atomic::AtomicBool, Arc, Mutex};
use tokio::sync::mpsc::UnboundedSender;
use tokio_util::sync::CancellationToken;
@@ -8,7 +8,6 @@ use std::sync::{Arc, Mutex};
use tokio::time::timeout;
use tokio_tungstenite::tungstenite::http::Request;
use tokio_tungstenite::{connect_async, tungstenite::Message};
use zellij_utils::input::cli_assets::CliAssets;
use zellij_utils::input::layout::Layout;
use zellij_utils::{consts::VERSION, input::config::Config, input::options::Options};
@@ -19,9 +18,9 @@ use crate::web_client::control_message::{
};
use crate::web_client::ClientOsApiFactory;
use zellij_utils::{
data::{LayoutInfo, Palette},
data::Palette,
errors::ErrorContext,
ipc::{ClientAttributes, ClientToServerMsg, ServerToClientMsg},
ipc::{ClientToServerMsg, ServerToClientMsg},
pane_size::Size,
web_authentication_tokens::{create_token, delete_db, revoke_token},
};
@@ -2662,6 +2661,7 @@ impl MockSessionManager {
}
}
#[allow(dead_code)]
pub fn get_first_message_for_session(&self, session_name: &str) -> Option<ClientToServerMsg> {
self.first_messages_sent
.lock()
+6 -2
View File
@@ -1,10 +1,13 @@
#[allow(unused_imports)] // some imports used only with web_server_capability feature
use zellij_utils::consts::{
session_info_cache_file_name, session_info_folder_for_session, session_layout_cache_file_name,
VERSION, ZELLIJ_SESSION_INFO_CACHE_DIR, ZELLIJ_SOCK_DIR,
};
#[allow(unused_imports)]
use zellij_utils::data::{Event, HttpVerb, SessionInfo, WebServerStatus};
use zellij_utils::errors::{prelude::*, BackgroundJobContext, ContextType};
use zellij_utils::input::layout::RunPlugin;
#[allow(unused_imports)]
use zellij_utils::shared::parse_base_url;
#[cfg(feature = "web_server_capability")]
@@ -116,6 +119,7 @@ static DEFAULT_SERIALIZATION_INTERVAL: u64 = 60000;
static REPAINT_DELAY_MS: u64 = 10;
static HELP_TEXT_DEBOUNCE_DURATION: u64 = 5000;
#[allow(unused_variables)] // web_server_base_url used only with web_server_capability feature
pub(crate) fn background_jobs_main(
bus: Bus<BackgroundJob>,
serialization_interval: Option<u64>,
@@ -252,7 +256,7 @@ pub(crate) fn background_jobs_main(
);
// Send SavedCurrentSession instruction to plugin thread
let timestamp_millis = std::time::SystemTime::now()
let _timestamp_millis = std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.unwrap_or_default()
.as_millis()
@@ -435,7 +439,7 @@ pub(crate) fn background_jobs_main(
.unwrap_or(WebServerStatus::Offline);
runtime.spawn({
let senders = bus.senders.clone();
let web_server_base_url = web_server_base_url.clone();
let _web_server_base_url = web_server_base_url.clone();
async move {
let _ = senders.send_to_plugin(PluginInstruction::Update(vec![(
None,
+1 -1
View File
@@ -1392,7 +1392,7 @@ impl Grid {
if self.lock_renders {
return Ok(None);
}
let mut raw_vte_output = String::new();
let raw_vte_output = String::new();
let (mut character_chunks, sixel_image_chunks) = self.read_changes(content_x, content_y);
@@ -12329,7 +12329,6 @@ pub fn get_session_environment_variables_plugin_command() {
// =====================================================================
use crate::panes::PaneId;
use zellij_utils::data::{HighlightStyle, RegexHighlight};
#[test]
#[ignore]
+1 -4
View File
@@ -18,10 +18,7 @@ use std::{
str::FromStr,
sync::{Arc, Mutex},
};
use tokio::{
sync::mpsc::Sender,
task::{self, JoinHandle},
};
use tokio::sync::mpsc::Sender;
use url::Url;
use wasmi::{Engine, Module};
use zellij_utils::consts::{ZELLIJ_CACHE_DIR, ZELLIJ_SESSION_CACHE_DIR, ZELLIJ_TMP_DIR};
+1 -1
View File
@@ -26,7 +26,7 @@ use zellij_utils::data::{
FloatingPaneCoordinates, FocusOrCreateTabResponse, GetFocusedPaneInfoResponse,
GetPaneCwdResponse, GetPanePidResponse, GetPaneRunningCommandResponse, HttpVerb,
KeyWithModifier, LayoutInfo, LayoutMetadata, LayoutParsingError, MessageToPlugin,
NewPanePlacement, NewTabResponse, NewTabsResponse, OpenCommandPaneBackgroundResponse,
NewPanePlacement, NewTabResponse, OpenCommandPaneBackgroundResponse,
OpenCommandPaneFloatingNearPluginResponse, OpenCommandPaneFloatingResponse,
OpenCommandPaneInPlaceOfPaneIdResponse, OpenCommandPaneInPlaceOfPluginResponse,
OpenCommandPaneInPlaceResponse, OpenCommandPaneNearPluginResponse, OpenCommandPaneResponse,
+1 -1
View File
@@ -14,7 +14,7 @@ use crate::{
};
use std::sync::Arc;
use std::{collections::HashMap, path::PathBuf};
use tokio::task::{self, JoinHandle};
use tokio::task::JoinHandle;
use zellij_utils::{
data::{
CommandOrPlugin, Event, FloatingPaneCoordinates, GetPaneCwdResponse, GetPanePidResponse,
+2 -10
View File
@@ -485,15 +485,7 @@ pub(crate) fn route_action(
))
.with_context(err_context)?;
},
Action::EditScrollbackRaw => {
senders
.send_to_screen(ScreenInstruction::EditScrollback(
client_id,
true,
Some(NotificationEnd::new(completion_tx)),
))
.with_context(err_context)?;
},
Action::ScrollUp => {
senders
.send_to_screen(ScreenInstruction::ScrollUp(
@@ -2552,7 +2544,7 @@ pub(crate) fn route_thread_main(
ref scrollback,
ansi,
} => {
send_to_screen_or_retry_queue!(
let _ = send_to_screen_or_retry_queue!(
senders,
ScreenInstruction::SubscribeToPaneRenders {
client_id,
+3 -7
View File
@@ -1101,6 +1101,7 @@ impl CopyOptions {
#[derive(Debug, Clone)]
pub struct RenderBlocker {
blocking_plugins: HashMap<u32, Instant>,
#[cfg_attr(test, allow(dead_code))]
timeout_ms: u64,
}
@@ -1232,7 +1233,9 @@ pub(crate) struct Screen {
styled_underlines: bool,
osc8_hyperlinks: bool,
arrow_fonts: bool,
#[cfg_attr(test, allow(dead_code))]
layout_dir: Option<PathBuf>,
#[cfg_attr(test, allow(dead_code))]
default_layout_name: Option<String>,
explicitly_disable_kitty_keyboard_protocol: bool,
default_editor: Option<PathBuf>,
@@ -1379,13 +1382,6 @@ impl Screen {
self.tabs.get_mut(&id)
}
/// Gets a tab by its display position (0-based).
///
/// Use this when you have a position from user input or visual operations.
fn get_tab_by_position(&self, position: usize) -> Option<&Tab> {
self.tabs.values().find(|t| t.position == position)
}
/// Gets a mutable tab by its display position (0-based).
fn get_tab_by_position_mut(&mut self, position: usize) -> Option<&mut Tab> {
self.tabs.values_mut().find(|t| t.position == position)
@@ -591,8 +591,6 @@ impl PaneLayoutMetadata {
}
}
fn to_pane_metadata(&self) -> PaneMetadata {
use zellij_utils::input::layout::RunPluginLocation;
// Try to extract a meaningful name from the pane
// Priority: explicit title > command name > file name > plugin location
let name = self.title.clone().or_else(|| {
+1 -1
View File
@@ -19,7 +19,7 @@ use std::rc::Rc;
use zellij_utils::{
data::{Palette, Style},
input::layout::{FloatingPaneLayout, Run, RunPluginOrAlias, TiledPaneLayout},
pane_size::{Offset, PaneGeom, Size, SizeInPixels, Viewport},
pane_size::{PaneGeom, Size, SizeInPixels, Viewport},
};
pub struct LayoutApplier<'a> {
-34
View File
@@ -4463,40 +4463,6 @@ impl Tab {
MouseHandler::handle_scrollwheel_down(self, point, lines, client_id)
}
fn get_pane_at(
&mut self,
point: &Position,
search_selectable: bool,
) -> Result<Option<&mut Box<dyn Pane>>> {
let err_context = || format!("failed to get pane at position {point:?}");
if self.floating_panes.panes_are_visible() {
if let Some(pane_id) = self
.floating_panes
.get_pane_id_at(point, search_selectable)
.with_context(err_context)?
{
return Ok(self.floating_panes.get_pane_mut(pane_id));
}
} else if self.floating_panes.has_pinned_panes() {
if let Some(pane_id) = self
.floating_panes
.get_pinned_pane_id_at(point, search_selectable)
.with_context(err_context)?
{
return Ok(self.floating_panes.get_pane_mut(pane_id));
}
}
if let Some(pane_id) = self
.get_pane_id_at(point, search_selectable)
.with_context(err_context)?
{
Ok(self.tiled_panes.get_pane_mut(pane_id))
} else {
Ok(None)
}
}
fn get_pane_id_at(
&mut self,
point: &Position,
+8 -4
View File
@@ -337,7 +337,7 @@ fn edge_and_delta_to_strategies(
pub struct MouseHandler;
impl MouseHandler {
pub fn handle_mouse_event(
pub(crate) fn handle_mouse_event(
tab: &mut Tab,
event: &MouseEvent,
client_id: ClientId,
@@ -1508,7 +1508,7 @@ impl MouseHandler {
Ok(())
}
pub fn handle_scrollwheel_up(
pub(crate) fn handle_scrollwheel_up(
tab: &mut Tab,
point: &Position,
lines: usize,
@@ -1537,7 +1537,7 @@ impl MouseHandler {
Ok(MouseEffect::default())
}
pub fn handle_scrollwheel_down(
pub(crate) fn handle_scrollwheel_down(
tab: &mut Tab,
point: &Position,
lines: usize,
@@ -1676,7 +1676,11 @@ impl MouseHandler {
}
}
pub fn set_mouse_selection_support(tab: &mut Tab, pane_id: PaneId, selection_support: bool) {
pub(crate) fn set_mouse_selection_support(
tab: &mut Tab,
pane_id: PaneId,
selection_support: bool,
) {
if let Some(pane) = tab.get_pane_with_id_mut(pane_id) {
pane.set_mouse_selection_support(selection_support);
}
@@ -6502,7 +6502,7 @@ fn test_override_tiled_retain_plugin_panes_no_matches() {
styled_underlines,
osc8_hyperlinks,
explicitly_disable_kitty_keyboard_protocol,
pty_receiver,
_pty_receiver,
plugin_receiver,
) = create_layout_applier_fixtures_with_receivers(size);
@@ -6805,7 +6805,7 @@ fn test_override_floating_retain_plugin_panes_no_matches() {
styled_underlines,
osc8_hyperlinks,
explicitly_disable_kitty_keyboard_protocol,
pty_receiver,
_pty_receiver,
plugin_receiver,
) = create_layout_applier_fixtures_with_receivers(size);
@@ -19,11 +19,10 @@ use zellij_utils::data::WebSharing;
use zellij_utils::envs::set_session_name;
use zellij_utils::errors::{prelude::*, ErrorContext};
use zellij_utils::input::layout::{
FloatingPaneLayout, Layout, PercentOrFixed, PluginUserConfiguration, RunPluginLocation,
RunPluginOrAlias, SwapFloatingLayout, SwapTiledLayout, TiledPaneLayout,
FloatingPaneLayout, Layout, PercentOrFixed, RunPluginOrAlias, SwapFloatingLayout,
SwapTiledLayout, TiledPaneLayout,
};
use zellij_utils::input::mouse::MouseEvent;
use zellij_utils::input::plugins::PluginTag;
use zellij_utils::ipc::IpcReceiverWithContext;
use zellij_utils::pane_size::{Size, SizeInPixels};
use zellij_utils::position::Position;
@@ -33,7 +32,7 @@ use zellij_utils::channels::{self, ChannelWithContext, SenderWithContext};
use crate::os_input_output::AsyncReader;
use std::cell::RefCell;
use std::collections::{BTreeMap, HashMap, HashSet};
use std::collections::{BTreeMap, HashMap};
use std::rc::Rc;
use interprocess::local_socket::Stream as LocalSocketStream;
@@ -1238,7 +1237,7 @@ fn render_stacks_without_pane_frames() {
)
.unwrap();
}
tab.focus_pane_with_id(PaneId::Terminal(1), false, false, client_id);
let _ = tab.focus_pane_with_id(PaneId::Terminal(1), false, false, client_id);
for i in 7..9 {
let new_pane_id_1 = PaneId::Terminal(i);
tab.new_pane(
@@ -2631,7 +2630,7 @@ fn drag_pane_with_mouse() {
)
.unwrap();
tab.render(&mut output, None).unwrap();
let (snapshot, cursor_coordinates) = take_snapshot_and_cursor_position(
let (snapshot, _cursor_coordinates) = take_snapshot_and_cursor_position(
output.serialize().unwrap().get(&client_id).unwrap(),
size.rows,
size.cols,
@@ -3362,7 +3361,7 @@ fn save_cursor_position_across_resizes() {
// We check cursor and saved cursor are handled separately by:
// 1. moving real cursor up two lines
tab.handle_pty_bytes(1, Vec::from("\u{1b}[2A".as_bytes()));
let _ = tab.handle_pty_bytes(1, Vec::from("\u{1b}[2A".as_bytes()));
// 2. resizing so real cursor gets lost above the viewport, which resets it to row 0
// The saved cursor ends up on row 1, allowing detection if it (incorrectly) gets reset too
tab.resize_whole_tab(Size { cols: 35, rows: 4 }).unwrap();
@@ -5406,8 +5405,8 @@ fn move_focus_up_with_stacked_panes() {
None,
)
.unwrap();
tab.move_focus_right(client_id);
tab.move_focus_up(client_id);
let _ = tab.move_focus_right(client_id);
let _ = tab.move_focus_up(client_id);
tab.render(&mut output, None).unwrap();
let snapshot = take_snapshot(
output.serialize().unwrap().get(&client_id).unwrap(),
@@ -5487,9 +5486,9 @@ fn move_focus_down_with_stacked_panes() {
None,
)
.unwrap();
tab.move_focus_right(client_id);
tab.move_focus_up(client_id);
tab.move_focus_down(client_id);
let _ = tab.move_focus_right(client_id);
let _ = tab.move_focus_up(client_id);
let _ = tab.move_focus_down(client_id);
tab.render(&mut output, None).unwrap();
let snapshot = take_snapshot(
output.serialize().unwrap().get(&client_id).unwrap(),
@@ -5549,12 +5548,12 @@ fn move_focus_right_into_stacked_panes() {
)
.unwrap();
}
tab.move_focus_left(client_id);
let _ = tab.move_focus_left(client_id);
tab.horizontal_split(PaneId::Terminal(16), None, client_id, None, None)
.unwrap();
tab.move_focus_up(client_id);
tab.move_focus_right(client_id);
let _ = tab.move_focus_up(client_id);
let _ = tab.move_focus_right(client_id);
tab.render(&mut output, None).unwrap();
let (snapshot, cursor_coordinates) = take_snapshot_and_cursor_position(
@@ -5621,12 +5620,12 @@ fn move_focus_left_into_stacked_panes() {
)
.unwrap();
}
tab.move_focus_right(client_id);
let _ = tab.move_focus_right(client_id);
tab.horizontal_split(PaneId::Terminal(1), None, client_id, None, None)
.unwrap();
tab.move_focus_up(client_id);
tab.move_focus_left(client_id);
let _ = tab.move_focus_up(client_id);
let _ = tab.move_focus_left(client_id);
tab.render(&mut output, None).unwrap();
let (snapshot, cursor_coordinates) = take_snapshot_and_cursor_position(
@@ -5695,14 +5694,14 @@ fn move_focus_up_into_stacked_panes() {
)
.unwrap();
}
tab.move_focus_right(client_id);
tab.move_focus_up(client_id);
tab.move_focus_left(client_id);
tab.move_focus_down(client_id);
let _ = tab.move_focus_right(client_id);
let _ = tab.move_focus_up(client_id);
let _ = tab.move_focus_left(client_id);
let _ = tab.move_focus_down(client_id);
tab.vertical_split(PaneId::Terminal(7), None, client_id, None, None)
.unwrap();
tab.move_focus_up(client_id);
let _ = tab.move_focus_up(client_id);
tab.render(&mut output, None).unwrap();
let (snapshot, cursor_coordinates) = take_snapshot_and_cursor_position(
@@ -5770,12 +5769,12 @@ fn move_focus_down_into_stacked_panes() {
)
.unwrap();
}
tab.move_focus_left(client_id);
tab.move_focus_up(client_id);
let _ = tab.move_focus_left(client_id);
let _ = tab.move_focus_up(client_id);
tab.vertical_split(PaneId::Terminal(7), None, client_id, None, None)
.unwrap();
tab.move_focus_down(client_id);
let _ = tab.move_focus_down(client_id);
tab.render(&mut output, None).unwrap();
let (snapshot, cursor_coordinates) = take_snapshot_and_cursor_position(
@@ -5966,9 +5965,9 @@ fn close_main_stacked_pane_in_mid_stack() {
None,
)
.unwrap();
tab.move_focus_right(client_id);
tab.move_focus_up(client_id);
tab.move_focus_up(client_id);
let _ = tab.move_focus_right(client_id);
let _ = tab.move_focus_up(client_id);
let _ = tab.move_focus_up(client_id);
tab.close_pane(new_pane_id_3, false, None);
tab.render(&mut output, None).unwrap();
let snapshot = take_snapshot(
@@ -6073,10 +6072,10 @@ fn close_one_liner_stacked_pane_below_main_pane() {
None,
)
.unwrap();
tab.move_focus_left(client_id);
tab.move_focus_right(client_id);
tab.move_focus_up(client_id);
tab.move_focus_up(client_id);
let _ = tab.move_focus_left(client_id);
let _ = tab.move_focus_right(client_id);
let _ = tab.move_focus_up(client_id);
let _ = tab.move_focus_up(client_id);
tab.close_pane(new_pane_id_2, false, None);
tab.render(&mut output, None).unwrap();
let snapshot = take_snapshot(
@@ -6181,9 +6180,9 @@ fn close_one_liner_stacked_pane_above_main_pane() {
None,
)
.unwrap();
tab.move_focus_right(client_id);
tab.move_focus_up(client_id);
tab.move_focus_up(client_id);
let _ = tab.move_focus_right(client_id);
let _ = tab.move_focus_up(client_id);
let _ = tab.move_focus_up(client_id);
tab.close_pane(new_pane_id_2, false, None);
tab.render(&mut output, None).unwrap();
let snapshot = take_snapshot(
@@ -6288,7 +6287,7 @@ fn can_increase_size_of_main_pane_in_stack_horizontally() {
None,
)
.unwrap();
tab.move_focus_right(client_id);
let _ = tab.move_focus_right(client_id);
tab.resize(
client_id,
ResizeStrategy::new(Resize::Increase, Some(Direction::Left)),
@@ -6399,7 +6398,7 @@ fn can_increase_size_of_main_pane_in_stack_vertically() {
None,
)
.unwrap();
tab.move_focus_right(client_id);
let _ = tab.move_focus_right(client_id);
tab.resize(
client_id,
ResizeStrategy::new(Resize::Increase, Some(Direction::Down)),
@@ -6726,8 +6725,8 @@ fn can_increase_size_into_pane_stack_vertically() {
None,
)
.unwrap();
tab.move_focus_right(client_id);
tab.move_focus_down(client_id);
let _ = tab.move_focus_right(client_id);
let _ = tab.move_focus_down(client_id);
tab.resize(
client_id,
ResizeStrategy::new(Resize::Increase, Some(Direction::Up)),
@@ -6944,7 +6943,7 @@ fn decreasing_size_of_whole_tab_treats_stacked_panes_properly() {
None,
)
.unwrap();
tab.resize_whole_tab(Size {
let _ = tab.resize_whole_tab(Size {
cols: 100,
rows: 10,
});
@@ -7051,11 +7050,11 @@ fn increasing_size_of_whole_tab_treats_stacked_panes_properly() {
None,
)
.unwrap();
tab.resize_whole_tab(Size {
let _ = tab.resize_whole_tab(Size {
cols: 100,
rows: 10,
});
tab.resize_whole_tab(Size {
let _ = tab.resize_whole_tab(Size {
cols: 121,
rows: 20,
});
@@ -7163,7 +7162,7 @@ fn cannot_decrease_stack_size_beyond_minimum_height() {
None,
)
.unwrap();
tab.move_focus_down(client_id);
let _ = tab.move_focus_down(client_id);
for _ in 0..6 {
tab.resize(
client_id,
@@ -7744,7 +7743,7 @@ fn focus_next_pane_expands_stacked_panes() {
None,
)
.unwrap();
tab.move_focus_left(client_id);
let _ = tab.move_focus_left(client_id);
tab.focus_next_pane(client_id);
tab.render(&mut output, None).unwrap();
let snapshot = take_snapshot(
@@ -7851,7 +7850,7 @@ fn stacked_panes_can_become_fullscreen() {
None,
)
.unwrap();
tab.move_focus_up(client_id);
let _ = tab.move_focus_up(client_id);
tab.toggle_active_pane_fullscreen(client_id);
tab.render(&mut output, None).unwrap();
let snapshot = take_snapshot(
@@ -8660,7 +8659,7 @@ fn when_swapping_tiled_layouts_in_a_damaged_state_layout_and_pane_focus_are_unch
true,
stacked_resize,
);
tab.move_focus_down(client_id);
let _ = tab.move_focus_down(client_id);
tab.resize(
client_id,
ResizeStrategy::new(Resize::Increase, Some(Direction::Down)),
@@ -8741,7 +8740,7 @@ fn when_swapping_tiled_layouts_in_an_undamaged_state_pane_focuses_on_focused_nod
true,
stacked_resize,
);
tab.move_focus_down(client_id);
let _ = tab.move_focus_down(client_id);
tab.next_swap_layout().unwrap();
tab.render(&mut output, None).unwrap();
@@ -8818,8 +8817,8 @@ fn when_swapping_tiled_layouts_in_an_undamaged_state_with_no_focus_node_pane_foc
true,
stacked_resize,
);
tab.move_focus_down(client_id);
tab.move_focus_down(client_id);
let _ = tab.move_focus_down(client_id);
let _ = tab.move_focus_down(client_id);
tab.next_swap_layout().unwrap();
tab.render(&mut output, None).unwrap();
@@ -9841,8 +9840,8 @@ fn when_closing_a_floating_pane_in_auto_layout_the_focus_goes_to_last_focused_pa
true,
stacked_resize,
);
tab.move_focus_up(client_id);
tab.move_focus_up(client_id);
let _ = tab.move_focus_up(client_id);
let _ = tab.move_focus_up(client_id);
tab.close_pane(PaneId::Terminal(1), false, None);
tab.render(&mut output, None).unwrap();
@@ -9913,7 +9912,7 @@ fn when_resizing_whole_tab_with_auto_layout_and_floating_panes_the_layout_is_mai
cols: 150,
rows: 30,
};
tab.resize_whole_tab(new_size);
let _ = tab.resize_whole_tab(new_size);
tab.render(&mut output, None).unwrap();
let (snapshot, cursor_coordinates) = take_snapshot_and_cursor_position(
@@ -10338,7 +10337,7 @@ fn test_left_release_after_selection_copies_to_clipboard() {
};
let client_id = 1;
let mut tab = create_new_tab(size, ModeInfo::default());
let mut output = Output::default();
let _output = Output::default();
// Fill the pane with some text content
tab.handle_pty_bytes(1, Vec::from("Selectable text content here".as_bytes()))
@@ -10379,7 +10378,7 @@ fn test_ctrl_click_on_tiled_pane_edge_starts_resize() {
let client_id = 1;
let mut tab = create_new_tab(size, ModeInfo::default());
let new_pane_id = PaneId::Terminal(2);
let mut output = Output::default();
let _output = Output::default();
// Create a vertical split
tab.vertical_split(new_pane_id, None, client_id, None, None)
@@ -10605,7 +10604,7 @@ fn test_ctrl_click_on_pane_body_does_nothing() {
let client_id = 1;
let mut tab = create_new_tab(size, ModeInfo::default());
let new_pane_id = PaneId::Terminal(2);
let mut output = Output::default();
let _output = Output::default();
// Create a vertical split
tab.vertical_split(new_pane_id, None, client_id, None, None)
@@ -10942,7 +10941,7 @@ fn test_ctrl_click_on_floating_frame_not_on_pin_starts_resize() {
let client_id = 1;
let mut tab = create_new_tab(size, ModeInfo::default());
let floating_pane_id = PaneId::Terminal(2);
let mut output = Output::default();
let _output = Output::default();
// Toggle floating panes mode and create a floating pane
tab.toggle_floating_panes(Some(client_id), None, None)
@@ -11222,7 +11221,7 @@ fn test_alt_left_click_toggles_pane_group() {
let client_id = 1;
let mut tab = create_new_tab(size, ModeInfo::default());
let new_pane_id = PaneId::Terminal(2);
let mut output = Output::default();
let _output = Output::default();
// Create a vertical split
tab.vertical_split(new_pane_id, None, client_id, None, None)
@@ -11256,7 +11255,7 @@ fn test_alt_left_drag_adds_panes_to_group() {
let mut tab = create_new_tab(size, ModeInfo::default());
let new_pane_id_2 = PaneId::Terminal(2);
let new_pane_id_3 = PaneId::Terminal(3);
let mut output = Output::default();
let _output = Output::default();
// Create two vertical splits (3 panes)
tab.vertical_split(new_pane_id_2, None, client_id, None, None)
@@ -11312,7 +11311,7 @@ fn test_right_alt_click_ungroups_panes() {
let client_id = 1;
let mut tab = create_new_tab(size, ModeInfo::default());
let new_pane_id = PaneId::Terminal(2);
let mut output = Output::default();
let _output = Output::default();
// Create a vertical split
tab.vertical_split(new_pane_id, None, client_id, None, None)
@@ -11370,7 +11369,7 @@ fn test_scroll_wheel_up_scrolls_pane() {
);
// Scroll up
let effect = tab
let _effect = tab
.handle_mouse_event(
&MouseEvent::new_scroll_up_event(Position::new(10, 60)),
client_id,
@@ -11400,7 +11399,7 @@ fn test_scroll_wheel_down_scrolls_pane() {
};
let client_id = 1;
let mut tab = create_new_tab(size, ModeInfo::default());
let mut output = Output::default();
let _output = Output::default();
// Fill the pane with many lines to enable scrolling
let mut content = String::new();
@@ -11438,7 +11437,7 @@ fn test_scroll_wheel_down_scrolls_pane() {
);
// Scroll down
let effect = tab
let _effect = tab
.handle_mouse_event(
&MouseEvent::new_scroll_down_event(Position::new(10, 60)),
client_id,
@@ -11503,7 +11502,7 @@ fn test_scroll_on_inactive_pane_scrolls_that_pane() {
);
// Scroll up on the left (inactive) pane
let effect = tab
let _effect = tab
.handle_mouse_event(
&MouseEvent::new_scroll_up_event(Position::new(10, 30)),
client_id,
@@ -11533,7 +11532,7 @@ fn test_right_click_forwards_to_active_pane() {
};
let client_id = 1;
let mut tab = create_new_tab(size, ModeInfo::default());
let mut output = Output::default();
let _output = Output::default();
tab.handle_pty_bytes(1, Vec::from("Active pane".as_bytes()))
.unwrap();
@@ -11559,7 +11558,7 @@ fn test_middle_click_forwards_to_active_pane() {
};
let client_id = 1;
let mut tab = create_new_tab(size, ModeInfo::default());
let mut output = Output::default();
let _output = Output::default();
tab.handle_pty_bytes(1, Vec::from("Active pane".as_bytes()))
.unwrap();
@@ -11585,7 +11584,7 @@ fn test_hover_over_inactive_pane_sets_hover_state() {
let client_id = 1;
let mut tab = create_new_tab(size, ModeInfo::default());
let new_pane_id = PaneId::Terminal(2);
let mut output = Output::default();
let _output = Output::default();
// Create a vertical split
tab.vertical_split(new_pane_id, None, client_id, None, None)
@@ -11621,7 +11620,7 @@ fn test_hover_over_active_pane_unsets_hover() {
let client_id = 1;
let mut tab = create_new_tab(size, ModeInfo::default());
let new_pane_id = PaneId::Terminal(2);
let mut output = Output::default();
let _output = Output::default();
// Create a vertical split
tab.vertical_split(new_pane_id, None, client_id, None, None)
@@ -11665,7 +11664,7 @@ fn test_resize_tiled_then_move_floating_sequence() {
let mut tab = create_new_tab(size, ModeInfo::default());
let tiled_pane_id = PaneId::Terminal(2);
let floating_pane_id = PaneId::Terminal(3);
let mut output = Output::default();
let _output = Output::default();
// Create tiled split
tab.vertical_split(tiled_pane_id, None, client_id, None, None)
@@ -11758,7 +11757,7 @@ fn test_alt_click_works_on_floating_panes() {
let client_id = 1;
let mut tab = create_new_tab(size, ModeInfo::default());
let floating_pane_id = PaneId::Terminal(2);
let mut output = Output::default();
let _output = Output::default();
// Toggle floating panes mode and create a floating pane
tab.toggle_floating_panes(Some(client_id), None, None)
@@ -11800,7 +11799,7 @@ fn test_left_click_on_tiled_frame_edge_starts_resize() {
let client_id = 1;
let mut tab = create_new_tab(size, ModeInfo::default());
let new_pane_id = PaneId::Terminal(2);
let mut output = Output::default();
let _output = Output::default();
// Create a vertical split
tab.vertical_split(new_pane_id, None, client_id, None, None)
@@ -13882,7 +13881,7 @@ fn focus_follows_mouse_skips_stacked_one_liner_pane() {
.unwrap();
// Focus the left (non-stacked) tiled pane
tab.move_focus_left(client_id);
let _ = tab.move_focus_left(client_id);
assert_eq!(tab.get_active_pane_id(client_id), Some(PaneId::Terminal(1)));
// Enable focus follows mouse
@@ -14085,7 +14084,7 @@ fn mouse_click_through_sends_click_to_newly_focused_floating_pane() {
assert_eq!(tab.get_active_pane_id(client_id), Some(floating_pane_id_2));
// Now click on floating pane 1's area
let effect = tab
let _effect = tab
.handle_mouse_event(
&MouseEvent::new_left_press_event(Position::new(5, 30)),
client_id,
+8 -8
View File
@@ -15364,7 +15364,7 @@ pub fn scroll_down_by_pane_id() {
let mut tab = create_new_tab(size, true);
let pane_id = PaneId::Terminal(1);
assert!(tab.has_pane_with_pid(&pane_id));
tab.scroll_down_by_pane_id(pane_id);
let _ = tab.scroll_down_by_pane_id(pane_id);
}
#[test]
@@ -15376,7 +15376,7 @@ pub fn scroll_to_top_by_pane_id() {
let mut tab = create_new_tab(size, true);
let pane_id = PaneId::Terminal(1);
assert!(tab.has_pane_with_pid(&pane_id));
tab.scroll_to_top_by_pane_id(pane_id);
let _ = tab.scroll_to_top_by_pane_id(pane_id);
}
#[test]
@@ -15388,7 +15388,7 @@ pub fn scroll_to_bottom_by_pane_id() {
let mut tab = create_new_tab(size, true);
let pane_id = PaneId::Terminal(1);
assert!(tab.has_pane_with_pid(&pane_id));
tab.scroll_to_bottom_by_pane_id(pane_id);
let _ = tab.scroll_to_bottom_by_pane_id(pane_id);
}
#[test]
@@ -15412,7 +15412,7 @@ pub fn page_scroll_down_by_pane_id() {
let mut tab = create_new_tab(size, true);
let pane_id = PaneId::Terminal(1);
assert!(tab.has_pane_with_pid(&pane_id));
tab.page_scroll_down_by_pane_id(pane_id);
let _ = tab.page_scroll_down_by_pane_id(pane_id);
}
#[test]
@@ -15436,7 +15436,7 @@ pub fn half_page_scroll_down_by_pane_id() {
let mut tab = create_new_tab(size, true);
let pane_id = PaneId::Terminal(1);
assert!(tab.has_pane_with_pid(&pane_id));
tab.half_page_scroll_down_by_pane_id(pane_id);
let _ = tab.half_page_scroll_down_by_pane_id(pane_id);
}
#[test]
@@ -15448,7 +15448,7 @@ pub fn rename_pane_by_pane_id() {
let mut tab = create_new_tab(size, true);
let pane_id = PaneId::Terminal(1);
assert!(tab.has_pane_with_pid(&pane_id));
tab.rename_pane_by_pane_id(pane_id, "new-name".as_bytes().to_vec());
let _ = tab.rename_pane_by_pane_id(pane_id, "new-name".as_bytes().to_vec());
}
#[test]
@@ -15460,7 +15460,7 @@ pub fn undo_rename_pane_by_pane_id() {
let mut tab = create_new_tab(size, true);
let pane_id = PaneId::Terminal(1);
assert!(tab.has_pane_with_pid(&pane_id));
tab.rename_pane_by_pane_id(pane_id, "new-name".as_bytes().to_vec());
let _ = tab.rename_pane_by_pane_id(pane_id, "new-name".as_bytes().to_vec());
tab.undo_rename_pane_by_pane_id(pane_id);
}
@@ -15549,7 +15549,7 @@ pub fn clear_screen_by_pane_id() {
let mut tab = create_new_tab(size, true);
let pane_id = PaneId::Terminal(1);
assert!(tab.has_pane_with_pid(&pane_id));
tab.clear_screen_by_pane_id(pane_id);
let _ = tab.clear_screen_by_pane_id(pane_id);
}
#[test]
+6 -4
View File
@@ -15,7 +15,7 @@ use zellij_utils::input::command::{RunCommand, TerminalAction};
use zellij_utils::input::config::Config;
use zellij_utils::input::layout::{
FloatingPaneLayout, Layout, PercentOrFixed, PluginAlias, PluginUserConfiguration, Run,
RunPlugin, RunPluginLocation, RunPluginOrAlias, SplitDirection, SplitSize, TiledPaneLayout,
RunPlugin, RunPluginLocation, RunPluginOrAlias, SplitDirection, TiledPaneLayout,
};
use zellij_utils::input::mouse::MouseEvent;
use zellij_utils::input::options::Options;
@@ -49,7 +49,7 @@ use crate::panes::grid::Grid;
use crate::panes::link_handler::LinkHandler;
use crate::panes::sixel::SixelImageStore;
use std::cell::RefCell;
use std::collections::{HashMap, HashSet};
use std::collections::HashMap;
use std::rc::Rc;
use zellij_utils::data::{PaneContents, PaneRenderReport};
use zellij_utils::ipc::ExitReason;
@@ -334,6 +334,7 @@ struct MockScreen {
pub main_client_id: u16,
pub pty_receiver: Option<Receiver<(PtyInstruction, ErrorContext)>>,
pub pty_writer_receiver: Option<Receiver<(PtyWriteInstruction, ErrorContext)>>,
#[allow(dead_code)]
pub background_jobs_receiver: Option<Receiver<(BackgroundJob, ErrorContext)>>,
pub screen_receiver: Option<Receiver<(ScreenInstruction, ErrorContext)>>,
pub server_receiver: Option<Receiver<(ServerInstruction, ErrorContext)>>,
@@ -346,6 +347,7 @@ struct MockScreen {
pub to_background_jobs: SenderWithContext<BackgroundJob>,
pub os_input: FakeInputOutput,
pub client_attributes: ClientAttributes,
#[allow(dead_code)]
pub config_options: Options,
pub session_metadata: SessionMetaData,
pub config: Config,
@@ -3410,7 +3412,7 @@ pub fn send_cli_toggle_pane_embed_or_float() {
received_server_instructions.lock().unwrap().iter(),
size,
);
let snapshot_count = snapshots.len();
let _snapshot_count = snapshots.len();
let last_three_snapshots = snapshots.clone().into_iter().rev().take(3).rev(); // we do this to
// prevent extra
// renders from
@@ -5721,7 +5723,7 @@ fn close_pane_notifies_subscribers_via_instruction() {
let size = Size { cols: 80, rows: 20 };
let mut mock_screen = MockScreen::new(size);
mock_screen.drop_all_pty_messages();
let session_metadata = mock_screen.clone_session_metadata();
let _session_metadata = mock_screen.clone_session_metadata();
let mut initial_layout = TiledPaneLayout::default();
initial_layout.children_split_direction = SplitDirection::Vertical;
+3
View File
@@ -1,3 +1,5 @@
// false positive: thiserror's derive macro triggers unused_assignments on struct-style enum variant fields
#![allow(unused_assignments)]
//! Error context system based on a thread-local representation of the call stack, itself based on
//! the instructions that are sent between threads.
//!
@@ -11,6 +13,7 @@
use anyhow::Context;
use colored::*;
#[allow(unused_imports)] // used in set_panic_handler; may appear unused under wasm target
use log::error;
use serde::{Deserialize, Serialize};
use std::fmt::{Display, Error, Formatter};
-1
View File
@@ -188,7 +188,6 @@ pub enum Action {
EditScrollback {
ansi: bool,
},
EditScrollbackRaw,
/// Scroll up in focus pane.
ScrollUp,
/// Scroll up at point
@@ -1023,9 +1023,6 @@ impl From<crate::input::actions::Action>
crate::input::actions::Action::EditScrollback { ansi } => {
ActionType::EditScrollback(EditScrollbackAction { ansi })
},
crate::input::actions::Action::EditScrollbackRaw => {
ActionType::EditScrollback(EditScrollbackAction { ansi: true })
},
crate::input::actions::Action::ScrollUp => ActionType::ScrollUp(ScrollUpAction {}),
crate::input::actions::Action::ScrollUpAt { position } => {
ActionType::ScrollUpAt(ScrollUpAtAction {
+14 -8
View File
@@ -50,7 +50,6 @@ macro_rules! parse_kdl_action_arguments {
"FocusPreviousPane" => Ok(Action::FocusPreviousPane),
"SwitchFocus" => Ok(Action::SwitchFocus),
"EditScrollback" => Ok(Action::EditScrollback { ansi: false }),
"EditScrollbackRaw" => Ok(Action::EditScrollback { ansi: true }),
"ScrollUp" => Ok(Action::ScrollUp),
"ScrollDown" => Ok(Action::ScrollDown),
"ScrollToBottom" => Ok(Action::ScrollToBottom),
@@ -707,9 +706,17 @@ impl Action {
file_path: None, ..
} => None,
Action::DumpLayout => Some(KdlNode::new("DumpLayout")),
Action::EditScrollback { ansi: false } => Some(KdlNode::new("EditScrollback")),
Action::EditScrollback { ansi: true } => Some(KdlNode::new("EditScrollbackRaw")),
Action::EditScrollbackRaw => Some(KdlNode::new("EditScrollbackRaw")),
Action::EditScrollback { ansi } => {
let mut node = KdlNode::new("EditScrollback");
if *ansi {
let mut children = KdlDocument::new();
let mut ansi_node = KdlNode::new("ansi");
ansi_node.push(KdlValue::Bool(true));
children.nodes_mut().push(ansi_node);
node.set_children(children);
}
Some(node)
},
Action::ScrollUp => Some(KdlNode::new("ScrollUp")),
Action::ScrollDown => Some(KdlNode::new("ScrollDown")),
Action::ScrollToBottom => Some(KdlNode::new("ScrollToBottom")),
@@ -1495,10 +1502,9 @@ impl TryFrom<(&KdlNode, &Options)> for Action {
},
"SwitchFocus" => parse_kdl_action_arguments!(action_name, action_arguments, kdl_action),
"EditScrollback" => {
parse_kdl_action_arguments!(action_name, action_arguments, kdl_action)
},
"EditScrollbackRaw" => {
parse_kdl_action_arguments!(action_name, action_arguments, kdl_action)
let ansi = crate::kdl_get_bool_property_or_child_value!(kdl_action, "ansi")
.unwrap_or(false);
Ok(Action::EditScrollback { ansi })
},
"ScrollUp" => parse_kdl_action_arguments!(action_name, action_arguments, kdl_action),
"ScrollDown" => parse_kdl_action_arguments!(action_name, action_arguments, kdl_action),
-4
View File
@@ -1197,10 +1197,6 @@ impl TryFrom<Action> for ProtobufAction {
name: ProtobufActionName::EditScrollback as i32,
optional_payload: None,
}),
Action::EditScrollbackRaw => Ok(ProtobufAction {
name: ProtobufActionName::EditScrollback as i32, // fallback to default edit scrollback
optional_payload: None,
}),
Action::ScrollUp => Ok(ProtobufAction {
name: ProtobufActionName::ScrollUp as i32,
optional_payload: None,