columns: clean up flags, refactor content rendering
Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
@@ -43,9 +43,9 @@ impl From<ShowSourceClientOption> for String {
|
||||
|
||||
impl From<NoteOptions> for ShowSourceClientOption {
|
||||
fn from(note_options: NoteOptions) -> Self {
|
||||
if note_options.contains(NoteOptions::ShowNoteClientTop) {
|
||||
if note_options.contains(NoteOptions::ClientNameTop) {
|
||||
ShowSourceClientOption::Top
|
||||
} else if note_options.contains(NoteOptions::ShowNoteClientBottom) {
|
||||
} else if note_options.contains(NoteOptions::ClientNameBottom) {
|
||||
ShowSourceClientOption::Bottom
|
||||
} else {
|
||||
ShowSourceClientOption::Hide
|
||||
@@ -68,16 +68,16 @@ impl ShowSourceClientOption {
|
||||
pub fn set_note_options(self, note_options: &mut NoteOptions) {
|
||||
match self {
|
||||
Self::Hide => {
|
||||
note_options.set(NoteOptions::ShowNoteClientTop, false);
|
||||
note_options.set(NoteOptions::ShowNoteClientBottom, false);
|
||||
note_options.set(NoteOptions::ClientNameTop, false);
|
||||
note_options.set(NoteOptions::ClientNameBottom, false);
|
||||
}
|
||||
Self::Bottom => {
|
||||
note_options.set(NoteOptions::ShowNoteClientTop, false);
|
||||
note_options.set(NoteOptions::ShowNoteClientBottom, true);
|
||||
note_options.set(NoteOptions::ClientNameTop, false);
|
||||
note_options.set(NoteOptions::ClientNameBottom, true);
|
||||
}
|
||||
Self::Top => {
|
||||
note_options.set(NoteOptions::ShowNoteClientTop, true);
|
||||
note_options.set(NoteOptions::ShowNoteClientBottom, false);
|
||||
note_options.set(NoteOptions::ClientNameTop, true);
|
||||
note_options.set(NoteOptions::ClientNameBottom, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,12 +292,12 @@ struct ThreadNote<'a> {
|
||||
|
||||
impl<'a> ThreadNote<'a> {
|
||||
fn options(&self, mut cur_options: NoteOptions) -> NoteOptions {
|
||||
cur_options.set(NoteOptions::ShowCreatedAtBottom, true);
|
||||
match self.note_type {
|
||||
ThreadNoteType::Chain { root: _ } => cur_options,
|
||||
ThreadNoteType::Selected { root: _ } => {
|
||||
cur_options.set(NoteOptions::Wide, true);
|
||||
cur_options.set(NoteOptions::SelectableText, true);
|
||||
cur_options.set(NoteOptions::FullCreatedDate, true);
|
||||
cur_options
|
||||
}
|
||||
ThreadNoteType::Reply => cur_options,
|
||||
|
||||
Reference in New Issue
Block a user