message-text: Don't use GtkBox for HTML is there is a single block
Seems to fix Gtk-CRITICALS for ContentMessageContent
This commit is contained in:
parent
9d59cbac8d
commit
c495d381c4
1 changed files with 14 additions and 9 deletions
|
@ -212,13 +212,17 @@ impl MessageText {
|
|||
}
|
||||
|
||||
fn build_html(&self, blocks: Vec<HtmlBlock>, room: &Room) {
|
||||
let ellipsize = self.format() == ContentFormat::Ellipsized;
|
||||
|
||||
if blocks.len() == 1 {
|
||||
let widget = create_widget_for_html_block(&blocks[0], room, ellipsize, false);
|
||||
self.set_child(Some(&widget));
|
||||
} else {
|
||||
let child = gtk::Box::new(gtk::Orientation::Vertical, 6);
|
||||
self.set_child(Some(&child));
|
||||
|
||||
let ellipsize = self.format() == ContentFormat::Ellipsized;
|
||||
let len = blocks.len();
|
||||
for block in blocks {
|
||||
let widget = create_widget_for_html_block(&block, room, ellipsize, len > 1);
|
||||
let widget = create_widget_for_html_block(&block, room, ellipsize, true);
|
||||
child.append(&widget);
|
||||
|
||||
if ellipsize {
|
||||
|
@ -226,6 +230,7 @@ impl MessageText {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The original text of the message that is displayed.
|
||||
pub fn original_text(&self) -> String {
|
||||
|
|
Loading…
Reference in a new issue