notedeck

One damus client to rule them all
git clone git://jb55.com/notedeck
Log | Files | Refs | README | LICENSE

commit c402320ad334be481e859b2dd96236aadad351b9
parent b5d56f7831d1e1586449336ba0d59df9c7fa9b0b
Author: William Casarin <jb55@jb55.com>
Date:   Mon, 14 Jul 2025 14:04:49 -0700

ui: fix broken note previews

Also made the options more clear

Fixes: https://github.com/damus-io/notedeck/issues/959
Fixes: b6348b150724 ("note/options: simplify flag logic")
Signed-off-by: William Casarin <jb55@jb55.com>

Diffstat:
Mcrates/notedeck_ui/src/note/contents.rs | 6+++---
Mcrates/notedeck_ui/src/note/mod.rs | 6+++---
Mcrates/notedeck_ui/src/note/options.rs | 6+++---
3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/crates/notedeck_ui/src/note/contents.rs b/crates/notedeck_ui/src/note/contents.rs @@ -133,7 +133,7 @@ pub fn render_note_contents( let mut current_len: usize = 0; let truncate_len = 280; - if !options.has(NoteOptions::Preview) { + if !options.has(NoteOptions::HasNotePreviews) { // need this for the rect to take the full width of the column let _ = ui.allocate_at_least(egui::vec2(ui.available_width(), 0.0), egui::Sense::click()); } @@ -183,11 +183,11 @@ pub fn render_note_contents( } } - Mention::Note(note) if options.has(NoteOptions::Preview) => { + Mention::Note(note) if options.has(NoteOptions::HasNotePreviews) => { inline_note = Some((note.id(), block.as_str())); } - Mention::Event(note) if options.has(NoteOptions::Preview) => { + Mention::Event(note) if options.has(NoteOptions::HasNotePreviews) => { inline_note = Some((note.id(), block.as_str())); } diff --git a/crates/notedeck_ui/src/note/mod.rs b/crates/notedeck_ui/src/note/mod.rs @@ -91,7 +91,7 @@ impl<'a, 'd> NoteView<'a, 'd> { jobs: &'a mut JobsCache, ) -> Self { flags.set(NoteOptions::ActionBar, true); - flags.set(NoteOptions::NotePreviews, true); + flags.set(NoteOptions::HasNotePreviews, true); let framed = false; let parent: Option<NoteKey> = None; @@ -154,7 +154,7 @@ impl<'a, 'd> NoteView<'a, 'd> { } pub fn note_previews(mut self, enable: bool) -> Self { - self.options_mut().set(NoteOptions::NotePreviews, enable); + self.options_mut().set(NoteOptions::HasNotePreviews, enable); self } @@ -187,7 +187,7 @@ impl<'a, 'd> NoteView<'a, 'd> { } pub fn is_preview(mut self, is_preview: bool) -> Self { - self.options_mut().set(NoteOptions::Preview, is_preview); + self.options_mut().set(NoteOptions::IsPreview, is_preview); self } diff --git a/crates/notedeck_ui/src/note/options.rs b/crates/notedeck_ui/src/note/options.rs @@ -7,7 +7,7 @@ bitflags! { #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub struct NoteOptions: u64 { const ActionBar = 1 << 0; - const NotePreviews = 1 << 1; + const HasNotePreviews = 1 << 1; const SmallPfp = 1 << 2; const MediumPfp = 1 << 3; const Wide = 1 << 4; @@ -18,7 +18,7 @@ bitflags! { /// Scramble text so that its not distracting during development const ScrambleText = 1 << 9; /// Is this a note preview? - const Preview = 1 << 10; + const IsPreview = 1 << 10; /// Is the content truncated? If the length is over a certain size it /// will end with a ... and a "Show more" button. const Truncate = 1 << 11; @@ -28,7 +28,7 @@ bitflags! { impl Default for NoteOptions { fn default() -> NoteOptions { NoteOptions::OptionsButton - | NoteOptions::NotePreviews + | NoteOptions::HasNotePreviews | NoteOptions::ActionBar | NoteOptions::Truncate }