Commit 31c6f9bf53
Unregistered key
Layout: unified · split
src/windows/mod.rs +23
| @@ -1026,6 +1026,11 @@ impl ListItem<IambInfo> for GenericRoomItem { | ||
| 1026 | 1026 | append_tags(labels, &mut spans, style); |
| 1027 | 1027 | Text::from(Line::from(spans)) |
| 1028 | 1028 | } |
| 1029 | ||
| 1030 | fn get_word(&self) -> Option<String> { | |
| 1031 | // Return the room identifier so that `gf`/`<C-W>gf`/etc. go to the room: | |
| 1032 | self.room_id().to_string().into() | |
| 1033 | } | |
| 1029 | 1034 | } |
| 1030 | 1035 | |
| 1031 | 1036 | impl Promptable<ProgramContext, ProgramStore, IambInfo> for GenericRoomItem { |
| @@ -1233,6 +1238,24 @@ mod tests { | ||
| 1233 | 1238 | } |
| 1234 | 1239 | } |
| 1235 | 1240 | |
| 1241 | #[test] | |
| 1242 | fn test_list_item_points_to_room() { | |
| 1243 | let server = server_name!("example.com"); | |
| 1244 | let room_id = RoomId::new_v1(server).to_owned(); | |
| 1245 | let item = GenericRoomItem { | |
| 1246 | room_id: room_id.clone(), | |
| 1247 | name: "Watercooler Discussion".into(), | |
| 1248 | alias: Some(room_alias_id!("#room1:example.com").to_owned()), | |
| 1249 | tags: None, | |
| 1250 | membership: MatrixRoomState::Joined, | |
| 1251 | unread: UnreadInfo::default(), | |
| 1252 | room_type: RoomType::Room, | |
| 1253 | }; | |
| 1254 | ||
| 1255 | // This should return the room ID, and not the alias or name: | |
| 1256 | assert_eq!(item.get_word(), Some(room_id.to_string())); | |
| 1257 | } | |
| 1258 | ||
| 1236 | 1259 | #[test] |
| 1237 | 1260 | fn test_sort_rooms() { |
| 1238 | 1261 | let mut collator = Collator::default(); |