Fix warnings

This commit is contained in:
Jeremy Soller 2023-12-21 09:53:31 -07:00
parent 8ec9fd22c9
commit 8008d0d2b0
No known key found for this signature in database
GPG key ID: DCFCA852D3906975
3 changed files with 11 additions and 20 deletions

View file

@ -6,7 +6,6 @@ use cosmic::{
app::{Command, Core, Settings}, app::{Command, Core, Settings},
cosmic_theme, executor, cosmic_theme, executor,
iced::{ iced::{
self,
futures::SinkExt, futures::SinkExt,
subscription::{self, Subscription}, subscription::{self, Subscription},
widget::row, widget::row,
@ -91,7 +90,7 @@ impl cosmic::Application for App {
} }
/// Creates the application, and optionally emits command on initialize. /// Creates the application, and optionally emits command on initialize.
fn init(core: Core, input: Self::Flags) -> (Self, Command<Self::Message>) { fn init(core: Core, _flags: Self::Flags) -> (Self, Command<Self::Message>) {
let mut app = App { let mut app = App {
core, core,
tab_model: segmented_button::ModelBuilder::default().build(), tab_model: segmented_button::ModelBuilder::default().build(),

View file

@ -1,10 +1,9 @@
use alacritty_terminal::{ use alacritty_terminal::{
ansi::{Color, Handler, NamedColor}, ansi::{Color, NamedColor},
config::{Config, PtyConfig}, config::Config,
event::{Event, EventListener, Notify, OnResize, WindowSize}, event::{Event, EventListener, Notify, OnResize, WindowSize},
event_loop::{EventLoop, Msg, Notifier, State}, event_loop::{EventLoop, Msg, Notifier},
grid::Dimensions, grid::Dimensions,
index::{Column, Line, Point},
sync::FairMutex, sync::FairMutex,
term::{ term::{
cell::Flags, cell::Flags,
@ -14,19 +13,16 @@ use alacritty_terminal::{
}; };
use cosmic::{iced::advanced::graphics::text::font_system, widget::segmented_button}; use cosmic::{iced::advanced::graphics::text::font_system, widget::segmented_button};
use cosmic_text::{ use cosmic_text::{
Attrs, AttrsList, Buffer, BufferLine, Family, FontSystem, Metrics, Shaping, Style, Weight, Wrap, Attrs, AttrsList, Buffer, BufferLine, Family, Metrics, Shaping, Style, Weight, Wrap,
}; };
use std::{ use std::{
borrow::Cow, borrow::Cow,
mem, mem,
sync::{Arc, Weak}, sync::{Arc, Weak},
thread::JoinHandle,
time::Instant, time::Instant,
}; };
use tokio::sync::mpsc; use tokio::sync::mpsc;
use crate::terminal_theme;
pub use alacritty_terminal::grid::Scroll as TerminalScroll; pub use alacritty_terminal::grid::Scroll as TerminalScroll;
#[derive(Clone, Copy, Debug)] #[derive(Clone, Copy, Debug)]
@ -103,7 +99,6 @@ pub struct Terminal {
term: Arc<FairMutex<Term<EventProxy>>>, term: Arc<FairMutex<Term<EventProxy>>>,
colors: Colors, colors: Colors,
notifier: Notifier, notifier: Notifier,
pty_join_handle: JoinHandle<(EventLoop<tty::Pty, EventProxy>, State)>,
} }
impl Terminal { impl Terminal {
@ -133,7 +128,7 @@ impl Terminal {
}; };
let config = Config::default(); let config = Config::default();
let mut size = Size { let size = Size {
width: (80.0 * cell_width).ceil() as u32, width: (80.0 * cell_width).ceil() as u32,
height: (24.0 * cell_height).ceil() as u32, height: (24.0 * cell_height).ceil() as u32,
cell_width, cell_width,
@ -157,7 +152,7 @@ impl Terminal {
false, false,
); );
let notifier = Notifier(pty_event_loop.channel()); let notifier = Notifier(pty_event_loop.channel());
let pty_join_handle = pty_event_loop.spawn(); let _pty_join_handle = pty_event_loop.spawn();
Self { Self {
colors, colors,
@ -166,7 +161,6 @@ impl Terminal {
size, size,
term, term,
notifier, notifier,
pty_join_handle,
} }
} }
@ -266,7 +260,7 @@ impl Terminal {
//TODO: is redraw needed after all events? //TODO: is redraw needed after all events?
//TODO: use LineDamageBounds //TODO: use LineDamageBounds
{ {
let mut buffer = Arc::make_mut(&mut self.buffer); let buffer = Arc::make_mut(&mut self.buffer);
let mut line_i = 0; let mut line_i = 0;
let mut last_point = None; let mut last_point = None;

View file

@ -18,7 +18,6 @@ use cosmic::{
Shell, Shell,
}, },
}; };
use cosmic_text::{Action, Edit, Metrics, Motion, Scroll};
use std::{ use std::{
cell::Cell, cell::Cell,
cmp, cmp,
@ -168,7 +167,7 @@ where
tree: &widget::Tree, tree: &widget::Tree,
renderer: &mut Renderer, renderer: &mut Renderer,
_theme: &Renderer::Theme, _theme: &Renderer::Theme,
style: &renderer::Style, _style: &renderer::Style,
layout: Layout<'_>, layout: Layout<'_>,
_cursor_position: mouse::Cursor, _cursor_position: mouse::Cursor,
viewport: &Rectangle, viewport: &Rectangle,
@ -299,9 +298,8 @@ where
) -> Status { ) -> Status {
let state = tree.state.downcast_mut::<State>(); let state = tree.state.downcast_mut::<State>();
let scrollbar_rect = state.scrollbar_rect.get(); let scrollbar_rect = state.scrollbar_rect.get();
let mut terminal = self.terminal.lock().unwrap(); let terminal = self.terminal.lock().unwrap();
let buffer_size = terminal.with_buffer(|buffer| buffer.size()); let buffer_size = terminal.with_buffer(|buffer| buffer.size());
let mut font_system = font_system().write().unwrap();
let mut status = Status::Ignored; let mut status = Status::Ignored;
match event { match event {
@ -505,7 +503,7 @@ where
Event::Mouse(MouseEvent::CursorMoved { .. }) => { Event::Mouse(MouseEvent::CursorMoved { .. }) => {
if let Some(dragging) = &state.dragging { if let Some(dragging) = &state.dragging {
if let Some(p) = cursor_position.position() { if let Some(p) = cursor_position.position() {
let x = (p.x - layout.bounds().x) - self.padding.left; let _x = (p.x - layout.bounds().x) - self.padding.left;
let y = (p.y - layout.bounds().y) - self.padding.top; let y = (p.y - layout.bounds().y) - self.padding.top;
match dragging { match dragging {
Dragging::Buffer => { Dragging::Buffer => {