Commit eebb5b5d authored by Kai Hiller's avatar Kai Hiller Committed by Alejandro Domínguez
Browse files

Fix message replacement and removal in room_history

parent c581b614
...@@ -81,8 +81,8 @@ impl List { ...@@ -81,8 +81,8 @@ impl List {
/// ### Panics /// ### Panics
/// Panics if `index >= len`. /// Panics if `index >= len`.
fn remove_item(&mut self, index: usize) { fn remove_item(&mut self, index: usize) {
self.list.remove(index); self.view.remove(index);
self.view.remove(self.list.len() - index - 1); self.list.remove(self.list.len() - index - 1);
} }
/// Replaces the element at the given position in the history. /// Replaces the element at the given position in the history.
...@@ -90,10 +90,10 @@ impl List { ...@@ -90,10 +90,10 @@ impl List {
/// ### Panics /// ### Panics
/// Panics if `index >= len`. /// Panics if `index >= len`.
fn replace_item(&mut self, index: usize, element: Element) { fn replace_item(&mut self, index: usize, element: Element) {
self.view.remove(self.list.len() - index - 1); self.view.remove(index);
self.view self.view.insert(index, element.get_listbox_row());
.insert(self.list.len() - index - 1, element.get_listbox_row()); let i_rev = self.list.len() - index - 1;
self.list[index] = element; self.list[i_rev] = element;
} }
fn create_new_message_divider(rows: Rc<RefCell<Self>>) -> widgets::NewMessageDivider { fn create_new_message_divider(rows: Rc<RefCell<Self>>) -> widgets::NewMessageDivider {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment