Commit 7d66421863

7d664218631eab010ba3d38a19aa80c4fbfd9605

parent: b57b5b86df

Unregistered key

Ulyssa <git@ulyssa.dev> · 2026-09-18 23:40 UTC
committer: <noreply@github.com>

Support user-defined command aliases (#715)

Layout: unified · split

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