chore: updating newfound lints
This commit is contained in:
parent
e9c809bf28
commit
485497973f
2 changed files with 264 additions and 270 deletions
|
|
@ -17,7 +17,7 @@ use winit::{
|
||||||
fn main() {
|
fn main() {
|
||||||
env_logger::init();
|
env_logger::init();
|
||||||
|
|
||||||
let path = env::args().nth(1).unwrap_or(String::new());
|
let path = env::args().nth(1).unwrap_or_default();
|
||||||
|
|
||||||
let event_loop = EventLoop::new().unwrap();
|
let event_loop = EventLoop::new().unwrap();
|
||||||
let window = Rc::new(WindowBuilder::new().build(&event_loop).unwrap());
|
let window = Rc::new(WindowBuilder::new().build(&event_loop).unwrap());
|
||||||
|
|
@ -71,8 +71,10 @@ fn main() {
|
||||||
.run(|event, elwt| {
|
.run(|event, elwt| {
|
||||||
elwt.set_control_flow(ControlFlow::Wait);
|
elwt.set_control_flow(ControlFlow::Wait);
|
||||||
|
|
||||||
match event {
|
let Event::WindowEvent { window_id, event } = event else {
|
||||||
Event::WindowEvent { window_id, event } => {
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
match event {
|
match event {
|
||||||
WindowEvent::ScaleFactorChanged { scale_factor, .. } => {
|
WindowEvent::ScaleFactorChanged { scale_factor, .. } => {
|
||||||
log::info!("Updated scale factor for {window_id:?}");
|
log::info!("Updated scale factor for {window_id:?}");
|
||||||
|
|
@ -115,16 +117,17 @@ fn main() {
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
let mut paint = Paint::default();
|
let mut paint = Paint {
|
||||||
paint.anti_alias = false;
|
anti_alias: false,
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
editor.shape_as_needed(true);
|
editor.shape_as_needed(true);
|
||||||
editor.draw(&mut swash_cache, |x, y, w, h, color| {
|
editor.draw(&mut swash_cache, |x, y, w, h, color| {
|
||||||
// Note: due to softbuffer and tiny_skia having incompatible internal color representations we swap
|
// Note: due to softbuffer and tiny_skia having incompatible internal color representations we swap
|
||||||
// the red and blue channels here
|
// the red and blue channels here
|
||||||
paint.set_color_rgba8(color.b(), color.g(), color.r(), color.a());
|
paint.set_color_rgba8(color.b(), color.g(), color.r(), color.a());
|
||||||
pixmap.fill_rect(
|
pixmap.fill_rect(
|
||||||
Rect::from_xywh(x as f32, y as f32, w as f32, h as f32)
|
Rect::from_xywh(x as f32, y as f32, w as f32, h as f32).unwrap(),
|
||||||
.unwrap(),
|
|
||||||
&paint,
|
&paint,
|
||||||
Transform::identity(),
|
Transform::identity(),
|
||||||
None,
|
None,
|
||||||
|
|
@ -198,9 +201,7 @@ fn main() {
|
||||||
Key::Named(NamedKey::Home) => {
|
Key::Named(NamedKey::Home) => {
|
||||||
editor.action(Action::Motion(Motion::Home))
|
editor.action(Action::Motion(Motion::Home))
|
||||||
}
|
}
|
||||||
Key::Named(NamedKey::End) => {
|
Key::Named(NamedKey::End) => editor.action(Action::Motion(Motion::End)),
|
||||||
editor.action(Action::Motion(Motion::End))
|
|
||||||
}
|
|
||||||
Key::Named(NamedKey::PageUp) => {
|
Key::Named(NamedKey::PageUp) => {
|
||||||
editor.action(Action::Motion(Motion::PageUp))
|
editor.action(Action::Motion(Motion::PageUp))
|
||||||
}
|
}
|
||||||
|
|
@ -209,9 +210,7 @@ fn main() {
|
||||||
}
|
}
|
||||||
Key::Named(NamedKey::Escape) => editor.action(Action::Escape),
|
Key::Named(NamedKey::Escape) => editor.action(Action::Escape),
|
||||||
Key::Named(NamedKey::Enter) => editor.action(Action::Enter),
|
Key::Named(NamedKey::Enter) => editor.action(Action::Enter),
|
||||||
Key::Named(NamedKey::Backspace) => {
|
Key::Named(NamedKey::Backspace) => editor.action(Action::Backspace),
|
||||||
editor.action(Action::Backspace)
|
|
||||||
}
|
|
||||||
Key::Named(NamedKey::Delete) => editor.action(Action::Delete),
|
Key::Named(NamedKey::Delete) => editor.action(Action::Delete),
|
||||||
Key::Named(key) => {
|
Key::Named(key) => {
|
||||||
if let Some(text) = key.to_text() {
|
if let Some(text) = key.to_text() {
|
||||||
|
|
@ -227,8 +226,7 @@ fn main() {
|
||||||
font_size_i = font_size_default;
|
font_size_i = font_size_default;
|
||||||
editor.with_buffer_mut(|buffer| {
|
editor.with_buffer_mut(|buffer| {
|
||||||
buffer.set_metrics(
|
buffer.set_metrics(
|
||||||
font_sizes[font_size_i]
|
font_sizes[font_size_i].scale(display_scale),
|
||||||
.scale(display_scale),
|
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -310,9 +308,7 @@ fn main() {
|
||||||
button,
|
button,
|
||||||
} => {
|
} => {
|
||||||
if button == MouseButton::Left {
|
if button == MouseButton::Left {
|
||||||
if state == ElementState::Pressed
|
if state == ElementState::Pressed && mouse_left == ElementState::Released {
|
||||||
&& mouse_left == ElementState::Released
|
|
||||||
{
|
|
||||||
editor.action(Action::Click {
|
editor.action(Action::Click {
|
||||||
x: mouse_x as i32,
|
x: mouse_x as i32,
|
||||||
y: mouse_y as i32,
|
y: mouse_y as i32,
|
||||||
|
|
@ -347,9 +343,6 @@ fn main() {
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1249,7 +1249,8 @@ impl ShapeLine {
|
||||||
let trailing_blank = span
|
let trailing_blank = span
|
||||||
.words
|
.words
|
||||||
.get(i + 1)
|
.get(i + 1)
|
||||||
.map_or(false, |previous_word| previous_word.blank);
|
.is_some_and(|previous_word| previous_word.blank);
|
||||||
|
|
||||||
if trailing_blank {
|
if trailing_blank {
|
||||||
number_of_blanks = number_of_blanks.saturating_sub(1);
|
number_of_blanks = number_of_blanks.saturating_sub(1);
|
||||||
add_to_visual_line(
|
add_to_visual_line(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue