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},
cosmic_theme, executor,
iced::{
self,
futures::SinkExt,
subscription::{self, Subscription},
widget::row,
@ -91,7 +90,7 @@ impl cosmic::Application for App {
}
/// 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 {
core,
tab_model: segmented_button::ModelBuilder::default().build(),

View file

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

View file

@ -18,7 +18,6 @@ use cosmic::{
Shell,
},
};
use cosmic_text::{Action, Edit, Metrics, Motion, Scroll};
use std::{
cell::Cell,
cmp,
@ -168,7 +167,7 @@ where
tree: &widget::Tree,
renderer: &mut Renderer,
_theme: &Renderer::Theme,
style: &renderer::Style,
_style: &renderer::Style,
layout: Layout<'_>,
_cursor_position: mouse::Cursor,
viewport: &Rectangle,
@ -299,9 +298,8 @@ where
) -> Status {
let state = tree.state.downcast_mut::<State>();
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 mut font_system = font_system().write().unwrap();
let mut status = Status::Ignored;
match event {
@ -505,7 +503,7 @@ where
Event::Mouse(MouseEvent::CursorMoved { .. }) => {
if let Some(dragging) = &state.dragging {
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;
match dragging {
Dragging::Buffer => {