ui: move list_management mod to melib

list_management module includes some small functions to handle mailing
list metadata (List-* headers)
jmap
Manos Pitsidianakis 2019-11-18 20:37:48 +02:00
parent 449a24d075
commit 51628ac9d2
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
5 changed files with 24 additions and 11 deletions

View File

@ -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;

View File

@ -18,9 +18,9 @@
* You should have received a copy of the GNU General Public License
* along with meli. If not, see <http://www.gnu.org/licenses/>.
*/
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)]

View File

@ -20,6 +20,7 @@
*/
use super::*;
use melib::list_management;
use crate::terminal::embed::EmbedGrid;
use melib::Draft;

View File

@ -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)]

View File

@ -646,10 +646,7 @@ impl EmbedGrid {
let offset = unsafe { std::str::from_utf8_unchecked(buf) }
.parse::<usize>()
.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::<usize>()
.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,