From a0d42ec0f4f57ccb0a68cae2bf8d4fa8e26aa962 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Mon, 26 Apr 2021 22:18:53 +0200 Subject: take list of threads instead --- src/main.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/main.rs b/src/main.rs index 2f1f5cc..e4d4a4b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,5 @@ use std::io::{Write, stdin, stdout}; +use notmuch::Thread; use termion::color; use termion::event::Key; use termion::input::TermRead; @@ -17,12 +18,7 @@ fn main() { // get threads let query = db.create_query("tag:inbox").unwrap(); - let threads = query.search_threads().unwrap(); - let threads = threads - .map(|t| format!("thread {:?}, {:?}", - t.subject(), - t.authors())) - .collect(); + let threads = query.search_threads().unwrap().collect(); let mut i: isize = 0; show_threads(&mut screen, &threads, i as usize); @@ -39,7 +35,7 @@ fn main() { } } -fn show_threads(stdout: &mut W, threads: &Vec, highlight: usize) { +fn show_threads(stdout: &mut W, threads: &Vec, highlight: usize) { write!(stdout, "{}", termion::clear::All).unwrap(); for (i, thread) in threads.iter().enumerate() { @@ -48,7 +44,7 @@ fn show_threads(stdout: &mut W, threads: &Vec, highlight: usiz if highlight { write!(stdout, "{}", color::Fg(color::Red)).unwrap(); } - write!(stdout, "{}", thread).unwrap(); + write!(stdout, "thread {:?}, {:?}", thread.subject(), thread.authors()).unwrap(); if highlight { write!(stdout, "{}", color::Fg(color::Reset)).unwrap(); } -- cgit v1.2.1