ThreadListing: don't print previous link on root envelopes
If a thread root is missing (i.e. we never received that message or it was deleted) threads rendered like this: ├─>Re: original subject ├─>Re: original subject └─>Re: original subject This causes visual ambiguity if the parentless thread follows another: Another thread └─>Re: Another thread ├─>Re: original subject ├─>Re: original subject └─>Re: original subject This commit removes the "previous link" from every first message in a group: ┬─>Re: original subject ├─>Re: original subject └─>Re: original subjectmaster
parent
08d8c05a67
commit
b4dadf20b6
|
@ -194,6 +194,7 @@ impl MailListingTrait for ThreadListing {
|
||||||
let thread_nodes: &HashMap<ThreadNodeHash, ThreadNode> = &threads.thread_nodes();
|
let thread_nodes: &HashMap<ThreadNodeHash, ThreadNode> = &threads.thread_nodes();
|
||||||
/* This is just a desugared for loop so that we can use .peek() */
|
/* This is just a desugared for loop so that we can use .peek() */
|
||||||
let mut idx = 0;
|
let mut idx = 0;
|
||||||
|
let mut prev_group = ThreadHash::null();
|
||||||
while let Some((indentation, thread_node_hash, has_sibling)) = iter.next() {
|
while let Some((indentation, thread_node_hash, has_sibling)) = iter.next() {
|
||||||
let thread_node = &thread_nodes[&thread_node_hash];
|
let thread_node = &thread_nodes[&thread_node_hash];
|
||||||
|
|
||||||
|
@ -216,6 +217,8 @@ impl MailListingTrait for ThreadListing {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
let is_root = threads.find_group(thread_node.group) != prev_group;
|
||||||
|
prev_group = threads.find_group(thread_node.group);
|
||||||
|
|
||||||
let mut entry_strings = self.make_entry_string(&envelope, context);
|
let mut entry_strings = self.make_entry_string(&envelope, context);
|
||||||
entry_strings.subject = SubjectString(ThreadListing::make_thread_entry(
|
entry_strings.subject = SubjectString(ThreadListing::make_thread_entry(
|
||||||
|
@ -226,6 +229,7 @@ impl MailListingTrait for ThreadListing {
|
||||||
threads,
|
threads,
|
||||||
&indentations,
|
&indentations,
|
||||||
has_sibling,
|
has_sibling,
|
||||||
|
is_root,
|
||||||
));
|
));
|
||||||
row_widths.1.push(
|
row_widths.1.push(
|
||||||
entry_strings
|
entry_strings
|
||||||
|
@ -539,12 +543,7 @@ impl ListingTrait for ThreadListing {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for c in &self.data_columns.columns {
|
|
||||||
debug!(c.size());
|
|
||||||
}
|
|
||||||
debug!(top_idx);
|
|
||||||
for r in 0..cmp::min(self.length - top_idx, rows) {
|
for r in 0..cmp::min(self.length - top_idx, rows) {
|
||||||
debug!(r);
|
|
||||||
let (fg_color, bg_color) = {
|
let (fg_color, bg_color) = {
|
||||||
let c = &self.data_columns.columns[0][(0, r + top_idx)];
|
let c = &self.data_columns.columns[0][(0, r + top_idx)];
|
||||||
/*
|
/*
|
||||||
|
@ -724,10 +723,10 @@ impl ThreadListing {
|
||||||
threads: &Threads,
|
threads: &Threads,
|
||||||
indentations: &[bool],
|
indentations: &[bool],
|
||||||
has_sibling: bool,
|
has_sibling: bool,
|
||||||
//op: Box<BackendOp>,
|
is_root: bool,
|
||||||
) -> String {
|
) -> String {
|
||||||
let thread_node = &threads[&node_idx];
|
let thread_node = &threads[&node_idx];
|
||||||
let has_parent = thread_node.has_parent();
|
let has_parent = thread_node.has_parent() && !is_root;
|
||||||
let show_subject = thread_node.show_subject();
|
let show_subject = thread_node.show_subject();
|
||||||
|
|
||||||
let mut s = String::new(); //format!("{}{}{} ", idx, " ", ThreadListing::format_date(&envelope));
|
let mut s = String::new(); //format!("{}{}{} ", idx, " ", ThreadListing::format_date(&envelope));
|
||||||
|
@ -840,10 +839,10 @@ impl ThreadListing {
|
||||||
}
|
}
|
||||||
debug_assert!(end >= start);
|
debug_assert!(end >= start);
|
||||||
if self.rows_drawn.get_max(start, end) == 0 {
|
if self.rows_drawn.get_max(start, end) == 0 {
|
||||||
debug!("not drawing {}-{}", start, end);
|
//debug!("not drawing {}-{}", start, end);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
debug!("drawing {}-{}", start, end);
|
//debug!("drawing {}-{}", start, end);
|
||||||
for i in start..=end {
|
for i in start..=end {
|
||||||
self.rows_drawn.update(i, 0);
|
self.rows_drawn.update(i, 0);
|
||||||
}
|
}
|
||||||
|
@ -859,7 +858,6 @@ impl ThreadListing {
|
||||||
for ((idx, is_seen, has_attachments, env_hash), strings) in
|
for ((idx, is_seen, has_attachments, env_hash), strings) in
|
||||||
self.rows.iter().skip(start).take(end - start + 1)
|
self.rows.iter().skip(start).take(end - start + 1)
|
||||||
{
|
{
|
||||||
debug!("drawing {} {:?}", idx, strings);
|
|
||||||
let idx = *idx;
|
let idx = *idx;
|
||||||
if !context.accounts[self.cursor_pos.0].contains_key(*env_hash) {
|
if !context.accounts[self.cursor_pos.0].contains_key(*env_hash) {
|
||||||
//debug!("key = {}", root_env_hash);
|
//debug!("key = {}", root_env_hash);
|
||||||
|
|
Loading…
Reference in New Issue