fix (ui): fixed rooms scroll out of bounds error and added more detail to 'not supported message like event' view in timeline

This commit is contained in:
antifallobst 2023-07-09 22:05:48 +02:00
parent 3920a3e600
commit 1fa35adae7
No known key found for this signature in database
2 changed files with 12 additions and 9 deletions

View File

@ -156,11 +156,11 @@ impl Event {
..
} => {
let i = match app.ui.rooms_state.selected() {
Some(i) => {
if i > 0 {
i - 1
Some(cur) => {
if cur > 0 {
cur - 1
} else {
i
cur
}
}
None => 0,
@ -173,11 +173,11 @@ impl Event {
..
} => {
let i = match app.ui.rooms_state.selected() {
Some(i) => {
if i < app.status.rooms().len() {
i + 1
Some(cur) => {
if cur < app.status.rooms().len() - 1 {
cur + 1
} else {
i
cur
}
}
None => 0,

View File

@ -338,7 +338,10 @@ impl UI<'_> {
(message_content.to_string(), Color::White)
}
_ => (
"~~~ not supported message like event ~~~".to_string(),
format!(
"~~~ not supported message like event: {} ~~~",
message_like_event.event_type().to_string()
),
Color::Red,
),
};