Commit 9558acf540
Unregistered key
Layout: unified · split
src/message/mod.rs +6 −5
| @@ -1253,11 +1253,11 @@ impl Message { | ||
| 1253 | 1253 | /// Render the message as a [Text] object for the terminal. |
| 1254 | 1254 | /// |
| 1255 | 1255 | /// This will also get the image preview Protocol with an x/y offset. |
| 1256 | pub fn show_with_preview<'a>( | |
| 1256 | pub fn show_with_preview<'a, C>( | |
| 1257 | 1257 | &'a self, |
| 1258 | 1258 | prev: Option<&Message>, |
| 1259 | 1259 | selected: bool, |
| 1260 | vwctx: &ViewportContext<MessageCursor>, | |
| 1260 | vwctx: &ViewportContext<C>, | |
| 1261 | 1261 | info: &'a RoomInfo, |
| 1262 | 1262 | settings: &'a ApplicationSettings, |
| 1263 | 1263 | previews: &'a PreviewManager, |
| @@ -1347,11 +1347,11 @@ impl Message { | ||
| 1347 | 1347 | (text, protos) |
| 1348 | 1348 | } |
| 1349 | 1349 | |
| 1350 | pub fn show<'a>( | |
| 1350 | pub fn show<'a, C>( | |
| 1351 | 1351 | &'a self, |
| 1352 | 1352 | prev: Option<&Message>, |
| 1353 | 1353 | selected: bool, |
| 1354 | vwctx: &ViewportContext<MessageCursor>, | |
| 1354 | vwctx: &ViewportContext<C>, | |
| 1355 | 1355 | info: &'a RoomInfo, |
| 1356 | 1356 | settings: &'a ApplicationSettings, |
| 1357 | 1357 | previews: &'a PreviewManager, |
| @@ -1974,7 +1974,8 @@ pub mod tests { | ||
| 1974 | 1974 | let settings = mock_settings(); |
| 1975 | 1975 | let previews = PreviewManager::new(&settings); |
| 1976 | 1976 | let mut info = mock_room(); |
| 1977 | let vwctx = ViewportContext { dimensions: (60, 5), ..Default::default() }; | |
| 1977 | let vwctx: ViewportContext<MessageCursor> = | |
| 1978 | ViewportContext { dimensions: (60, 5), ..Default::default() }; | |
| 1978 | 1979 | |
| 1979 | 1980 | let prev = mock_message1(); |
| 1980 | 1981 | let msg = mock_message2(); |
src/windows/mod.rs +3 −7
| @@ -1786,7 +1786,7 @@ impl ListItem<IambInfo> for PinnedItem { | ||
| 1786 | 1786 | fn show<'a>( |
| 1787 | 1787 | &'a self, |
| 1788 | 1788 | selected: bool, |
| 1789 | _: &ViewportContext<ListCursor>, | |
| 1789 | vwctx: &ViewportContext<ListCursor>, | |
| 1790 | 1790 | store: &'a ProgramStore, |
| 1791 | 1791 | ) -> Text<'a> { |
| 1792 | 1792 | let settings = &store.application.settings; |
| @@ -1811,12 +1811,8 @@ impl ListItem<IambInfo> for PinnedItem { | ||
| 1811 | 1811 | return Span::styled(text, style.fg(Color::Gray)).into(); |
| 1812 | 1812 | }; |
| 1813 | 1813 | |
| 1814 | let sender = settings.get_user_span(&msg.sender, info); | |
| 1815 | let sender = Span::styled(sender.content.into_owned(), sender.style.patch(style)); | |
| 1816 | let time = format!(" [{}]: ", msg.timestamp.show_datetime()); | |
| 1817 | let body = msg.event.body().lines().next().unwrap_or_default().to_string(); | |
| 1818 | ||
| 1819 | Line::from(vec![sender, Span::styled(time, style), Span::styled(body, style)]).into() | |
| 1814 | let previews = &store.application.previews; | |
| 1815 | msg.show(None, selected, vwctx, info, settings, previews) | |
| 1820 | 1816 | } |
| 1821 | 1817 | |
| 1822 | 1818 | fn get_word(&self) -> Option<String> { |