Code cleanup.
This commit is contained in:
parent
3233ed8ceb
commit
677c924323
2 changed files with 105 additions and 118 deletions
|
|
@ -445,7 +445,6 @@ impl App {
|
|||
}
|
||||
|
||||
fn save_config(&mut self) -> Command<Message> {
|
||||
|
||||
if let Some(ref config_handler) = self.config_handler {
|
||||
if let Err(err) = self.config.write_entry(config_handler) {
|
||||
log::error!("failed to save config: {}", err);
|
||||
|
|
@ -1667,9 +1666,8 @@ impl Application for App {
|
|||
self.set_context_title(context_page.title());
|
||||
|
||||
// Execute commands for specific pages
|
||||
if self.core.window.show_context {
|
||||
match self.context_page {
|
||||
ContextPage::GitManagement => {
|
||||
if self.core.window.show_context && self.context_page == ContextPage::GitManagement
|
||||
{
|
||||
self.git_project_status = None;
|
||||
let projects = self.projects.clone();
|
||||
return Command::perform(
|
||||
|
|
@ -1710,9 +1708,6 @@ impl Application for App {
|
|||
|x| x,
|
||||
);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure focus of correct input
|
||||
return self.update_focus();
|
||||
|
|
|
|||
|
|
@ -608,17 +608,14 @@ where
|
|||
Point::new(image_position.x + scrollbar_rect.x, image_position.y),
|
||||
Size::new(scrollbar_rect.width, layout.bounds().height),
|
||||
),
|
||||
border_radius: (scrollbar_rect.width as f32 / 2.0).into(),
|
||||
border_radius: (scrollbar_rect.width / 2.0).into(),
|
||||
border_width: 0.0,
|
||||
border_color: Color::TRANSPARENT,
|
||||
},
|
||||
Color::from(track_color),
|
||||
);
|
||||
|
||||
let pressed = match &state.dragging {
|
||||
Some(Dragging::Scrollbar { .. }) => true,
|
||||
_ => false,
|
||||
};
|
||||
let pressed = matches!(&state.dragging, Some(Dragging::Scrollbar { .. }));
|
||||
|
||||
let mut hover = false;
|
||||
if let Some(p) = cursor_position.position_in(layout.bounds()) {
|
||||
|
|
@ -668,7 +665,7 @@ where
|
|||
renderer.fill_quad(
|
||||
Quad {
|
||||
bounds: scrollbar_draw,
|
||||
border_radius: (scrollbar_draw.width as f32 / 2.0).into(),
|
||||
border_radius: (scrollbar_draw.width / 2.0).into(),
|
||||
border_width: 0.0,
|
||||
border_color: Color::TRANSPARENT,
|
||||
},
|
||||
|
|
@ -706,8 +703,7 @@ where
|
|||
Event::Keyboard(KeyEvent::KeyPressed {
|
||||
key_code,
|
||||
modifiers,
|
||||
}) if state.is_focused => {
|
||||
match key_code {
|
||||
}) if state.is_focused => match key_code {
|
||||
KeyCode::Left => {
|
||||
editor.action(Action::Motion(Motion::Left));
|
||||
status = Status::Captured;
|
||||
|
|
@ -765,17 +761,13 @@ where
|
|||
status = Status::Captured;
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
},
|
||||
Event::Keyboard(KeyEvent::ModifiersChanged(modifiers)) => {
|
||||
state.modifiers = modifiers;
|
||||
}
|
||||
Event::Keyboard(KeyEvent::CharacterReceived(character)) if state.is_focused => {
|
||||
// Only parse keys when Super, Ctrl, and Alt are not pressed
|
||||
if !state.modifiers.logo()
|
||||
&& !state.modifiers.control()
|
||||
&& !state.modifiers.alt()
|
||||
{
|
||||
if !state.modifiers.logo() && !state.modifiers.control() && !state.modifiers.alt() {
|
||||
if !character.is_control() {
|
||||
editor.action(Action::Insert(character));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue