ui: move list_management mod to melib
list_management module includes some small functions to handle mailing list metadata (List-* headers)jmap
parent
449a24d075
commit
51628ac9d2
|
@ -26,6 +26,7 @@ use fnv::FnvHashMap;
|
||||||
mod compose;
|
mod compose;
|
||||||
pub use self::compose::*;
|
pub use self::compose::*;
|
||||||
|
|
||||||
|
pub mod list_management;
|
||||||
mod mailto;
|
mod mailto;
|
||||||
pub use mailto::*;
|
pub use mailto::*;
|
||||||
mod attachment_types;
|
mod attachment_types;
|
||||||
|
|
|
@ -18,9 +18,9 @@
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with meli. If not, see <http://www.gnu.org/licenses/>.
|
* along with meli. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
use melib::parser;
|
use super::parser;
|
||||||
use melib::Envelope;
|
use super::Envelope;
|
||||||
use melib::StackVec;
|
use crate::StackVec;
|
||||||
use std::convert::From;
|
use std::convert::From;
|
||||||
|
|
||||||
#[derive(Debug, Copy)]
|
#[derive(Debug, Copy)]
|
|
@ -20,6 +20,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
use melib::list_management;
|
||||||
|
|
||||||
use crate::terminal::embed::EmbedGrid;
|
use crate::terminal::embed::EmbedGrid;
|
||||||
use melib::Draft;
|
use melib::Draft;
|
||||||
|
|
|
@ -20,13 +20,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use linkify::{Link, LinkFinder};
|
use melib::list_management;
|
||||||
|
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
use std::process::{Command, Stdio};
|
use std::process::{Command, Stdio};
|
||||||
|
|
||||||
pub mod list_management;
|
|
||||||
|
|
||||||
mod html;
|
mod html;
|
||||||
pub use self::html::*;
|
pub use self::html::*;
|
||||||
mod thread;
|
mod thread;
|
||||||
|
@ -35,6 +33,7 @@ pub use self::thread::*;
|
||||||
mod envelope;
|
mod envelope;
|
||||||
pub use self::envelope::*;
|
pub use self::envelope::*;
|
||||||
|
|
||||||
|
use linkify::{Link, LinkFinder};
|
||||||
use mime_apps::query_default_app;
|
use mime_apps::query_default_app;
|
||||||
|
|
||||||
#[derive(PartialEq, Debug, Clone)]
|
#[derive(PartialEq, Debug, Clone)]
|
||||||
|
|
|
@ -646,10 +646,7 @@ impl EmbedGrid {
|
||||||
let offset = unsafe { std::str::from_utf8_unchecked(buf) }
|
let offset = unsafe { std::str::from_utf8_unchecked(buf) }
|
||||||
.parse::<usize>()
|
.parse::<usize>()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
debug!("cursor backward {} times, cursor was: {:?}", offset, cursor);
|
cursor.0 = cursor.0.saturating_sub(offset);
|
||||||
if offset + cursor.0 < terminal_size.0 {
|
|
||||||
cursor.0 += offset;
|
|
||||||
}
|
|
||||||
debug!("cursor became: {:?}", cursor);
|
debug!("cursor became: {:?}", cursor);
|
||||||
*state = State::Normal;
|
*state = State::Normal;
|
||||||
}
|
}
|
||||||
|
@ -668,6 +665,21 @@ impl EmbedGrid {
|
||||||
if scroll_region.top + cursor.1 >= terminal_size.1 {
|
if scroll_region.top + cursor.1 >= terminal_size.1 {
|
||||||
cursor.1 = terminal_size.1.saturating_sub(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);
|
debug!("cursor became: {:?}", cursor);
|
||||||
*state = State::Normal;
|
*state = State::Normal;
|
||||||
}
|
}
|
||||||
|
@ -755,7 +767,7 @@ impl EmbedGrid {
|
||||||
b"37" => *fg_color = Color::White,
|
b"37" => *fg_color = Color::White,
|
||||||
|
|
||||||
b"39" => *fg_color = Color::Default,
|
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"41" => *bg_color = Color::Red,
|
||||||
b"42" => *bg_color = Color::Green,
|
b"42" => *bg_color = Color::Green,
|
||||||
b"43" => *bg_color = Color::Yellow,
|
b"43" => *bg_color = Color::Yellow,
|
||||||
|
|
Loading…
Reference in New Issue