diff --git a/melib/src/email.rs b/melib/src/email.rs
index 494ba4e7..d84bf2cc 100644
--- a/melib/src/email.rs
+++ b/melib/src/email.rs
@@ -26,6 +26,7 @@ use fnv::FnvHashMap;
mod compose;
pub use self::compose::*;
+pub mod list_management;
mod mailto;
pub use mailto::*;
mod attachment_types;
diff --git a/ui/src/components/mail/view/list_management.rs b/melib/src/email/list_management.rs
similarity index 98%
rename from ui/src/components/mail/view/list_management.rs
rename to melib/src/email/list_management.rs
index 9d525cf1..c4744367 100644
--- a/ui/src/components/mail/view/list_management.rs
+++ b/melib/src/email/list_management.rs
@@ -18,9 +18,9 @@
* You should have received a copy of the GNU General Public License
* along with meli. If not, see .
*/
-use melib::parser;
-use melib::Envelope;
-use melib::StackVec;
+use super::parser;
+use super::Envelope;
+use crate::StackVec;
use std::convert::From;
#[derive(Debug, Copy)]
diff --git a/ui/src/components/mail/compose.rs b/ui/src/components/mail/compose.rs
index 367d449d..b88d827c 100644
--- a/ui/src/components/mail/compose.rs
+++ b/ui/src/components/mail/compose.rs
@@ -20,6 +20,7 @@
*/
use super::*;
+use melib::list_management;
use crate::terminal::embed::EmbedGrid;
use melib::Draft;
diff --git a/ui/src/components/mail/view.rs b/ui/src/components/mail/view.rs
index 8ea7bca9..11c1019e 100644
--- a/ui/src/components/mail/view.rs
+++ b/ui/src/components/mail/view.rs
@@ -20,13 +20,11 @@
*/
use super::*;
-use linkify::{Link, LinkFinder};
+use melib::list_management;
use std::convert::TryFrom;
use std::process::{Command, Stdio};
-pub mod list_management;
-
mod html;
pub use self::html::*;
mod thread;
@@ -35,6 +33,7 @@ pub use self::thread::*;
mod envelope;
pub use self::envelope::*;
+use linkify::{Link, LinkFinder};
use mime_apps::query_default_app;
#[derive(PartialEq, Debug, Clone)]
diff --git a/ui/src/terminal/embed/grid.rs b/ui/src/terminal/embed/grid.rs
index 2766175b..c4d4097c 100644
--- a/ui/src/terminal/embed/grid.rs
+++ b/ui/src/terminal/embed/grid.rs
@@ -646,10 +646,7 @@ impl EmbedGrid {
let offset = unsafe { std::str::from_utf8_unchecked(buf) }
.parse::()
.unwrap();
- debug!("cursor backward {} times, cursor was: {:?}", offset, cursor);
- if offset + cursor.0 < terminal_size.0 {
- cursor.0 += offset;
- }
+ cursor.0 = cursor.0.saturating_sub(offset);
debug!("cursor became: {:?}", cursor);
*state = State::Normal;
}
@@ -668,6 +665,21 @@ impl EmbedGrid {
if scroll_region.top + cursor.1 >= terminal_size.1 {
cursor.1 = terminal_size.1.saturating_sub(1);
}
+ cursor.0 = 0;
+ debug!("cursor became: {:?}", cursor);
+ *state = State::Normal;
+ }
+ (b'F', State::Csi1(buf)) => {
+ // ESC[{buf}F CSI Cursor Previous Line {buf} Times
+ let offset = unsafe { std::str::from_utf8_unchecked(buf) }
+ .parse::()
+ .unwrap();
+ debug!(
+ "cursor next line {} times, cursor was: {:?}",
+ offset, cursor
+ );
+ cursor.1 = cursor.1.saturating_sub(offset);
+ cursor.0 = 0;
debug!("cursor became: {:?}", cursor);
*state = State::Normal;
}
@@ -755,7 +767,7 @@ impl EmbedGrid {
b"37" => *fg_color = Color::White,
b"39" => *fg_color = Color::Default,
- b"40" => *fg_color = Color::Black,
+ b"40" => *bg_color = Color::Black,
b"41" => *bg_color = Color::Red,
b"42" => *bg_color = Color::Green,
b"43" => *bg_color = Color::Yellow,