Compare commits

...

2 Commits

3 changed files with 9 additions and 2 deletions

View File

@ -34,7 +34,7 @@
//! assert_eq!(timestamp, 1578509043);
//!
//! // Convert timestamp back to string
//! let s = timestamp_to_string(timestamp, Some("%Y-%m-%d"));
//! let s = timestamp_to_string(timestamp, Some("%Y-%m-%d"), true);
//! assert_eq!(s, "2020-01-08");
//! ```
use crate::error::{Result, ResultIntoMeliError};

View File

@ -393,6 +393,7 @@ impl Component for SVGScreenshotFilter {
let mut filename = melib::datetime::timestamp_to_string(
melib::datetime::now(),
Some("meli Screenshot - %e %h %Y %H:%M:%S.svg"),
true,
);
while std::path::Path::new(&filename).exists() {
filename.pop();

View File

@ -1305,7 +1305,9 @@ impl Component for Tabbed {
}
UIEvent::Input(Key::Alt(no)) if *no >= '1' && *no <= '9' => {
let no = *no as usize - '1' as usize;
if no < self.children.len() {
if no < self.children.len() && self.cursor_pos != no % self.children.len() {
self.children[self.cursor_pos]
.process_event(&mut UIEvent::VisibilityChange(false), context);
self.cursor_pos = no % self.children.len();
let mut children_maps = self.children[self.cursor_pos].get_shortcuts(context);
children_maps.extend(self.get_shortcuts(context));
@ -1320,6 +1322,8 @@ impl Component for Tabbed {
return true;
}
UIEvent::Input(ref key) if shortcut!(key == shortcuts["general"]["next_tab"]) => {
self.children[self.cursor_pos]
.process_event(&mut UIEvent::VisibilityChange(false), context);
self.cursor_pos = (self.cursor_pos + 1) % self.children.len();
let mut children_maps = self.children[self.cursor_pos].get_shortcuts(context);
children_maps.extend(self.get_shortcuts(context));
@ -1348,6 +1352,8 @@ impl Component for Tabbed {
}
UIEvent::Action(Tab(New(ref mut e))) if e.is_some() => {
self.add_component(e.take().unwrap());
self.children[self.cursor_pos]
.process_event(&mut UIEvent::VisibilityChange(false), context);
self.cursor_pos = self.children.len() - 1;
self.children[self.cursor_pos].set_dirty(true);
let mut children_maps = self.children[self.cursor_pos].get_shortcuts(context);