Commit 5aa061a1 authored by Julian Sparber's avatar Julian Sparber
Browse files

Revert "Fix message replacement and removal in room_history"

This commit breaks edited messages. It looks like it doesn't replace the
correct message after the changes in this commit.
This reverts commit eebb5b5d.
parent fbf2027d
Pipeline #254941 passed with stages
in 44 minutes and 7 seconds
...@@ -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.view.remove(index); self.list.remove(index);
self.list.remove(self.list.len() - index - 1); self.view.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(index); self.view.remove(self.list.len() - index - 1);
self.view.insert(index, element.get_listbox_row()); self.view
let i_rev = self.list.len() - index - 1; .insert(self.list.len() - index - 1, element.get_listbox_row());
self.list[i_rev] = element; self.list[index] = 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