Browse Source

ui: move list_management mod to melib

list_management module includes some small functions to handle mailing
list metadata (List-* headers)
jmap
Manos Pitsidianakis 2 years ago
parent
commit
51628ac9d2
Signed by: epilys GPG Key ID: 73627C2F690DF710
  1. 1
      melib/src/email.rs
  2. 6
      melib/src/email/list_management.rs
  3. 1
      ui/src/components/mail/compose.rs
  4. 5
      ui/src/components/mail/view.rs
  5. 22
      ui/src/terminal/embed/grid.rs

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

6
ui/src/components/mail/view/list_management.rs → 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 <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)]

1
ui/src/components/mail/compose.rs

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

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

22
ui/src/terminal/embed/grid.rs

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

Loading…
Cancel
Save