Commit 7d66421863
Unregistered key
Layout: unified · split
Cargo.lock +4 −4
| @@ -3841,9 +3841,9 @@ dependencies = [ | ||
| 3841 | 3841 | |
| 3842 | 3842 | [[package]] |
| 3843 | 3843 | name = "modalkit" |
| 3844 | version = "0.0.27" | |
| 3844 | version = "0.0.28" | |
| 3845 | 3845 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 3846 | checksum = "de93aca188fc0e518c7c89782c3cb62ae4e14552398f2baaed9c5168b3ca1b3d" | |
| 3846 | checksum = "b8a62517886d7f5d7b476ac8458805073df47941d99861de81347861f4d03d3e" | |
| 3847 | 3847 | dependencies = [ |
| 3848 | 3848 | "anymap2", |
| 3849 | 3849 | "arboard", |
| @@ -3865,9 +3865,9 @@ dependencies = [ | ||
| 3865 | 3865 | |
| 3866 | 3866 | [[package]] |
| 3867 | 3867 | name = "modalkit-ratatui" |
| 3868 | version = "0.0.27" | |
| 3868 | version = "0.0.28" | |
| 3869 | 3869 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 3870 | checksum = "cf64561c3f42a3a587d564fde9274fdbcf95287281efd56fc0db6a1c12459730" | |
| 3870 | checksum = "2fd45bce81ff69f3cb2126b0d59aafe74c3982a2f8be68f49dc14f3c7c180629" | |
| 3871 | 3871 | dependencies = [ |
| 3872 | 3872 | "crossterm 0.29.0", |
| 3873 | 3873 | "intervaltree", |
Cargo.toml +2 −2
| @@ -83,13 +83,13 @@ version = "4.12" | ||
| 83 | 83 | optional = true |
| 84 | 84 | |
| 85 | 85 | [dependencies.modalkit] |
| 86 | version = "0.0.27" | |
| 86 | version = "0.0.28" | |
| 87 | 87 | default-features = false |
| 88 | 88 | #git = "https://github.com/ulyssa/modalkit" |
| 89 | 89 | #rev = "9386f6f75f6984a1cdbd7dddbb0c0bb3e7a37c5d" |
| 90 | 90 | |
| 91 | 91 | [dependencies.modalkit-ratatui] |
| 92 | version = "0.0.27" | |
| 92 | version = "0.0.28" | |
| 93 | 93 | #git = "https://github.com/ulyssa/modalkit" |
| 94 | 94 | #rev = "9386f6f75f6984a1cdbd7dddbb0c0bb3e7a37c5d" |
| 95 | 95 | |
config.example.toml +10
| @@ -73,6 +73,16 @@ split = [ | ||
| 73 | 73 | [macros."normal|visual"] |
| 74 | 74 | "V" = "<C-W>m" |
| 75 | 75 | |
| 76 | [aliases] | |
| 77 | "c" = "chats" | |
| 78 | "d" = "download" | |
| 79 | "e" = "edit" | |
| 80 | "o" = "open" | |
| 81 | "r" = "rooms" | |
| 82 | "ed" = "editor" | |
| 83 | "ca" = "cancel" | |
| 84 | "red" = "redact" | |
| 85 | ||
| 76 | 86 | [dirs] |
| 77 | 87 | cache = "/home/user/.cache/iamb/" |
| 78 | 88 | logs = "/home/user/.local/share/iamb/logs/" |
docs/iamb.5 +13
| @@ -719,6 +719,19 @@ split = [ | ||
| 719 | 719 | { "window" = "#iamb-dev:0x.badd.cafe" } |
| 720 | 720 | ] |
| 721 | 721 | .Ed |
| 722 | .Sh "CUSTOM COMMAND ALIASES" | |
| 723 | The | |
| 724 | .Sy aliases | |
| 725 | subsections allow configuring custom aliases. | |
| 726 | .Ss Example 1: Alias commands to single-letter versions | |
| 727 | .Bd -literal -offset indent | |
| 728 | [aliases] | |
| 729 | "c" = "chats" | |
| 730 | "d" = "download" | |
| 731 | "e" = "edit" | |
| 732 | "o" = "open" | |
| 733 | "r" = "rooms" | |
| 734 | .Ed | |
| 722 | 735 | .Sh "CUSTOM KEYBINDINGS" |
| 723 | 736 | The |
| 724 | 737 | .Sy macros |
src/base.rs +7 −4
| @@ -1945,14 +1945,15 @@ pub struct ChatStore { | ||
| 1945 | 1945 | |
| 1946 | 1946 | impl ChatStore { |
| 1947 | 1947 | /// Create a new [ChatStore]. |
| 1948 | pub fn new(worker: Requester, settings: ApplicationSettings) -> Self { | |
| 1948 | pub fn new(worker: Requester, settings: ApplicationSettings) -> IambResult<Self> { | |
| 1949 | 1949 | let previews = PreviewManager::new(&settings); |
| 1950 | let cmds = crate::commands::setup_commands(&settings.aliases)?; | |
| 1950 | 1951 | |
| 1951 | ChatStore { | |
| 1952 | let store = ChatStore { | |
| 1952 | 1953 | worker, |
| 1953 | 1954 | settings, |
| 1954 | 1955 | previews, |
| 1955 | cmds: crate::commands::setup_commands(), | |
| 1956 | cmds, | |
| 1956 | 1957 | emojis: emoji_map(), |
| 1957 | 1958 | |
| 1958 | 1959 | collator: Default::default(), |
| @@ -1966,7 +1967,9 @@ impl ChatStore { | ||
| 1966 | 1967 | ring_bell: false, |
| 1967 | 1968 | focused: true, |
| 1968 | 1969 | open_notifications: Default::default(), |
| 1969 | } | |
| 1970 | }; | |
| 1971 | ||
| 1972 | Ok(store) | |
| 1970 | 1973 | } |
| 1971 | 1974 | |
| 1972 | 1975 | /// Get a joined room. |
src/commands.rs +33 −25
| @@ -1175,12 +1175,16 @@ pub fn add_iamb_commands(cmds: &mut ProgramCommands) { | ||
| 1175 | 1175 | } |
| 1176 | 1176 | |
| 1177 | 1177 | /// Initialize the default command state. |
| 1178 | pub fn setup_commands() -> ProgramCommands { | |
| 1178 | pub fn setup_commands(aliases: &HashMap<String, String>) -> Result<ProgramCommands, CommandError> { | |
| 1179 | 1179 | let mut cmds = ProgramCommands::default(); |
| 1180 | 1180 | |
| 1181 | 1181 | add_iamb_commands(&mut cmds); |
| 1182 | 1182 | |
| 1183 | return cmds; | |
| 1183 | for (alias, cmd) in aliases { | |
| 1184 | cmds.add_alias(alias, cmd)?; | |
| 1185 | } | |
| 1186 | ||
| 1187 | Ok(cmds) | |
| 1184 | 1188 | } |
| 1185 | 1189 | |
| 1186 | 1190 | #[cfg(test)] |
| @@ -1191,9 +1195,13 @@ mod tests { | ||
| 1191 | 1195 | use modalkit::actions::WindowAction; |
| 1192 | 1196 | use modalkit::editing::context::EditContext; |
| 1193 | 1197 | |
| 1198 | fn setup_test_commands() -> ProgramCommands { | |
| 1199 | setup_commands(&HashMap::new()).unwrap() | |
| 1200 | } | |
| 1201 | ||
| 1194 | 1202 | #[test] |
| 1195 | 1203 | fn test_cmd_verify() { |
| 1196 | let mut cmds = setup_commands(); | |
| 1204 | let mut cmds = setup_test_commands(); | |
| 1197 | 1205 | let ctx = EditContext::default(); |
| 1198 | 1206 | |
| 1199 | 1207 | let res = cmds.input_cmd(":verify", ctx.clone()).unwrap(); |
| @@ -1251,7 +1259,7 @@ mod tests { | ||
| 1251 | 1259 | |
| 1252 | 1260 | #[test] |
| 1253 | 1261 | fn test_cmd_join() { |
| 1254 | let mut cmds = setup_commands(); | |
| 1262 | let mut cmds = setup_test_commands(); | |
| 1255 | 1263 | let ctx = EditContext::default(); |
| 1256 | 1264 | |
| 1257 | 1265 | let res = cmds.input_cmd("join #foobar:example.com", ctx.clone()).unwrap(); |
| @@ -1271,7 +1279,7 @@ mod tests { | ||
| 1271 | 1279 | |
| 1272 | 1280 | #[test] |
| 1273 | 1281 | fn test_cmd_room_invalid() { |
| 1274 | let mut cmds = setup_commands(); | |
| 1282 | let mut cmds = setup_test_commands(); | |
| 1275 | 1283 | let ctx = EditContext::default(); |
| 1276 | 1284 | |
| 1277 | 1285 | let res = cmds.input_cmd("room", ctx.clone()); |
| @@ -1286,7 +1294,7 @@ mod tests { | ||
| 1286 | 1294 | |
| 1287 | 1295 | #[test] |
| 1288 | 1296 | fn test_cmd_room_topic_set() { |
| 1289 | let mut cmds = setup_commands(); | |
| 1297 | let mut cmds = setup_test_commands(); | |
| 1290 | 1298 | let ctx = EditContext::default(); |
| 1291 | 1299 | |
| 1292 | 1300 | let res = cmds |
| @@ -1317,7 +1325,7 @@ mod tests { | ||
| 1317 | 1325 | |
| 1318 | 1326 | #[test] |
| 1319 | 1327 | fn test_cmd_room_name_invalid() { |
| 1320 | let mut cmds = setup_commands(); | |
| 1328 | let mut cmds = setup_test_commands(); | |
| 1321 | 1329 | let ctx = EditContext::default(); |
| 1322 | 1330 | |
| 1323 | 1331 | let res = cmds.input_cmd("room name", ctx.clone()); |
| @@ -1329,7 +1337,7 @@ mod tests { | ||
| 1329 | 1337 | |
| 1330 | 1338 | #[test] |
| 1331 | 1339 | fn test_cmd_room_name_set() { |
| 1332 | let mut cmds = setup_commands(); | |
| 1340 | let mut cmds = setup_test_commands(); | |
| 1333 | 1341 | let ctx = EditContext::default(); |
| 1334 | 1342 | |
| 1335 | 1343 | let res = cmds.input_cmd("room name set Development", ctx.clone()).unwrap(); |
| @@ -1348,7 +1356,7 @@ mod tests { | ||
| 1348 | 1356 | |
| 1349 | 1357 | #[test] |
| 1350 | 1358 | fn test_cmd_room_name_unset() { |
| 1351 | let mut cmds = setup_commands(); | |
| 1359 | let mut cmds = setup_test_commands(); | |
| 1352 | 1360 | let ctx = EditContext::default(); |
| 1353 | 1361 | |
| 1354 | 1362 | let res = cmds.input_cmd("room name unset", ctx.clone()).unwrap(); |
| @@ -1361,7 +1369,7 @@ mod tests { | ||
| 1361 | 1369 | |
| 1362 | 1370 | #[test] |
| 1363 | 1371 | fn test_cmd_room_dm_set() { |
| 1364 | let mut cmds = setup_commands(); | |
| 1372 | let mut cmds = setup_test_commands(); | |
| 1365 | 1373 | let ctx = EditContext::default(); |
| 1366 | 1374 | |
| 1367 | 1375 | let res = cmds.input_cmd("room dm set", ctx.clone()).unwrap(); |
| @@ -1374,7 +1382,7 @@ mod tests { | ||
| 1374 | 1382 | |
| 1375 | 1383 | #[test] |
| 1376 | 1384 | fn test_cmd_room_dm_unset() { |
| 1377 | let mut cmds = setup_commands(); | |
| 1385 | let mut cmds = setup_test_commands(); | |
| 1378 | 1386 | let ctx = EditContext::default(); |
| 1379 | 1387 | |
| 1380 | 1388 | let res = cmds.input_cmd("room dm unset", ctx.clone()).unwrap(); |
| @@ -1387,7 +1395,7 @@ mod tests { | ||
| 1387 | 1395 | |
| 1388 | 1396 | #[test] |
| 1389 | 1397 | fn test_cmd_room_tag_set() { |
| 1390 | let mut cmds = setup_commands(); | |
| 1398 | let mut cmds = setup_test_commands(); | |
| 1391 | 1399 | let ctx = EditContext::default(); |
| 1392 | 1400 | |
| 1393 | 1401 | let res = cmds.input_cmd("room tag set favourite", ctx.clone()).unwrap(); |
| @@ -1456,7 +1464,7 @@ mod tests { | ||
| 1456 | 1464 | |
| 1457 | 1465 | #[test] |
| 1458 | 1466 | fn test_cmd_room_tag_unset() { |
| 1459 | let mut cmds = setup_commands(); | |
| 1467 | let mut cmds = setup_test_commands(); | |
| 1460 | 1468 | let ctx = EditContext::default(); |
| 1461 | 1469 | |
| 1462 | 1470 | let res = cmds.input_cmd("room tag unset favourite", ctx.clone()).unwrap(); |
| @@ -1521,7 +1529,7 @@ mod tests { | ||
| 1521 | 1529 | |
| 1522 | 1530 | #[test] |
| 1523 | 1531 | fn test_cmd_room_notification_mode_set() { |
| 1524 | let mut cmds = setup_commands(); | |
| 1532 | let mut cmds = setup_test_commands(); | |
| 1525 | 1533 | let ctx = EditContext::default(); |
| 1526 | 1534 | |
| 1527 | 1535 | let cmd = "room notify set mute"; |
| @@ -1542,7 +1550,7 @@ mod tests { | ||
| 1542 | 1550 | |
| 1543 | 1551 | #[test] |
| 1544 | 1552 | fn test_cmd_room_id_show() { |
| 1545 | let mut cmds = setup_commands(); | |
| 1553 | let mut cmds = setup_test_commands(); | |
| 1546 | 1554 | let ctx = EditContext::default(); |
| 1547 | 1555 | |
| 1548 | 1556 | let res = cmds.input_cmd("room id show", ctx.clone()).unwrap(); |
| @@ -1555,7 +1563,7 @@ mod tests { | ||
| 1555 | 1563 | |
| 1556 | 1564 | #[test] |
| 1557 | 1565 | fn test_cmd_space_child() { |
| 1558 | let mut cmds = setup_commands(); | |
| 1566 | let mut cmds = setup_test_commands(); | |
| 1559 | 1567 | let ctx = EditContext::default(); |
| 1560 | 1568 | |
| 1561 | 1569 | let cmd = "space"; |
| @@ -1573,7 +1581,7 @@ mod tests { | ||
| 1573 | 1581 | |
| 1574 | 1582 | #[test] |
| 1575 | 1583 | fn test_cmd_space_child_set() { |
| 1576 | let mut cmds = setup_commands(); | |
| 1584 | let mut cmds = setup_test_commands(); | |
| 1577 | 1585 | let ctx = EditContext::default(); |
| 1578 | 1586 | |
| 1579 | 1587 | let cmd = "space child set !roomid:example.org"; |
| @@ -1624,7 +1632,7 @@ mod tests { | ||
| 1624 | 1632 | |
| 1625 | 1633 | #[test] |
| 1626 | 1634 | fn test_cmd_space_child_remove() { |
| 1627 | let mut cmds = setup_commands(); | |
| 1635 | let mut cmds = setup_test_commands(); | |
| 1628 | 1636 | let ctx = EditContext::default(); |
| 1629 | 1637 | |
| 1630 | 1638 | let cmd = "space child remove"; |
| @@ -1639,7 +1647,7 @@ mod tests { | ||
| 1639 | 1647 | |
| 1640 | 1648 | #[test] |
| 1641 | 1649 | fn test_cmd_invite() { |
| 1642 | let mut cmds = setup_commands(); | |
| 1650 | let mut cmds = setup_test_commands(); | |
| 1643 | 1651 | let ctx = EditContext::default(); |
| 1644 | 1652 | |
| 1645 | 1653 | let res = cmds.input_cmd("invite accept", ctx.clone()).unwrap(); |
| @@ -1676,7 +1684,7 @@ mod tests { | ||
| 1676 | 1684 | |
| 1677 | 1685 | #[test] |
| 1678 | 1686 | fn test_cmd_room_kick() { |
| 1679 | let mut cmds = setup_commands(); | |
| 1687 | let mut cmds = setup_test_commands(); | |
| 1680 | 1688 | let ctx = EditContext::default(); |
| 1681 | 1689 | |
| 1682 | 1690 | let res = cmds.input_cmd("room kick @user:example.com", ctx.clone()).unwrap(); |
| @@ -1711,7 +1719,7 @@ mod tests { | ||
| 1711 | 1719 | |
| 1712 | 1720 | #[test] |
| 1713 | 1721 | fn test_cmd_room_ban_unban() { |
| 1714 | let mut cmds = setup_commands(); | |
| 1722 | let mut cmds = setup_test_commands(); | |
| 1715 | 1723 | let ctx = EditContext::default(); |
| 1716 | 1724 | |
| 1717 | 1725 | let res = cmds |
| @@ -1739,7 +1747,7 @@ mod tests { | ||
| 1739 | 1747 | |
| 1740 | 1748 | #[test] |
| 1741 | 1749 | fn test_cmd_redact() { |
| 1742 | let mut cmds = setup_commands(); | |
| 1750 | let mut cmds = setup_test_commands(); | |
| 1743 | 1751 | let ctx = EditContext::default(); |
| 1744 | 1752 | |
| 1745 | 1753 | let res = cmds.input_cmd("redact", ctx.clone()).unwrap(); |
| @@ -1764,7 +1772,7 @@ mod tests { | ||
| 1764 | 1772 | |
| 1765 | 1773 | #[test] |
| 1766 | 1774 | fn test_cmd_keys() { |
| 1767 | let mut cmds = setup_commands(); | |
| 1775 | let mut cmds = setup_test_commands(); | |
| 1768 | 1776 | let ctx = EditContext::default(); |
| 1769 | 1777 | |
| 1770 | 1778 | let res = cmds.input_cmd("keys import /a/b/c pword", ctx.clone()).unwrap(); |
| @@ -1791,7 +1799,7 @@ mod tests { | ||
| 1791 | 1799 | |
| 1792 | 1800 | #[test] |
| 1793 | 1801 | fn test_cmd_multiple_trailing() { |
| 1794 | let mut cmds = setup_commands(); | |
| 1802 | let mut cmds = setup_test_commands(); | |
| 1795 | 1803 | let ctx = EditContext::default(); |
| 1796 | 1804 | |
| 1797 | 1805 | // Trailing arguments disallowed on commands that don't take any: |
| @@ -1838,7 +1846,7 @@ mod tests { | ||
| 1838 | 1846 | |
| 1839 | 1847 | #[test] |
| 1840 | 1848 | fn test_cmd_room_access() { |
| 1841 | let mut cmds = setup_commands(); | |
| 1849 | let mut cmds = setup_test_commands(); | |
| 1842 | 1850 | let ctx = EditContext::default(); |
| 1843 | 1851 | |
| 1844 | 1852 | let res = cmds.input_cmd("room access set knock", ctx.clone()).unwrap(); |
src/config.rs +18
| @@ -26,6 +26,7 @@ use serde::{Deserialize, Deserializer, Serialize}; | ||
| 26 | 26 | use crate::base::{SortColumn, SortFieldRoom, SortFieldUser, SortOrder}; |
| 27 | 27 | use crate::prelude::*; |
| 28 | 28 | |
| 29 | type Aliases = HashMap<String, String>; | |
| 29 | 30 | type Macros = HashMap<VimModes, HashMap<Keys, Keys>>; |
| 30 | 31 | |
| 31 | 32 | macro_rules! usage { |
| @@ -1205,6 +1206,7 @@ pub struct ProfileConfig { | ||
| 1205 | 1206 | pub dirs: Option<Directories>, |
| 1206 | 1207 | pub layout: Option<Layout>, |
| 1207 | 1208 | pub macros: Option<Macros>, |
| 1209 | pub aliases: Option<Aliases>, | |
| 1208 | 1210 | } |
| 1209 | 1211 | |
| 1210 | 1212 | #[derive(Clone, Deserialize)] |
| @@ -1215,6 +1217,7 @@ pub struct IambConfig { | ||
| 1215 | 1217 | pub dirs: Option<Directories>, |
| 1216 | 1218 | pub layout: Option<Layout>, |
| 1217 | 1219 | pub macros: Option<Macros>, |
| 1220 | pub aliases: Option<Aliases>, | |
| 1218 | 1221 | } |
| 1219 | 1222 | |
| 1220 | 1223 | impl IambConfig { |
| @@ -1247,6 +1250,7 @@ pub struct ApplicationSettings { | ||
| 1247 | 1250 | pub dirs: DirectoryValues, |
| 1248 | 1251 | pub layout: Layout, |
| 1249 | 1252 | pub macros: Macros, |
| 1253 | pub aliases: Aliases, | |
| 1250 | 1254 | |
| 1251 | 1255 | /// Whether to use the Kitty keyboard protocol. Resolved by |
| 1252 | 1256 | /// [`ApplicationSettings::probe_enhanced_keys`] once the TUI starts, since |
| @@ -1295,6 +1299,7 @@ impl ApplicationSettings { | ||
| 1295 | 1299 | settings: global, |
| 1296 | 1300 | layout, |
| 1297 | 1301 | macros, |
| 1302 | aliases, | |
| 1298 | 1303 | } = config; |
| 1299 | 1304 | |
| 1300 | 1305 | validate_profile_names(&profiles); |
| @@ -1336,6 +1341,7 @@ impl ApplicationSettings { | ||
| 1336 | 1341 | } |
| 1337 | 1342 | }; |
| 1338 | 1343 | |
| 1344 | let aliases = merge_maps(profile.aliases.take(), aliases).unwrap_or_default(); | |
| 1339 | 1345 | let macros = merge_maps(profile.macros.take(), macros).unwrap_or_default(); |
| 1340 | 1346 | let layout = profile.layout.take().or(layout).unwrap_or_default(); |
| 1341 | 1347 | |
| @@ -1395,6 +1401,7 @@ impl ApplicationSettings { | ||
| 1395 | 1401 | dirs, |
| 1396 | 1402 | layout, |
| 1397 | 1403 | macros, |
| 1404 | aliases, | |
| 1398 | 1405 | enable_enhanced_keys: false, |
| 1399 | 1406 | }; |
| 1400 | 1407 | |
| @@ -1816,6 +1823,15 @@ mod tests { | ||
| 1816 | 1823 | assert_eq!(res, Layout::Config { tabs }); |
| 1817 | 1824 | } |
| 1818 | 1825 | |
| 1826 | #[test] | |
| 1827 | fn test_parse_aliases() { | |
| 1828 | let res: Aliases = serde_json::from_str("{\"c\":\"chats\"}").unwrap(); | |
| 1829 | assert_eq!(res.len(), 1); | |
| 1830 | ||
| 1831 | let aliased = res.get("c").unwrap(); | |
| 1832 | assert_eq!(aliased, "chats"); | |
| 1833 | } | |
| 1834 | ||
| 1819 | 1835 | #[test] |
| 1820 | 1836 | fn test_parse_macros() { |
| 1821 | 1837 | let res: Macros = serde_json::from_str("{\"i|c\":{\"jj\":\"<Esc>\"}}").unwrap(); |
| @@ -1880,6 +1896,7 @@ mod tests { | ||
| 1880 | 1896 | dirs, |
| 1881 | 1897 | layout, |
| 1882 | 1898 | macros, |
| 1899 | aliases, | |
| 1883 | 1900 | } = &config; |
| 1884 | 1901 | |
| 1885 | 1902 | // There should be an example object for each top-level field. |
| @@ -1889,6 +1906,7 @@ mod tests { | ||
| 1889 | 1906 | assert!(dirs.is_some()); |
| 1890 | 1907 | assert!(layout.is_some()); |
| 1891 | 1908 | assert!(macros.is_some()); |
| 1909 | assert!(aliases.is_some()); | |
| 1892 | 1910 | } |
| 1893 | 1911 | |
| 1894 | 1912 | #[test] |
src/keybindings.rs +1 −1
| @@ -23,7 +23,7 @@ pub fn setup_keybindings() -> Keybindings { | ||
| 23 | 23 | let mut ism = Keybindings::empty(); |
| 24 | 24 | |
| 25 | 25 | let vim = VimBindings::default() |
| 26 | .submit_on_enter() | |
| 26 | .submit_on_enter(false) | |
| 27 | 27 | .cursor_open(MATRIX_ID_WORD.clone()); |
| 28 | 28 | |
| 29 | 29 | vim.setup(&mut ism); |
src/main.rs +1 −1
| @@ -1111,7 +1111,7 @@ async fn run( | ||
| 1111 | 1111 | |
| 1112 | 1112 | // Set up the async worker thread and global store. |
| 1113 | 1113 | let worker = ClientWorker::spawn(client.clone(), settings.clone()).await; |
| 1114 | let store = ChatStore::new(worker.clone(), settings.clone()); | |
| 1114 | let store = ChatStore::new(worker.clone(), settings.clone())?; | |
| 1115 | 1115 | let mut store = Store::new(store); |
| 1116 | 1116 | store.completer = Box::new(IambCompleter); |
| 1117 | 1117 | |
src/tests.rs +3 −1
| @@ -221,11 +221,13 @@ pub fn mock_settings() -> ApplicationSettings { | ||
| 221 | 221 | dirs: None, |
| 222 | 222 | layout: None, |
| 223 | 223 | macros: None, |
| 224 | aliases: None, | |
| 224 | 225 | }, |
| 225 | 226 | tunables: mock_tunables(), |
| 226 | 227 | dirs: mock_dirs(), |
| 227 | 228 | layout: Default::default(), |
| 228 | 229 | macros: HashMap::default(), |
| 230 | aliases: HashMap::default(), | |
| 229 | 231 | enable_enhanced_keys: false, |
| 230 | 232 | } |
| 231 | 233 | } |
| @@ -242,7 +244,7 @@ pub async fn mock_store() -> ProgramStore { | ||
| 242 | 244 | .unwrap(); |
| 243 | 245 | let worker = Requester { tx, receipts, client }; |
| 244 | 246 | |
| 245 | let mut store = ChatStore::new(worker, mock_settings()); | |
| 247 | let mut store = ChatStore::new(worker, mock_settings()).unwrap(); | |
| 246 | 248 | |
| 247 | 249 | // Add presence information. |
| 248 | 250 | store.presences.get_or_default(TEST_USER1.clone()); |