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