summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorCanop <cano.petrole@gmail.com>2020-09-30 14:59:51 +0200
committerCanop <cano.petrole@gmail.com>2020-09-30 14:59:51 +0200
commit7de5b8d565b6d638e43558df5832c6a8b5290e63 (patch)
treef448dbc0e292ebcfbd3a884b645d7619ada7b677 /src
parente08c1995d47be9929c948f5477b6648c336cbeef (diff)
refactor: make Screen Copy
It's now only the dimensions, it's tiny.
Diffstat (limited to 'src')
-rw-r--r--src/app/app.rs60
-rw-r--r--src/app/panel.rs10
-rw-r--r--src/app/state.rs18
-rw-r--r--src/browser/browser_state.rs22
-rw-r--r--src/cli.rs7
-rw-r--r--src/display/areas.rs6
-rw-r--r--src/display/screen.rs11
-rw-r--r--src/display/status_line.rs4
-rw-r--r--src/flag/mod.rs1
-rw-r--r--src/help/help_state.rs8
-rw-r--r--src/hex/hex_view.rs4
-rw-r--r--src/image/image_view.rs4
-rw-r--r--src/launchable.rs2
-rw-r--r--src/preview/preview.rs4
-rw-r--r--src/preview/preview_state.rs10
-rw-r--r--src/print.rs4
-rw-r--r--src/syntactic/syntactic_view.rs4
-rw-r--r--src/verb/internal_focus.rs8
18 files changed, 95 insertions, 92 deletions
diff --git a/src/app/app.rs b/src/app/app.rs
index 2dbf221..c6784c4 100644
--- a/src/app/app.rs
+++ b/src/app/app.rs
@@ -33,6 +33,9 @@ use std::sync::{Arc, Mutex};
/// The GUI
pub struct App {
+ /// dimensions of the screen
+ screen: Screen,
+
/// the panels of the application, at least one
panels: NonEmptyVec<Panel>,
@@ -66,8 +69,8 @@ impl App {
pub fn new(
con: &AppContext,
- screen: &Screen,
) -> Result<App, ProgramError> {
+ let screen = Screen::new(con)?;
let panel = Panel::new(
PanelId::from(0),
Box::new(
@@ -85,6 +88,7 @@ impl App {
);
let (tx_seqs, rx_seqs) = unbounded::<Sequence>();
Ok(App {
+ screen,
active_panel_idx: 0,
panels: panel.into(),
quitting: false,
@@ -124,7 +128,7 @@ impl App {
/// close the panel if it's not the last one
///
/// Return true when the panel has been removed (ie it wasn't the last one)
- fn close_panel(&mut self, panel_idx: usize, screen: &Screen) -> bool {
+ fn close_panel(&mut self, panel_idx: usize) -> bool {
let active_panel_id = self.panels[self.active_panel_idx].id;
if let Some(preview_id) = self.preview {
if self.panels.has_len(2) && self.panels[panel_idx].id != preview_id {
@@ -136,7 +140,7 @@ impl App {
if self.preview == Some(removed_panel.id) {
self.preview = None;
}
- Areas::resize_all(self.panels.as_mut_slice(), screen, self.preview.is_some())
+ Areas::resize_all(self.panels.as_mut_slice(), self.screen, self.preview.is_some())
.expect("removing a panel should be easy");
self.active_panel_idx = self.panels.iter()
.position(|p| p.id == active_panel_id)
@@ -152,15 +156,14 @@ impl App {
/// Close the panel too if that was its only state.
/// Close nothing and return false if there's not
/// at least two states in the app.
- fn remove_state(&mut self, screen: &Screen) -> bool {
+ fn remove_state(&mut self) -> bool {
self.panels[self.active_panel_idx].remove_state()
- || self.close_panel(self.active_panel_idx, screen)
+ || self.close_panel(self.active_panel_idx)
}
fn display_panels(
&mut self,
w: &mut W,
- screen: &mut Screen,
skin: &AppSkin,
con: &AppContext,
) -> Result<(), ProgramError> {
@@ -170,7 +173,7 @@ impl App {
time!(
Debug,
"display panel",
- panel.display(w, focused, screen, skin, con)?,
+ panel.display(w, focused, self.screen, skin, con)?,
);
}
Ok(())
@@ -202,7 +205,6 @@ impl App {
&mut self,
w: &mut W,
cmd: Command,
- screen: &mut Screen,
panel_skin: &PanelSkin,
con: &AppContext,
) -> Result<(), ProgramError> {
@@ -211,6 +213,7 @@ impl App {
let is_input_invocation = cmd.is_verb_invocated_from_input();
let other_path = self.get_other_panel_path();
let preview = self.preview;
+ let screen = self.screen; // it can't change in this function
match self.mut_panel().apply_command(
w,
&cmd,
@@ -263,7 +266,7 @@ impl App {
new_arg = Some(path.to_string_lossy().to_string());
}
}
- if self.close_panel(close_idx, screen) {
+ if self.close_panel(close_idx) {
self.mut_state().refresh(screen, con);
if let Some(new_arg) = new_arg {
self.mut_panel().set_input_arg(new_arg);
@@ -366,7 +369,7 @@ impl App {
if is_input_invocation {
self.mut_panel().clear_input();
}
- if self.remove_state(screen) {
+ if self.remove_state() {
self.mut_state().refresh(screen, con);
let other_path = self.get_other_panel_path();
self.mut_panel().refresh_input_status(&other_path, con);
@@ -378,7 +381,7 @@ impl App {
if is_input_invocation {
self.mut_panel().clear_input();
}
- if self.remove_state(screen) {
+ if self.remove_state() {
let preview = self.preview;
self.mut_panel().apply_command(
w,
@@ -435,17 +438,17 @@ impl App {
}
/// get the index of the panel at x
- fn clicked_panel_index(&self, x: u16, _y: u16, screen: &Screen) -> usize {
+ fn clicked_panel_index(&self, x: u16, _y: u16) -> usize {
let len = self.panels.len().get();
- (len * x as usize) / (screen.width as usize + 1)
+ (len * x as usize) / (self.screen.width as usize + 1)
}
fn do_pending_tasks(
&mut self,
- screen: &mut Screen,
con: &AppContext,
dam: &mut Dam,
) -> Result<bool, ProgramError> {
+ let screen = self.screen;
// we start with the focused panel
let mut did_something = self.mut_panel().do_pending_tasks(screen, con, dam)?;
// then the other ones
@@ -464,7 +467,6 @@ impl App {
pub fn run(
mut self,
w: &mut W,
- screen: &mut Screen,
con: &AppContext,
conf: &Conf,
) -> Result<Option<Launchable>, ProgramError> {
@@ -476,7 +478,7 @@ impl App {
let skin = AppSkin::new(conf);
- screen.clear_bottom_right_char(w, &skin.focused)?;
+ self.screen.clear_bottom_right_char(w, &skin.focused)?;
if let Some(raw_sequence) = &con.launch_args.commands {
self.tx_seqs.send(Sequence::new_local(raw_sequence.to_string())).unwrap();
@@ -493,12 +495,12 @@ impl App {
loop {
if !self.quitting {
- self.display_panels(w, screen, &skin, con)?;
+ self.display_panels(w, &skin, con)?;
w.flush()?;
- if self.do_pending_tasks(screen, con, &mut dam)? {
+ if self.do_pending_tasks(con, &mut dam)? {
let other_path = self.get_other_panel_path();
self.mut_panel().refresh_input_status(&other_path, con);
- self.display_panels(w, screen, &skin, con)?;
+ self.display_panels(w, &skin, con)?;
w.flush()?;
}
}
@@ -508,25 +510,25 @@ impl App {
debug!("event: {:?}", &event);
match event {
Event::Click(x, y, KeyModifiers::NONE)
- if self.clicked_panel_index(x, y, screen) != self.active_panel_idx =>
+ if self.clicked_panel_index(x, y) != self.active_panel_idx =>
{
// panel activation click
// this will be cleaner when if let will be allowed in match guards with
// chaining (currently experimental)
- self.active_panel_idx = self.clicked_panel_index(x, y, screen);
+ self.active_panel_idx = self.clicked_panel_index(x, y);
}
Event::Resize(w, h) => {
- screen.set_terminal_size(w, h, con);
- Areas::resize_all(self.panels.as_mut_slice(), screen, self.preview.is_some())?;
+ self.screen.set_terminal_size(w, h, con);
+ Areas::resize_all(self.panels.as_mut_slice(), self.screen, self.preview.is_some())?;
for panel in &mut self.panels {
- panel.mut_state().refresh(screen, con);
+ panel.mut_state().refresh(self.screen, con);
}
}
_ => {
// event handled by the panel
let cmd = self.mut_panel().add_event(w, event, con)?;
debug!("command after add_event: {:?}", &cmd);
- self.apply_command(w, cmd, screen, &skin.focused, con)?;
+ self.apply_command(w, cmd, &skin.focused, con)?;
}
}
event_source.unblock(self.quitting);
@@ -540,11 +542,11 @@ impl App {
debug!("got sequence: {:?}", &raw_sequence);
for (input, arg_cmd) in raw_sequence.parse(con)? {
self.mut_panel().set_input_content(&input);
- self.apply_command(w, arg_cmd, screen, &skin.focused, con)?;
- self.display_panels(w, screen, &skin, con)?;
+ self.apply_command(w, arg_cmd, &skin.focused, con)?;
+ self.display_panels(w, &skin, con)?;
w.flush()?;
- self.do_pending_tasks(screen, con, &mut dam)?;
- self.display_panels(w, screen, &skin, con)?;
+ self.do_pending_tasks(con, &mut dam)?;
+ self.display_panels(w, &skin, con)?;
w.flush()?;
if self.quitting {
// is that a 100% safe way of quitting ?
diff --git a/src/app/panel.rs b/src/app/panel.rs
index 91c7c49..f5aec63 100644
--- a/src/app/panel.rs
+++ b/src/app/panel.rs
@@ -64,7 +64,7 @@ impl Panel {
w: &mut W,
cmd: &Command,
other_path: &Option<PathBuf>,
- screen: &mut Screen,
+ screen: Screen,
panel_skin: &PanelSkin,
preview: Option<PanelId>,
con: &AppContext,
@@ -102,7 +102,7 @@ impl Panel {
/// the dam asks for interruption
pub fn do_pending_tasks(
&mut self,
- screen: &mut Screen,
+ screen: Screen,
con: &AppContext,
dam: &mut Dam,
) -> Result<bool, ProgramError> {
@@ -185,7 +185,7 @@ impl Panel {
&mut self,
w: &mut W,
active: bool,
- screen: &mut Screen,
+ screen: Screen,
panel_skin: &PanelSkin,
con: &AppContext,
) -> Result<(), ProgramError> {
@@ -214,7 +214,7 @@ impl Panel {
&self,
w: &mut W,
panel_skin: &PanelSkin,
- screen: &Screen,
+ screen: Screen,
) -> Result<(), ProgramError> {
let task = self.state().get_pending_task();
status_line::write(w, task, &self.status, &self.areas.status, panel_skin, screen)
@@ -227,7 +227,7 @@ impl Panel {
&self,
w: &mut W,
panel_skin: &PanelSkin,
- screen: &Screen,
+ screen: Screen,
con: &AppContext,
) -> Result<(), ProgramError> {
if !self.purpose.is_arg_edition() {
diff --git a/src/app/state.rs b/src/app/state.rs
index f48e3e8..2771b52 100644
--- a/src/app/state.rs
+++ b/src/app/state.rs
@@ -29,7 +29,7 @@ pub trait AppState {
&mut self,
_x: u16,
_y: u16,
- _screen: &mut Screen,
+ _screen: Screen,
_con: &AppContext,
) -> Result<AppStateCmdResult, ProgramError> {
Ok(AppStateCmdResult::Keep)
@@ -39,7 +39,7 @@ pub trait AppState {
&mut self,
_x: u16,
_y: u16,
- _screen: &mut Screen,
+ _screen: Screen,
_con: &AppContext,
) -> Result<AppStateCmdResult, ProgramError> {
Ok(AppStateCmdResult::Keep)
@@ -65,7 +65,7 @@ pub trait AppState {
input_invocation: Option<&VerbInvocation>,
trigger_type: TriggerType,
cc: &CmdContext,
- screen: &mut Screen, // TODO remove (seeems to be used only for page_height)
+ screen: Screen,
) -> Result<AppStateCmdResult, ProgramError>;
/// a generic implementation of on_internal which may be
@@ -78,7 +78,7 @@ pub trait AppState {
input_invocation: Option<&VerbInvocation>,
_trigger_type: TriggerType,
cc: &CmdContext,
- screen: &mut Screen,
+ screen: Screen,
) -> Result<AppStateCmdResult, ProgramError> {
let con = &cc.con;
Ok(match internal_exec.internal {
@@ -174,7 +174,7 @@ pub trait AppState {
invocation: Option<&VerbInvocation>,
trigger_type: TriggerType,
cc: &CmdContext,
- screen: &mut Screen,
+ screen: Screen,
) -> Result<AppStateCmdResult, ProgramError> {
let exec_builder = || {
ExecutionStringBuilder::from_invocation(
@@ -221,7 +221,7 @@ pub trait AppState {
&mut self,
w: &mut W,
cc: &CmdContext,
- screen: &mut Screen,
+ screen: Screen,
) -> Result<AppStateCmdResult, ProgramError> {
self.clear_pending();
let con = &cc.con;
@@ -330,11 +330,11 @@ pub trait AppState {
fn selection(&self) -> Selection<'_>;
- fn refresh(&mut self, screen: &Screen, con: &AppContext) -> Command;
+ fn refresh(&mut self, screen: Screen, con: &AppContext) -> Command;
fn do_pending_task(
&mut self,
- _screen: &mut Screen,
+ _screen: Screen,
_con: &AppContext,
_dam: &mut Dam,
) {
@@ -349,7 +349,7 @@ pub trait AppState {
fn display(
&mut self,
w: &mut W,
- screen: &Screen,
+ screen: Screen,
state_area: Area,
skin: &PanelSkin,
con: &AppContext,
diff --git a/src/browser/browser_state.rs b/src/browser/browser_state.rs
index a94ed7c..6feb10d 100644
--- a/src/browser/browser_state.rs
+++ b/src/browser/browser_state.rs
@@ -41,7 +41,7 @@ impl BrowserState {
pub fn new(
path: PathBuf,
mut options: TreeOptions,
- screen: &Screen,
+ screen: Screen,
con: &AppContext,
dam: &Dam,
) -> Result<Option<BrowserState>, TreeBuildError> {
@@ -65,7 +65,7 @@ impl BrowserState {
/// different options
pub fn with_new_options(
&self,
- screen: &Screen,
+ screen: Screen,
change_options: &dyn Fn(&mut TreeOptions),
in_new_panel: bool,
con: &AppContext,
@@ -83,7 +83,7 @@ impl BrowserState {
self.tree.root()
}
- pub fn page_height(screen: &Screen) -> i32 {
+ pub fn page_height(screen: Screen) -> i32 {
i32::from(screen.height) - 2
}
@@ -101,7 +101,7 @@ impl BrowserState {
pub fn open_selection_stay_in_broot(
&mut self,
- screen: &mut Screen,
+ screen: Screen,
con: &AppContext,
in_new_panel: bool,
keep_pattern: bool,
@@ -145,7 +145,7 @@ impl BrowserState {
pub fn go_to_parent(
&mut self,
- screen: &mut Screen,
+ screen: Screen,
con: &AppContext,
in_new_panel: bool,
) -> AppStateCmdResult {
@@ -197,7 +197,7 @@ impl AppState for BrowserState {
&mut self,
_x: u16,
y: u16,
- _screen: &mut Screen,
+ _screen: Screen,
_con: &AppContext,
) -> Result<AppStateCmdResult, ProgramError> {
self.displayed_tree_mut().try_select_y(y as i32);
@@ -208,7 +208,7 @@ impl AppState for BrowserState {
&mut self,
_x: u16,
y: u16,
- screen: &mut Screen,
+ screen: Screen,
con: &AppContext,
) -> Result<AppStateCmdResult, ProgramError> {
if self.displayed_tree().selection == y as usize {
@@ -240,7 +240,7 @@ impl AppState for BrowserState {
input_invocation: Option<&VerbInvocation>,
trigger_type: TriggerType,
cc: &CmdContext,
- screen: &mut Screen,
+ screen: Screen,
) -> Result<AppStateCmdResult, ProgramError> {
let con = &cc.con;
let page_height = BrowserState::page_height(screen);
@@ -549,7 +549,7 @@ impl AppState for BrowserState {
/// Stop as soon as the dam asks for interruption
fn do_pending_task(
&mut self,
- screen: &mut Screen,
+ screen: Screen,
con: &AppContext,
dam: &mut Dam,
) {
@@ -590,7 +590,7 @@ impl AppState for BrowserState {
fn display(
&mut self,
w: &mut W,
- _screen: &Screen,
+ _screen: Screen,
area: Area,
panel_skin: &PanelSkin,
con: &AppContext,
@@ -607,7 +607,7 @@ impl AppState for BrowserState {
dp.write_on(w)
}
- fn refresh(&mut self, screen: &Screen, con: &AppContext) -> Command {
+ fn refresh(&mut self, screen: Screen, con: &AppContext) -> Command {
let page_height = BrowserState::page_height(screen) as usize;
// refresh the base tree
if let Err(e) = self.tree.refresh(page_height, con) {
diff --git a/src/cli.rs b/src/cli.rs
index 6342588..28098e5 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -4,7 +4,7 @@ use {
crate::{
app::{App, AppContext},
conf::Conf,
- display::{self, Screen},
+ display,
errors::{ProgramError, TreeBuildError},
launchable::Launchable,
shell_install::{ShellInstall, ShellInstallState},
@@ -236,15 +236,14 @@ pub fn run() -> Result<Option<Launchable>, ProgramError> {
let context = AppContext::from(launch_args, verb_store, &config);
let mut w = display::writer();
- let mut screen = Screen::new(&context, &config)?;
- let app = App::new(&context, &screen)?;
+ let app = App::new(&context)?;
w.queue(EnterAlternateScreen)?;
w.queue(cursor::DisableBlinking)?;
w.queue(cursor::Hide)?;
if !config.disable_mouse_capture {
w.queue(EnableMouseCapture)?;
}
- let r = app.run(&mut w, &mut screen, &context, &config);
+ let r = app.run(&mut w, &context, &config);
if !config.disable_mouse_capture {
w.queue(DisableMouseCapture)?;
}
diff --git a/src/display/areas.rs b/src/display/areas.rs
index 8c0764f..bba65f4 100644
--- a/src/display/areas.rs
+++ b/src/display/areas.rs
@@ -37,7 +37,7 @@ impl Areas {
pub fn create(
present_panels: &mut [Panel],
mut insertion_idx: usize,
- screen: &Screen,
+ screen: Screen,
with_preview: bool, // slightly larger last panel
) -> Result<Self, ProgramError> {
if insertion_idx > present_panels.len() {
@@ -65,7 +65,7 @@ impl Areas {
pub fn resize_all(
panels: &mut [Panel],
- screen: &Screen,
+ screen: Screen,
with_preview: bool, // slightly larger last panel
) -> Result<(), ProgramError> {
let mut slots = Vec::new();
@@ -78,7 +78,7 @@ impl Areas {
fn compute_areas(
panels: &mut [Panel],
slots: &mut Vec<Slot>,
- screen: &Screen,
+ screen: Screen,
with_preview: bool, // slightly larger last panel
) -> Result<(), ProgramError> {
if screen.height < MINIMAL_PANEL_HEIGHT {
diff --git a/src/display/screen.rs b/src/display/screen.rs
index ed93177..cf6c3a3 100644
--- a/src/display/screen.rs
+++ b/src/display/screen.rs
@@ -1,7 +1,6 @@
use {
crate::{
app::AppContext,
- conf::Conf,
errors::ProgramError,
skin::PanelSkin,
},
@@ -14,13 +13,15 @@ use {
termimad::Area,
};
+/// The dimensions of the screen
+#[derive(Clone, Copy)]
pub struct Screen {
pub width: u16,
pub height: u16,
}
impl Screen {
- pub fn new(con: &AppContext, _conf: &Conf) -> Result<Screen, ProgramError> {
+ pub fn new(con: &AppContext) -> Result<Screen, ProgramError> {
let mut screen = Screen {
width: 0,
height: 0,
@@ -41,18 +42,18 @@ impl Screen {
Ok(())
}
/// move the cursor to x,y
- pub fn goto(&self, w: &mut W, x: u16, y: u16) -> Result<(), ProgramError> {
+ pub fn goto(self, w: &mut W, x: u16, y: u16) -> Result<(), ProgramError> {
w.queue(cursor::MoveTo(x, y))?;
Ok(())
}
/// clear from the cursor to the end of line
- pub fn clear_line(&self, w: &mut W) -> Result<(), ProgramError> {
+ pub fn clear_line(self, w: &mut W) -> Result<(), ProgramError> {
w.queue(Clear(ClearType::UntilNewLine))?;
Ok(())
}
/// clear the area and everything to the right.
/// Should be used with parcimony as it could lead to flickering.
- pub fn clear_area_to_right(&self, w: &mut W, area: &Area) -> Result<(), ProgramError> {
+ pub fn clear_area_to_right(self, w: &mut W, area: &Area) -> Result<(), ProgramError> {
for y in area.top..area.top+area.height {
self.goto(w, area.left, y)?;
self.clear_line(w)?;
diff --git a/src/display/status_line.rs b/src/display/status_line.rs
index 00f13aa..19dbb98 100644
--- a/src/display/status_line.rs
+++ b/src/display/status_line.rs
@@ -16,7 +16,7 @@ pub fn write(
status: &Status,
area: &Area,
panel_skin: &PanelSkin,
- screen: &Screen,
+ screen: Screen,
) -> Result<(), ProgramError> {
let y = area.top;
screen.goto(w, area.left, y)?;
@@ -48,7 +48,7 @@ pub fn erase(
w: &mut W,
area: &Area,
panel_skin: &PanelSkin,
- screen: &Screen,
+ screen: Screen,
) -> Result<(), ProgramError> {
screen.goto(w, area.left, area.top)?;
let sc = StyledChar::new(
diff --git a/src/flag/mod.rs b/src/flag/mod.rs
index bb4f7c2..5748bae 100644
--- a/src/flag/mod.rs
+++ b/src/flag/mod.rs
@@ -1,6 +1,7 @@
/// Right now the flag is just a vessel for display.
+#[derive(Clone, Copy)]
pub struct Flag {
pub name: &'static str,
pub value: &'static str,
diff --git a/src/help/help_state.rs b/src/help/help_state.rs
index ef19709..df31fdd 100644
--- a/src/help/help_state.rs
+++ b/src/help/help_state.rs
@@ -24,7 +24,7 @@ pub struct HelpState {
}
impl HelpState {
- pub fn new(_screen: &Screen, _con: &AppContext) -> HelpState {
+ pub fn new(_screen: Screen, _con: &AppContext) -> HelpState {
let text_area = Area::uninitialized(); // will be fixed at drawing time
HelpState {
text_area,
@@ -50,7 +50,7 @@ impl AppState for HelpState {
}
}
- fn refresh(&mut self, _screen: &Screen, _con: &AppContext) -> Command {
+ fn refresh(&mut self, _screen: Screen, _con: &AppContext) -> Command {
self.dirty = true;
Command::empty()
}
@@ -67,7 +67,7 @@ impl AppState for HelpState {
fn display(
&mut self,
w: &mut W,
- screen: &Screen,
+ screen: Screen,
state_area: Area,
panel_skin: &PanelSkin,
con: &AppContext,
@@ -144,7 +144,7 @@ impl AppState for HelpState {
input_invocation: Option<&VerbInvocation>,
trigger_type: TriggerType,
cc: &CmdContext,
- screen: &mut Screen,
+ screen: Screen,
) -> Result<AppStateCmdResult, ProgramError> {
use Internal::*;
Ok(match internal_exec.internal {
diff --git a/src/hex/hex_view.rs b/src/hex/hex_view.rs
index 19a6e88..b645ff3 100644
--- a/src/hex/hex_view.rs
+++ b/src/hex/hex_view.rs
@@ -97,7 +97,7 @@ impl HexView {
pub fn display(
&mut self,
w: &mut W,
- _screen: &Screen,
+ _screen: Screen,
panel_skin: &PanelSkin,
area: &Area,
) -> Result<(), ProgramError> {
@@ -217,7 +217,7 @@ impl HexView {
pub fn display_info(
&mut self,
w: &mut W,
- _screen: &Screen,
+ _screen: Screen,
panel_skin: &PanelSkin,
area: &Area,
) -> Result<(), ProgramError> {
diff --git a/src/image/image_view.rs b/src/image/image_view.rs
index 74053f4..ce45d7c 100644
--- a/src/image/image_view.rs
+++ b/src/image/image_view.rs
@@ -47,7 +47,7 @@ impl ImageView {
pub fn display(
&mut self,
w: &mut W,
- _screen: &Screen,
+ _screen: Screen,
panel_skin: &PanelSkin,
area: &Area,
con: &AppContext,
@@ -96,7 +96,7 @@ impl ImageView {
pub fn display_info(
&mut self,
w: &mut W,
- _screen: &Screen,
+ _screen: Screen,
panel_skin: &PanelSkin,
area: &Area,
) -> Result<(), ProgramError> {
diff --git a/src/launchable.rs b/src/launchable.rs
index ba971e7..0d1ccb2 100644
--- a/src/launchable.rs
+++ b/src/launchable.rs
@@ -84,7 +84,7 @@ impl Launchable {
}
pub fn tree_printer(
tree: &Tree,
- screen: &Screen,
+ screen: Screen,
style_map: StyleMap,
cols: Cols,
ext_colors: ExtColorMap,
diff --git a/src/preview/preview.rs b/src/preview/preview.rs
index 185961a..0115c83 100644
--- a/src/preview/preview.rs
+++ b/src/preview/preview.rs
@@ -217,7 +217,7 @@ impl Preview {
pub fn display(
&mut self,
w: &mut W,
- screen: &Screen,
+ screen: Screen,
panel_skin: &PanelSkin,
area: &Area,
con: &AppContext,
@@ -236,7 +236,7 @@ impl Preview {
pub fn display_info(
&mut self,
w: &mut W,
- screen: &Screen,
+ screen: Screen,
panel_skin: &PanelSkin,
area: &Area,
) -> Result<(), ProgramError> {
diff --git a/src/preview/preview_state.rs b/src/preview/preview_state.rs
index 86a1468..4cff8db 100644
--- a/src/preview/preview_state.rs
+++ b/src/preview/preview_state.rs
@@ -117,7 +117,7 @@ impl AppState for PreviewState {
/// do the preview filtering if required and not yet done
fn do_pending_task(
&mut self,
- _screen: &mut Screen,
+ _screen: Screen,
con: &AppContext,
dam: &mut Dam,
) {
@@ -160,7 +160,7 @@ impl AppState for PreviewState {
}
}
- fn refresh(&mut self, _screen: &Screen, con: &AppContext) -> Command {
+ fn refresh(&mut self, _screen: Screen, con: &AppContext) -> Command {
self.dirty = true;
self.set_selected_path(self.path.clone(), con);
Command::empty()
@@ -170,7 +170,7 @@ impl AppState for PreviewState {
&mut self,
_x: u16,
y: u16,
- _screen: &mut Screen,
+ _screen: Screen,
_con: &AppContext,
) -> Result<AppStateCmdResult, ProgramError> {
if y >= self.preview_area.top && y < self.preview_area.top + self.preview_area.height {
@@ -183,7 +183,7 @@ impl AppState for PreviewState {
fn display(
&mut self,
w: &mut W,
- screen: &Screen,
+ screen: Screen,
state_area: Area,
panel_skin: &PanelSkin,
con: &AppContext,
@@ -245,7 +245,7 @@ impl AppState for PreviewState {
input_invocation: Option<&VerbInvocation>,
trigger_type: TriggerType,
cc: &CmdContext,
- screen: &mut Screen,
+ screen: Screen,
) -> Result<AppStateCmdResult, ProgramError> {
match internal_exec.internal {
Internal::back => {
diff --git a/src/print.rs b/src/print.rs
index d9364d8..0409e7d 100644
--- a/src/print.rs
+++ b/src/print.rs
@@ -54,7 +54,7 @@ pub fn print_relative_path(path: &Path, con: &AppContext) -> io::Result<AppState
fn print_tree_to_file(
tree: &Tree,
- screen: &mut Screen,
+ screen: Screen,
file_path: &str,
cols: &Cols,
ext_colors: &ExtColorMap,
@@ -71,7 +71,7 @@ fn print_tree_to_file(
pub fn print_tree(
tree: &Tree,
- screen: &mut Screen,
+ screen: Screen,
panel_skin: &PanelSkin,
con: &AppContext,
) -> Result<AppStateCmdResult, ProgramError> {
diff --git a/src/syntactic/syntactic_view.rs b/src/syntactic/syntactic_view.rs
index 5516aed..aa707f4 100644
--- a/src/syntactic/syntactic_view.rs
+++ b/src/syntactic/syntactic_view.rs
@@ -265,7 +265,7 @@ impl SyntacticView {
pub fn display(
&mut self,
w: &mut W,
- _screen: &Screen,
+ _screen: Screen,
panel_skin: &PanelSkin,
area: &Area,
con: &AppContext,
@@ -388,7 +388,7 @@ impl SyntacticView {
pub fn display_info(
&mut self,
w: &mut W,
- _screen: &Screen,
+ _screen: Screen,
panel_skin: &PanelSkin,
area: &Area,
) -> Result<(), ProgramError> {
diff --git a/src/verb/internal_focus.rs b/src/verb/internal_focus.rs
index 7fb6100..4dfab43 100644
--- a/src/verb/internal_focus.rs
+++ b/