Fix all auto-fix from clippy
This commit is contained in:
parent
c8b18c2827
commit
f50ece41eb
5 changed files with 63 additions and 105 deletions
101
src/main.rs
101
src/main.rs
|
|
@ -177,11 +177,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||||
|
|
||||||
let shortcuts_config = shortcuts::ShortcutsConfig::new(config.shortcuts_custom.clone());
|
let shortcuts_config = shortcuts::ShortcutsConfig::new(config.shortcuts_custom.clone());
|
||||||
|
|
||||||
let shell = if let Some(shell_program) = shell_program_opt {
|
let shell = shell_program_opt.map(|shell_program| tty::Shell::new(shell_program, shell_args));
|
||||||
Some(tty::Shell::new(shell_program, shell_args))
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
};
|
|
||||||
let startup_options = Some(tty::Options {
|
let startup_options = Some(tty::Options {
|
||||||
shell,
|
shell,
|
||||||
working_directory,
|
working_directory,
|
||||||
|
|
@ -554,8 +550,7 @@ impl App {
|
||||||
.config
|
.config
|
||||||
.color_schemes(color_scheme_kind)
|
.color_schemes(color_scheme_kind)
|
||||||
.get(&color_scheme_id)
|
.get(&color_scheme_id)
|
||||||
{
|
&& self
|
||||||
if self
|
|
||||||
.themes
|
.themes
|
||||||
.insert(
|
.insert(
|
||||||
(color_scheme_name.clone(), color_scheme_kind),
|
(color_scheme_name.clone(), color_scheme_kind),
|
||||||
|
|
@ -569,7 +564,6 @@ impl App {
|
||||||
color_scheme_name
|
color_scheme_name
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -699,8 +693,8 @@ impl App {
|
||||||
// but only for the active pane/tab
|
// but only for the active pane/tab
|
||||||
if let Some(tab_model) = self.pane_model.active() {
|
if let Some(tab_model) = self.pane_model.active() {
|
||||||
for entity in tab_model.iter() {
|
for entity in tab_model.iter() {
|
||||||
if tab_model.is_active(entity) {
|
if tab_model.is_active(entity)
|
||||||
if let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity) {
|
&& let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity) {
|
||||||
let mut terminal = terminal.lock().unwrap();
|
let mut terminal = terminal.lock().unwrap();
|
||||||
let current_zoom_adj = terminal.zoom_adj();
|
let current_zoom_adj = terminal.zoom_adj();
|
||||||
match zoom_message {
|
match zoom_message {
|
||||||
|
|
@ -714,7 +708,6 @@ impl App {
|
||||||
}
|
}
|
||||||
terminal.set_config(&self.config, &self.themes);
|
terminal.set_config(&self.config, &self.themes);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Task::none()
|
Task::none()
|
||||||
|
|
@ -722,8 +715,8 @@ impl App {
|
||||||
|
|
||||||
fn save_color_schemes(&mut self, color_scheme_kind: ColorSchemeKind) -> Task<Message> {
|
fn save_color_schemes(&mut self, color_scheme_kind: ColorSchemeKind) -> Task<Message> {
|
||||||
// Optimized for just saving color_schemes
|
// Optimized for just saving color_schemes
|
||||||
if let Some(ref config_handler) = self.config_handler {
|
if let Some(ref config_handler) = self.config_handler
|
||||||
if let Err(err) = config_handler.set(
|
&& let Err(err) = config_handler.set(
|
||||||
match color_scheme_kind {
|
match color_scheme_kind {
|
||||||
ColorSchemeKind::Dark => "color_schemes_dark",
|
ColorSchemeKind::Dark => "color_schemes_dark",
|
||||||
ColorSchemeKind::Light => "color_schemes_light",
|
ColorSchemeKind::Light => "color_schemes_light",
|
||||||
|
|
@ -732,7 +725,6 @@ impl App {
|
||||||
) {
|
) {
|
||||||
log::error!("failed to save config: {}", err);
|
log::error!("failed to save config: {}", err);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
self.update_color_schemes();
|
self.update_color_schemes();
|
||||||
Task::none()
|
Task::none()
|
||||||
}
|
}
|
||||||
|
|
@ -1026,11 +1018,10 @@ impl App {
|
||||||
let mut found_actions = false;
|
let mut found_actions = false;
|
||||||
for action in group.actions {
|
for action in group.actions {
|
||||||
let action_label = shortcuts::action_label(action);
|
let action_label = shortcuts::action_label(action);
|
||||||
if let Some(regex) = &self.shortcut_search_regex {
|
if let Some(regex) = &self.shortcut_search_regex
|
||||||
if regex.find(&action_label).is_none() {
|
&& regex.find(&action_label).is_none() {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
found_actions = true;
|
found_actions = true;
|
||||||
|
|
||||||
let (bindings, changed) = self.shortcuts_config.bindings_for_action(action);
|
let (bindings, changed) = self.shortcuts_config.bindings_for_action(action);
|
||||||
|
|
@ -1543,13 +1534,12 @@ impl App {
|
||||||
self.startup_options.take().unwrap_or_default();
|
self.startup_options.take().unwrap_or_default();
|
||||||
let options = tty::Options {
|
let options = tty::Options {
|
||||||
shell: startup_options.shell.or_else(|| {
|
shell: startup_options.shell.or_else(|| {
|
||||||
if let Some(mut args) = shlex::split(&profile.command) {
|
if let Some(mut args) = shlex::split(&profile.command)
|
||||||
if !args.is_empty() {
|
&& !args.is_empty() {
|
||||||
let command = args.remove(0);
|
let command = args.remove(0);
|
||||||
return Some(tty::Shell::new(command, args));
|
return Some(tty::Shell::new(command, args));
|
||||||
}
|
}
|
||||||
}
|
None
|
||||||
return None;
|
|
||||||
}),
|
}),
|
||||||
working_directory: startup_options.working_directory.or_else(
|
working_directory: startup_options.working_directory.or_else(
|
||||||
|| {
|
|| {
|
||||||
|
|
@ -1956,8 +1946,8 @@ impl Application for App {
|
||||||
.get(&color_scheme_id)
|
.get(&color_scheme_id)
|
||||||
.map(|color_scheme| color_scheme.name.clone()),
|
.map(|color_scheme| color_scheme.name.clone()),
|
||||||
None => Some(format!("COSMIC {:?}", color_scheme_kind)),
|
None => Some(format!("COSMIC {:?}", color_scheme_kind)),
|
||||||
} {
|
}
|
||||||
if self.dialog_opt.is_none() {
|
&& self.dialog_opt.is_none() {
|
||||||
let (dialog, command) = Dialog::new(
|
let (dialog, command) = Dialog::new(
|
||||||
DialogSettings::new().kind(DialogKind::SaveFile {
|
DialogSettings::new().kind(DialogKind::SaveFile {
|
||||||
filename: format!("{}.ron", color_scheme_name),
|
filename: format!("{}.ron", color_scheme_name),
|
||||||
|
|
@ -1974,7 +1964,6 @@ impl Application for App {
|
||||||
self.dialog_opt = Some(dialog);
|
self.dialog_opt = Some(dialog);
|
||||||
return command;
|
return command;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Message::ColorSchemeExportResult(color_scheme_kind, color_scheme_id_opt, result) => {
|
Message::ColorSchemeExportResult(color_scheme_kind, color_scheme_id_opt, result) => {
|
||||||
//TODO: show errors in UI
|
//TODO: show errors in UI
|
||||||
|
|
@ -2115,8 +2104,7 @@ impl Application for App {
|
||||||
Message::ColorSchemeRenameSubmit => {
|
Message::ColorSchemeRenameSubmit => {
|
||||||
if let Some((color_scheme_kind, color_scheme_id, color_scheme_name)) =
|
if let Some((color_scheme_kind, color_scheme_id, color_scheme_name)) =
|
||||||
self.color_scheme_renaming.take()
|
self.color_scheme_renaming.take()
|
||||||
{
|
&& let Some(color_scheme) = self
|
||||||
if let Some(color_scheme) = self
|
|
||||||
.config
|
.config
|
||||||
.color_schemes_mut(color_scheme_kind)
|
.color_schemes_mut(color_scheme_kind)
|
||||||
.get_mut(&color_scheme_id)
|
.get_mut(&color_scheme_id)
|
||||||
|
|
@ -2124,7 +2112,6 @@ impl Application for App {
|
||||||
color_scheme.name = color_scheme_name;
|
color_scheme.name = color_scheme_name;
|
||||||
return self.save_color_schemes(color_scheme_kind);
|
return self.save_color_schemes(color_scheme_kind);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Message::ColorSchemeTabActivate(entity) => {
|
Message::ColorSchemeTabActivate(entity) => {
|
||||||
if let Some(color_scheme_kind) =
|
if let Some(color_scheme_kind) =
|
||||||
|
|
@ -2344,29 +2331,27 @@ impl Application for App {
|
||||||
return self.update_focus();
|
return self.update_focus();
|
||||||
}
|
}
|
||||||
Message::FindNext => {
|
Message::FindNext => {
|
||||||
if !self.find_search_value.is_empty() {
|
if !self.find_search_value.is_empty()
|
||||||
if let Some(tab_model) = self.pane_model.active() {
|
&& let Some(tab_model) = self.pane_model.active() {
|
||||||
let entity = tab_model.active();
|
let entity = tab_model.active();
|
||||||
if let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity) {
|
if let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity) {
|
||||||
let mut terminal = terminal.lock().unwrap();
|
let mut terminal = terminal.lock().unwrap();
|
||||||
terminal.search(&self.find_search_value, true);
|
terminal.search(&self.find_search_value, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Focus correct input
|
// Focus correct input
|
||||||
return self.update_focus();
|
return self.update_focus();
|
||||||
}
|
}
|
||||||
Message::FindPrevious => {
|
Message::FindPrevious => {
|
||||||
if !self.find_search_value.is_empty() {
|
if !self.find_search_value.is_empty()
|
||||||
if let Some(tab_model) = self.pane_model.active() {
|
&& let Some(tab_model) = self.pane_model.active() {
|
||||||
let entity = tab_model.active();
|
let entity = tab_model.active();
|
||||||
if let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity) {
|
if let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity) {
|
||||||
let mut terminal = terminal.lock().unwrap();
|
let mut terminal = terminal.lock().unwrap();
|
||||||
terminal.search(&self.find_search_value, false);
|
terminal.search(&self.find_search_value, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Focus correct input
|
// Focus correct input
|
||||||
return self.update_focus();
|
return self.update_focus();
|
||||||
|
|
@ -2462,11 +2447,9 @@ impl Application for App {
|
||||||
let mut terminal = terminal.lock().unwrap();
|
let mut terminal = terminal.lock().unwrap();
|
||||||
if let Some(url) =
|
if let Some(url) =
|
||||||
terminal.context_menu.as_ref().and_then(|m| m.link.as_ref())
|
terminal.context_menu.as_ref().and_then(|m| m.link.as_ref())
|
||||||
{
|
&& let Err(err) = open::that_detached(url) {
|
||||||
if let Err(err) = open::that_detached(url) {
|
|
||||||
log::warn!("failed to open {:?}: {}", url, err);
|
log::warn!("failed to open {:?}: {}", url, err);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
terminal.context_menu = None;
|
terminal.context_menu = None;
|
||||||
terminal.active_regex_match = None;
|
terminal.active_regex_match = None;
|
||||||
terminal.needs_update = true;
|
terminal.needs_update = true;
|
||||||
|
|
@ -2829,8 +2812,8 @@ impl Application for App {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Close terminal context menu state
|
// Close terminal context menu state
|
||||||
if let Some(tab_model) = self.pane_model.active() {
|
if let Some(tab_model) = self.pane_model.active()
|
||||||
if let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity) {
|
&& let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity) {
|
||||||
let mut terminal = terminal.lock().unwrap();
|
let mut terminal = terminal.lock().unwrap();
|
||||||
//Some actions need the menu_state,
|
//Some actions need the menu_state,
|
||||||
//so only clear the position for them.
|
//so only clear the position for them.
|
||||||
|
|
@ -2845,7 +2828,6 @@ impl Application for App {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
tasks.push(self.update(action.message(Some(entity))));
|
tasks.push(self.update(action.message(Some(entity))));
|
||||||
return cosmic::Task::batch(tasks);
|
return cosmic::Task::batch(tasks);
|
||||||
}
|
}
|
||||||
|
|
@ -2967,7 +2949,7 @@ impl Application for App {
|
||||||
.position(tab_model.active())
|
.position(tab_model.active())
|
||||||
.and_then(|i| (i as usize).checked_sub(1))
|
.and_then(|i| (i as usize).checked_sub(1))
|
||||||
.unwrap_or_else(|| {
|
.unwrap_or_else(|| {
|
||||||
tab_model.iter().count().checked_sub(1).unwrap_or_default()
|
tab_model.iter().count().saturating_sub(1)
|
||||||
});
|
});
|
||||||
|
|
||||||
let entity = tab_model.iter().nth(pos);
|
let entity = tab_model.iter().nth(pos);
|
||||||
|
|
@ -3007,14 +2989,13 @@ impl Application for App {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
TermEvent::ColorRequest(index, f) => {
|
TermEvent::ColorRequest(index, f) => {
|
||||||
if let Some(tab_model) = self.pane_model.panes.get(pane) {
|
if let Some(tab_model) = self.pane_model.panes.get(pane)
|
||||||
if let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity) {
|
&& let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity) {
|
||||||
let terminal = terminal.lock().unwrap();
|
let terminal = terminal.lock().unwrap();
|
||||||
let rgb = terminal.colors()[index].unwrap_or_default();
|
let rgb = terminal.colors()[index].unwrap_or_default();
|
||||||
let text = f(rgb);
|
let text = f(rgb);
|
||||||
terminal.input_no_scroll(text.into_bytes());
|
terminal.input_no_scroll(text.into_bytes());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
TermEvent::CursorBlinkingChange => {
|
TermEvent::CursorBlinkingChange => {
|
||||||
//TODO: should we blink the cursor?
|
//TODO: should we blink the cursor?
|
||||||
|
|
@ -3023,12 +3004,11 @@ impl Application for App {
|
||||||
return self.update(Message::TabClose(Some(entity)));
|
return self.update(Message::TabClose(Some(entity)));
|
||||||
}
|
}
|
||||||
TermEvent::PtyWrite(text) => {
|
TermEvent::PtyWrite(text) => {
|
||||||
if let Some(tab_model) = self.pane_model.panes.get(pane) {
|
if let Some(tab_model) = self.pane_model.panes.get(pane)
|
||||||
if let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity) {
|
&& let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity) {
|
||||||
let terminal = terminal.lock().unwrap();
|
let terminal = terminal.lock().unwrap();
|
||||||
terminal.input_no_scroll(text.into_bytes());
|
terminal.input_no_scroll(text.into_bytes());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
TermEvent::ResetTitle => {
|
TermEvent::ResetTitle => {
|
||||||
if let Some(tab_model) = self.pane_model.panes.get_mut(pane) {
|
if let Some(tab_model) = self.pane_model.panes.get_mut(pane) {
|
||||||
|
|
@ -3047,13 +3027,12 @@ impl Application for App {
|
||||||
return self.update_title(Some(pane));
|
return self.update_title(Some(pane));
|
||||||
}
|
}
|
||||||
TermEvent::TextAreaSizeRequest(f) => {
|
TermEvent::TextAreaSizeRequest(f) => {
|
||||||
if let Some(tab_model) = self.pane_model.panes.get(pane) {
|
if let Some(tab_model) = self.pane_model.panes.get(pane)
|
||||||
if let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity) {
|
&& let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity) {
|
||||||
let terminal = terminal.lock().unwrap();
|
let terminal = terminal.lock().unwrap();
|
||||||
let text = f(terminal.size().into());
|
let text = f(terminal.size().into());
|
||||||
terminal.input_no_scroll(text.into_bytes());
|
terminal.input_no_scroll(text.into_bytes());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
TermEvent::Title(title) => {
|
TermEvent::Title(title) => {
|
||||||
if let Some(tab_model) = self.pane_model.panes.get_mut(pane) {
|
if let Some(tab_model) = self.pane_model.panes.get_mut(pane) {
|
||||||
|
|
@ -3071,12 +3050,11 @@ impl Application for App {
|
||||||
return self.update_title(Some(pane));
|
return self.update_title(Some(pane));
|
||||||
}
|
}
|
||||||
TermEvent::MouseCursorDirty | TermEvent::Wakeup => {
|
TermEvent::MouseCursorDirty | TermEvent::Wakeup => {
|
||||||
if let Some(tab_model) = self.pane_model.panes.get(pane) {
|
if let Some(tab_model) = self.pane_model.panes.get(pane)
|
||||||
if let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity) {
|
&& let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity) {
|
||||||
let mut terminal = terminal.lock().unwrap();
|
let mut terminal = terminal.lock().unwrap();
|
||||||
terminal.needs_update = true;
|
terminal.needs_update = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
TermEvent::ChildExit(_error_code) => {
|
TermEvent::ChildExit(_error_code) => {
|
||||||
//Ignore this for now
|
//Ignore this for now
|
||||||
|
|
@ -3212,20 +3190,18 @@ impl Application for App {
|
||||||
return self.update_config();
|
return self.update_config();
|
||||||
}
|
}
|
||||||
Message::ContextMenuPopupClosed(id) => {
|
Message::ContextMenuPopupClosed(id) => {
|
||||||
if let Some((popup_id, pane, entity, _, _, _)) = &self.context_menu_popup {
|
if let Some((popup_id, pane, entity, _, _, _)) = &self.context_menu_popup
|
||||||
if id == *popup_id {
|
&& id == *popup_id {
|
||||||
// Clear link underline on the terminal
|
// Clear link underline on the terminal
|
||||||
if let Some(tab_model) = self.pane_model.panes.get(*pane) {
|
if let Some(tab_model) = self.pane_model.panes.get(*pane)
|
||||||
if let Some(terminal) = tab_model.data::<Mutex<Terminal>>(*entity) {
|
&& let Some(terminal) = tab_model.data::<Mutex<Terminal>>(*entity) {
|
||||||
let mut terminal = terminal.lock().unwrap();
|
let mut terminal = terminal.lock().unwrap();
|
||||||
terminal.context_menu = None;
|
terminal.context_menu = None;
|
||||||
terminal.active_regex_match = None;
|
terminal.active_regex_match = None;
|
||||||
terminal.needs_update = true;
|
terminal.needs_update = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
self.context_menu_popup = None;
|
self.context_menu_popup = None;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Message::Surface(a) => {
|
Message::Surface(a) => {
|
||||||
return cosmic::task::message(cosmic::Action::Cosmic(
|
return cosmic::task::message(cosmic::Action::Cosmic(
|
||||||
|
|
@ -3334,26 +3310,23 @@ impl Application for App {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_close_requested(&self, id: window::Id) -> Option<Self::Message> {
|
fn on_close_requested(&self, id: window::Id) -> Option<Self::Message> {
|
||||||
if let Some((popup_id, _, _, _, _, _)) = &self.context_menu_popup {
|
if let Some((popup_id, _, _, _, _, _)) = &self.context_menu_popup
|
||||||
if id == *popup_id {
|
&& id == *popup_id {
|
||||||
return Some(Message::ContextMenuPopupClosed(id));
|
return Some(Message::ContextMenuPopupClosed(id));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
fn view_window(&self, window_id: window::Id) -> Element<'_, Message> {
|
fn view_window(&self, window_id: window::Id) -> Element<'_, Message> {
|
||||||
if let Some((popup_id, _pane, entity, ref link, ref autosize_id, _)) =
|
if let Some((popup_id, _pane, entity, ref link, ref autosize_id, _)) =
|
||||||
self.context_menu_popup
|
self.context_menu_popup
|
||||||
{
|
&& window_id == popup_id {
|
||||||
if window_id == popup_id {
|
|
||||||
return widget::autosize::autosize(
|
return widget::autosize::autosize(
|
||||||
menu::context_menu(&self.config, &self.key_binds, entity, link.clone()),
|
menu::context_menu(&self.config, &self.key_binds, entity, link.clone()),
|
||||||
autosize_id.clone(),
|
autosize_id.clone(),
|
||||||
)
|
)
|
||||||
.into();
|
.into();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
match &self.dialog_opt {
|
match &self.dialog_opt {
|
||||||
Some(dialog) => dialog.view(window_id),
|
Some(dialog) => dialog.view(window_id),
|
||||||
None => widget::text("Unknown window ID").into(),
|
None => widget::text("Unknown window ID").into(),
|
||||||
|
|
|
||||||
|
|
@ -234,11 +234,10 @@ impl PasswordManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't do anything if nothing have changed
|
// Don't do anything if nothing have changed
|
||||||
if let Some(original) = &original {
|
if let Some(original) = &original
|
||||||
if original == &input_state.input {
|
&& original == &input_state.input {
|
||||||
return Task::none();
|
return Task::none();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
cosmic::task::future(async move {
|
cosmic::task::future(async move {
|
||||||
if let Err(err) = store::add_password(identifier.clone(), password.clone()).await {
|
if let Err(err) = store::add_password(identifier.clone(), password.clone()).await {
|
||||||
|
|
@ -246,9 +245,9 @@ impl PasswordManager {
|
||||||
"Failed to add password {identifier}: {err}"
|
"Failed to add password {identifier}: {err}"
|
||||||
)))
|
)))
|
||||||
} else {
|
} else {
|
||||||
if let Some(original) = original {
|
if let Some(original) = original
|
||||||
if original.identifier != identifier {
|
&& original.identifier != identifier
|
||||||
if let Err(err) =
|
&& let Err(err) =
|
||||||
store::delete_password(original.identifier.clone()).await
|
store::delete_password(original.identifier.clone()).await
|
||||||
{
|
{
|
||||||
return Message::PasswordManager(PasswordManagerMessage::Error(
|
return Message::PasswordManager(PasswordManagerMessage::Error(
|
||||||
|
|
@ -258,8 +257,6 @@ impl PasswordManager {
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
Message::PasswordManager(PasswordManagerMessage::None)
|
Message::PasswordManager(PasswordManagerMessage::None)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -315,8 +312,8 @@ impl PasswordManager {
|
||||||
.spacing(space_xxs),
|
.spacing(space_xxs),
|
||||||
);
|
);
|
||||||
|
|
||||||
if expanded {
|
if expanded
|
||||||
if let Some(input_state) = &self.input_state {
|
&& let Some(input_state) = &self.input_state {
|
||||||
let expanded_section: Section<'_, Message> = widget::settings::section().add(
|
let expanded_section: Section<'_, Message> = widget::settings::section().add(
|
||||||
widget::column::with_children(vec![
|
widget::column::with_children(vec![
|
||||||
widget::column::with_children(vec![
|
widget::column::with_children(vec![
|
||||||
|
|
@ -381,7 +378,6 @@ impl PasswordManager {
|
||||||
passwords_section =
|
passwords_section =
|
||||||
passwords_section.add(widget::container(expanded_section).padding(padding))
|
passwords_section.add(widget::container(expanded_section).padding(padding))
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
sections.push(passwords_section.into());
|
sections.push(passwords_section.into());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -245,12 +245,11 @@ impl ShortcutsConfig {
|
||||||
// Remove any matching bindings
|
// Remove any matching bindings
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if let Some(default_action) = self.defaults.0.get(binding) {
|
if let Some(default_action) = self.defaults.0.get(binding)
|
||||||
if *default_action == reset_action {
|
&& *default_action == reset_action {
|
||||||
// Remove binding that overrode a default
|
// Remove binding that overrode a default
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
true
|
true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -858,14 +858,12 @@ impl Terminal {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change color if selected
|
// Change color if selected
|
||||||
if let Some(selection) = &term.selection {
|
if let Some(selection) = &term.selection
|
||||||
if let Some(range) = selection.to_range(&term) {
|
&& let Some(range) = selection.to_range(&term)
|
||||||
if range.contains(indexed.point) {
|
&& range.contains(indexed.point) {
|
||||||
//TODO: better handling of selection
|
//TODO: better handling of selection
|
||||||
mem::swap(&mut fg, &mut bg);
|
mem::swap(&mut fg, &mut bg);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert foreground to linear
|
// Convert foreground to linear
|
||||||
attrs = attrs.color(fg);
|
attrs = attrs.color(fg);
|
||||||
|
|
@ -878,11 +876,10 @@ impl Terminal {
|
||||||
|
|
||||||
let mut flags = indexed.cell.flags;
|
let mut flags = indexed.cell.flags;
|
||||||
|
|
||||||
if let Some(active_match) = &self.active_regex_match {
|
if let Some(active_match) = &self.active_regex_match
|
||||||
if active_match.contains(&indexed.point) {
|
&& active_match.contains(&indexed.point) {
|
||||||
flags |= Flags::UNDERLINE;
|
flags |= Flags::UNDERLINE;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if let Some(active_id) = &self.active_hyperlink_id {
|
if let Some(active_id) = &self.active_hyperlink_id {
|
||||||
let mut matches_active = indexed
|
let mut matches_active = indexed
|
||||||
.cell
|
.cell
|
||||||
|
|
@ -1190,14 +1187,13 @@ impl<'a, T> Iterator for HintPostProcessor<'a, T> {
|
||||||
fn next(&mut self) -> Option<Self::Item> {
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
let next_match = self.next_match.take()?;
|
let next_match = self.next_match.take()?;
|
||||||
|
|
||||||
if self.start <= self.end {
|
if self.start <= self.end
|
||||||
if let Some(rm) = self
|
&& let Some(rm) = self
|
||||||
.term
|
.term
|
||||||
.regex_search_right(self.regex, self.start, self.end)
|
.regex_search_right(self.regex, self.start, self.end)
|
||||||
{
|
{
|
||||||
self.next_processed_match(rm);
|
self.next_processed_match(rm);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Some(next_match)
|
Some(next_match)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,10 +26,9 @@ use cosmic::{
|
||||||
iced::{
|
iced::{
|
||||||
Color, Element, Length, Padding, Point, Rectangle, Size, Vector,
|
Color, Element, Length, Padding, Point, Rectangle, Size, Vector,
|
||||||
advanced::graphics::text::Raw,
|
advanced::graphics::text::Raw,
|
||||||
event::{Event, Status},
|
event::Event,
|
||||||
keyboard::{Event as KeyEvent, Key, Modifiers},
|
keyboard::{Event as KeyEvent, Key, Modifiers},
|
||||||
mouse::{self, Button, Event as MouseEvent, ScrollDelta},
|
mouse::{self, Button, Event as MouseEvent, ScrollDelta},
|
||||||
window::RedrawRequest,
|
|
||||||
},
|
},
|
||||||
theme::Theme,
|
theme::Theme,
|
||||||
};
|
};
|
||||||
|
|
@ -863,8 +862,8 @@ where
|
||||||
if is_mouse_mode {
|
if is_mouse_mode {
|
||||||
state.autoscroll.stop();
|
state.autoscroll.stop();
|
||||||
} else {
|
} else {
|
||||||
if let Some((pointer, multiplier)) = state.autoscroll.next_due() {
|
if let Some((pointer, multiplier)) = state.autoscroll.next_due()
|
||||||
if update_buffer_drag(
|
&& update_buffer_drag(
|
||||||
state,
|
state,
|
||||||
&mut terminal,
|
&mut terminal,
|
||||||
buffer_size,
|
buffer_size,
|
||||||
|
|
@ -875,7 +874,6 @@ where
|
||||||
) {
|
) {
|
||||||
shell.capture_event();
|
shell.capture_event();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if state.autoscroll.is_active() {
|
if state.autoscroll.is_active() {
|
||||||
shell.request_redraw();
|
shell.request_redraw();
|
||||||
}
|
}
|
||||||
|
|
@ -1319,8 +1317,8 @@ where
|
||||||
}
|
}
|
||||||
Event::Mouse(MouseEvent::ButtonReleased(Button::Left)) => {
|
Event::Mouse(MouseEvent::ButtonReleased(Button::Left)) => {
|
||||||
state.autoscroll.stop();
|
state.autoscroll.stop();
|
||||||
if let Some(dragging) = state.dragging.take() {
|
if let Some(dragging) = state.dragging.take()
|
||||||
if let Dragging::Buffer {
|
&& let Dragging::Buffer {
|
||||||
last_point,
|
last_point,
|
||||||
last_side,
|
last_side,
|
||||||
..
|
..
|
||||||
|
|
@ -1334,7 +1332,6 @@ where
|
||||||
}
|
}
|
||||||
terminal.needs_update = true;
|
terminal.needs_update = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if let Some(p) = cursor_position.position_in(layout.bounds()) {
|
if let Some(p) = cursor_position.position_in(layout.bounds()) {
|
||||||
let x = p.x - self.padding.left;
|
let x = p.x - self.padding.left;
|
||||||
let y = p.y - self.padding.top;
|
let y = p.y - self.padding.top;
|
||||||
|
|
@ -1344,14 +1341,12 @@ where
|
||||||
|
|
||||||
let location = terminal
|
let location = terminal
|
||||||
.viewport_to_point(TermPoint::new(row as usize, TermColumn(col as usize)));
|
.viewport_to_point(TermPoint::new(row as usize, TermColumn(col as usize)));
|
||||||
if state.modifiers.control() {
|
if state.modifiers.control()
|
||||||
if let Some(on_open_hyperlink) = &self.on_open_hyperlink {
|
&& let Some(on_open_hyperlink) = &self.on_open_hyperlink
|
||||||
if let Some(hyperlink) = get_hyperlink(&terminal, location) {
|
&& let Some(hyperlink) = get_hyperlink(&terminal, location) {
|
||||||
shell.publish(on_open_hyperlink(hyperlink));
|
shell.publish(on_open_hyperlink(hyperlink));
|
||||||
shell.capture_event();
|
shell.capture_event();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if is_mouse_mode {
|
if is_mouse_mode {
|
||||||
terminal.report_mouse(
|
terminal.report_mouse(
|
||||||
|
|
@ -1655,11 +1650,10 @@ fn update_active_regex_match(
|
||||||
.find(|bounds| bounds.contains(&location))
|
.find(|bounds| bounds.contains(&location))
|
||||||
{
|
{
|
||||||
'update: {
|
'update: {
|
||||||
if let Some(active_match) = &terminal.active_regex_match {
|
if let Some(active_match) = &terminal.active_regex_match
|
||||||
if active_match == match_ {
|
&& active_match == match_ {
|
||||||
break 'update;
|
break 'update;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
terminal.active_regex_match = Some(match_.clone());
|
terminal.active_regex_match = Some(match_.clone());
|
||||||
terminal.needs_update = true;
|
terminal.needs_update = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue