Commit af96bfbb41

af96bfbb41a8d165776f7e463c8fdc9d3804d4fc

parent: 5f927ce9c3

Unregistered key

Ulyssa <git@ulyssa.dev> · 2025-05-17 01:02 UTC
committer: <noreply@github.com>

Update to latest `modalkit`, `modalkit-ratatui` and `ratatui-image` (#422)

Layout: unified · split

Cargo.lock +80 −32
@@ -564,6 +564,12 @@ dependencies = [
564 "rustc-demangle", 564 "rustc-demangle",
565] 565]
566 566
567[[package]]
568name = "base64"
569version = "0.21.7"
570source = "registry+https://github.com/rust-lang/crates.io-index"
571checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567"
572
567[[package]] 573[[package]]
568name = "base64" 574name = "base64"
569version = "0.22.1" 575version = "0.22.1"
@@ -1452,12 +1458,6 @@ version = "1.2.1"
1452source = "registry+https://github.com/rust-lang/crates.io-index" 1458source = "registry+https://github.com/rust-lang/crates.io-index"
1453checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" 1459checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2"
1454 1460
1455[[package]]
1456name = "dyn-clone"
1457version = "1.0.17"
1458source = "registry+https://github.com/rust-lang/crates.io-index"
1459checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125"
1460
1461[[package]] 1461[[package]]
1462name = "ed25519" 1462name = "ed25519"
1463version = "2.2.3" 1463version = "2.2.3"
@@ -2505,9 +2505,9 @@ dependencies = [
2505 2505
2506[[package]] 2506[[package]]
2507name = "image" 2507name = "image"
2508version = "0.25.2" 2508version = "0.25.6"
2509source = "registry+https://github.com/rust-lang/crates.io-index" 2509source = "registry+https://github.com/rust-lang/crates.io-index"
2510checksum = "99314c8a2152b8ddb211f924cdae532d8c5e4c8bb54728e12fff1b0cd5963a10" 2510checksum = "db35664ce6b9810857a38a906215e75a9c879f0696556a39f59c62829710251a"
2511dependencies = [ 2511dependencies = [
2512 "bytemuck", 2512 "bytemuck",
2513 "byteorder-lite", 2513 "byteorder-lite",
@@ -2528,9 +2528,9 @@ dependencies = [
2528 2528
2529[[package]] 2529[[package]]
2530name = "image-webp" 2530name = "image-webp"
2531version = "0.1.3" 2531version = "0.2.1"
2532source = "registry+https://github.com/rust-lang/crates.io-index" 2532source = "registry+https://github.com/rust-lang/crates.io-index"
2533checksum = "f79afb8cbee2ef20f59ccd477a218c12a93943d075b492015ecb1bb81f8ee904" 2533checksum = "b77d01e822461baa8409e156015a1d91735549f0f2c17691bd2d996bef238f7f"
2534dependencies = [ 2534dependencies = [
2535 "byteorder-lite", 2535 "byteorder-lite",
2536 "quick-error", 2536 "quick-error",
@@ -2785,7 +2785,8 @@ dependencies = [
2785[[package]] 2785[[package]]
2786name = "keybindings" 2786name = "keybindings"
2787version = "0.0.1" 2787version = "0.0.1"
2788source = "git+https://github.com/ulyssa/modalkit?rev=45855daeeb7081eec626a8f9cf657f0fc2ff0a7a#45855daeeb7081eec626a8f9cf657f0fc2ff0a7a" 2788source = "registry+https://github.com/rust-lang/crates.io-index"
2789checksum = "680e4699c91c0622dd70da32c274881aadb1ac86252d738c3641266e90e4ca15"
2789dependencies = [ 2790dependencies = [
2790 "textwrap", 2791 "textwrap",
2791 "unicode-segmentation", 2792 "unicode-segmentation",
@@ -3227,7 +3228,7 @@ checksum = "da30f51dbfcd03297a04f49f92c365a41cb2b012ad3338c0fc5d4efafcbff88b"
3227dependencies = [ 3228dependencies = [
3228 "anyhow", 3229 "anyhow",
3229 "async-trait", 3230 "async-trait",
3230 "base64", 3231 "base64 0.22.1",
3231 "getrandom 0.2.15", 3232 "getrandom 0.2.15",
3232 "gloo-utils", 3233 "gloo-utils",
3233 "hkdf", 3234 "hkdf",
@@ -3277,7 +3278,7 @@ version = "0.10.0"
3277source = "registry+https://github.com/rust-lang/crates.io-index" 3278source = "registry+https://github.com/rust-lang/crates.io-index"
3278checksum = "dcc8b6650757f953664e5f906988690cef05c09d83081946adce446c45810a2d" 3279checksum = "dcc8b6650757f953664e5f906988690cef05c09d83081946adce446c45810a2d"
3279dependencies = [ 3280dependencies = [
3280 "base64", 3281 "base64 0.22.1",
3281 "blake3", 3282 "blake3",
3282 "chacha20poly1305", 3283 "chacha20poly1305",
3283 "hmac", 3284 "hmac",
@@ -3298,6 +3299,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
3298checksum = "8ea1f30cedd69f0a2954655f7188c6a834246d2bcf1e315e2ac40c4b24dc9519" 3299checksum = "8ea1f30cedd69f0a2954655f7188c6a834246d2bcf1e315e2ac40c4b24dc9519"
3299dependencies = [ 3300dependencies = [
3300 "cfg-if", 3301 "cfg-if",
3302 "rayon",
3301] 3303]
3302 3304
3303[[package]] 3305[[package]]
@@ -3394,8 +3396,9 @@ dependencies = [
3394 3396
3395[[package]] 3397[[package]]
3396name = "modalkit" 3398name = "modalkit"
3397version = "0.0.20" 3399version = "0.0.21"
3398source = "git+https://github.com/ulyssa/modalkit?rev=45855daeeb7081eec626a8f9cf657f0fc2ff0a7a#45855daeeb7081eec626a8f9cf657f0fc2ff0a7a" 3400source = "registry+https://github.com/rust-lang/crates.io-index"
3401checksum = "dc7599fc1bcd2f0a0b4598f23433b45613345a46419ab27d3a9adecb57acd648"
3399dependencies = [ 3402dependencies = [
3400 "anymap2", 3403 "anymap2",
3401 "arboard", 3404 "arboard",
@@ -3415,8 +3418,9 @@ dependencies = [
3415 3418
3416[[package]] 3419[[package]]
3417name = "modalkit-ratatui" 3420name = "modalkit-ratatui"
3418version = "0.0.20" 3421version = "0.0.21"
3419source = "git+https://github.com/ulyssa/modalkit?rev=45855daeeb7081eec626a8f9cf657f0fc2ff0a7a#45855daeeb7081eec626a8f9cf657f0fc2ff0a7a" 3422source = "registry+https://github.com/rust-lang/crates.io-index"
3423checksum = "dd3d88c86435d4b1fb22c7c0f978b09cb888338cafc10336715aa5070e92b6f6"
3420dependencies = [ 3424dependencies = [
3421 "crossterm", 3425 "crossterm",
3422 "intervaltree", 3426 "intervaltree",
@@ -4367,39 +4371,40 @@ dependencies = [
4367 4371
4368[[package]] 4372[[package]]
4369name = "ratatui" 4373name = "ratatui"
4370version = "0.28.1" 4374version = "0.29.0"
4371source = "registry+https://github.com/rust-lang/crates.io-index" 4375source = "registry+https://github.com/rust-lang/crates.io-index"
4372checksum = "fdef7f9be5c0122f890d58bdf4d964349ba6a6161f705907526d891efabba57d" 4376checksum = "eabd94c2f37801c20583fc49dd5cd6b0ba68c716787c2dd6ed18571e1e63117b"
4373dependencies = [ 4377dependencies = [
4374 "bitflags 2.8.0", 4378 "bitflags 2.8.0",
4375 "cassowary", 4379 "cassowary",
4376 "compact_str", 4380 "compact_str",
4377 "crossterm", 4381 "crossterm",
4382 "indoc",
4378 "instability", 4383 "instability",
4379 "itertools 0.13.0", 4384 "itertools 0.13.0",
4380 "lru", 4385 "lru",
4381 "paste", 4386 "paste",
4382 "strum", 4387 "strum",
4383 "strum_macros",
4384 "unicode-segmentation", 4388 "unicode-segmentation",
4385 "unicode-truncate", 4389 "unicode-truncate",
4386 "unicode-width 0.1.13", 4390 "unicode-width 0.2.0",
4387] 4391]
4388 4392
4389[[package]] 4393[[package]]
4390name = "ratatui-image" 4394name = "ratatui-image"
4391version = "1.0.5" 4395version = "6.0.0"
4392source = "registry+https://github.com/rust-lang/crates.io-index" 4396source = "registry+https://github.com/rust-lang/crates.io-index"
4393checksum = "de94276254cb20fb7431726875bd2ac6391a6ffc26f4b8e3d23f79d1286b491e" 4397checksum = "d6f868820aabfce698e69639620ab9100f2ca29319ba960b9ba218482065489d"
4394dependencies = [ 4398dependencies = [
4395 "base64", 4399 "base64 0.21.7",
4396 "dyn-clone",
4397 "icy_sixel", 4400 "icy_sixel",
4398 "image", 4401 "image",
4399 "rand 0.8.5", 4402 "rand 0.8.5",
4400 "ratatui", 4403 "ratatui",
4401 "rustix 0.38.44", 4404 "rustix 0.38.44",
4402 "serde", 4405 "serde",
4406 "thiserror 1.0.63",
4407 "windows 0.58.0",
4403] 4408]
4404 4409
4405[[package]] 4410[[package]]
@@ -4448,6 +4453,7 @@ dependencies = [
4448 "loop9", 4453 "loop9",
4449 "quick-error", 4454 "quick-error",
4450 "rav1e", 4455 "rav1e",
4456 "rayon",
4451 "rgb", 4457 "rgb",
4452] 4458]
4453 4459
@@ -4551,7 +4557,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
4551checksum = "43e734407157c3c2034e0258f5e4473ddb361b1e85f95a66690d67264d7cd1da" 4557checksum = "43e734407157c3c2034e0258f5e4473ddb361b1e85f95a66690d67264d7cd1da"
4552dependencies = [ 4558dependencies = [
4553 "async-compression", 4559 "async-compression",
4554 "base64", 4560 "base64 0.22.1",
4555 "bytes", 4561 "bytes",
4556 "futures-core", 4562 "futures-core",
4557 "futures-util", 4563 "futures-util",
@@ -4599,9 +4605,6 @@ name = "rgb"
4599version = "0.8.50" 4605version = "0.8.50"
4600source = "registry+https://github.com/rust-lang/crates.io-index" 4606source = "registry+https://github.com/rust-lang/crates.io-index"
4601checksum = "57397d16646700483b67d2dd6511d79318f9d057fdbd21a4066aeac8b41d310a" 4607checksum = "57397d16646700483b67d2dd6511d79318f9d057fdbd21a4066aeac8b41d310a"
4602dependencies = [
4603 "bytemuck",
4604]
4605 4608
4606[[package]] 4609[[package]]
4607name = "ring" 4610name = "ring"
@@ -4718,7 +4721,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
4718checksum = "1058c04b8dd62f4fba71c9f65112fb79bc332438d11aefe1e8edf67b7fb58a98" 4721checksum = "1058c04b8dd62f4fba71c9f65112fb79bc332438d11aefe1e8edf67b7fb58a98"
4719dependencies = [ 4722dependencies = [
4720 "as_variant", 4723 "as_variant",
4721 "base64", 4724 "base64 0.22.1",
4722 "bytes", 4725 "bytes",
4723 "form_urlencoded", 4726 "form_urlencoded",
4724 "getrandom 0.2.15", 4727 "getrandom 0.2.15",
@@ -5418,7 +5421,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
5418checksum = "006851c9ccefa3c38a7646b8cec804bb429def3da10497bfa977179869c3e8e2" 5421checksum = "006851c9ccefa3c38a7646b8cec804bb429def3da10497bfa977179869c3e8e2"
5419dependencies = [ 5422dependencies = [
5420 "quick-xml 0.30.0", 5423 "quick-xml 0.30.0",
5421 "windows", 5424 "windows 0.51.1",
5422] 5425]
5423 5426
5424[[package]] 5427[[package]]
@@ -6053,7 +6056,7 @@ checksum = "c022a277687e4e8685d72b95a7ca3ccfec907daa946678e715f8badaa650883d"
6053dependencies = [ 6056dependencies = [
6054 "aes", 6057 "aes",
6055 "arrayvec", 6058 "arrayvec",
6056 "base64", 6059 "base64 0.22.1",
6057 "base64ct", 6060 "base64ct",
6058 "cbc", 6061 "cbc",
6059 "chacha20poly1305", 6062 "chacha20poly1305",
@@ -6343,6 +6346,16 @@ dependencies = [
6343 "windows-targets 0.48.5", 6346 "windows-targets 0.48.5",
6344] 6347]
6345 6348
6349[[package]]
6350name = "windows"
6351version = "0.58.0"
6352source = "registry+https://github.com/rust-lang/crates.io-index"
6353checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6"
6354dependencies = [
6355 "windows-core 0.58.0",
6356 "windows-targets 0.52.6",
6357]
6358
6346[[package]] 6359[[package]]
6347name = "windows-core" 6360name = "windows-core"
6348version = "0.51.1" 6361version = "0.51.1"
@@ -6361,6 +6374,41 @@ dependencies = [
6361 "windows-targets 0.52.6", 6374 "windows-targets 0.52.6",
6362] 6375]
6363 6376
6377[[package]]
6378name = "windows-core"
6379version = "0.58.0"
6380source = "registry+https://github.com/rust-lang/crates.io-index"
6381checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99"
6382dependencies = [
6383 "windows-implement",
6384 "windows-interface",
6385 "windows-result",
6386 "windows-strings",
6387 "windows-targets 0.52.6",
6388]
6389
6390[[package]]
6391name = "windows-implement"
6392version = "0.58.0"
6393source = "registry+https://github.com/rust-lang/crates.io-index"
6394checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b"
6395dependencies = [
6396 "proc-macro2",
6397 "quote",
6398 "syn 2.0.90",
6399]
6400
6401[[package]]
6402name = "windows-interface"
6403version = "0.58.0"
6404source = "registry+https://github.com/rust-lang/crates.io-index"
6405checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515"
6406dependencies = [
6407 "proc-macro2",
6408 "quote",
6409 "syn 2.0.90",
6410]
6411
6364[[package]] 6412[[package]]
6365name = "windows-registry" 6413name = "windows-registry"
6366version = "0.2.0" 6414version = "0.2.0"
Cargo.toml +9 −7
@@ -37,7 +37,7 @@ emojis = "0.5"
37futures = "0.3" 37futures = "0.3"
38gethostname = "0.4.1" 38gethostname = "0.4.1"
39html5ever = "0.26.0" 39html5ever = "0.26.0"
40image = "0.25.2" 40image = "^0.25.6"
41libc = "0.2" 41libc = "0.2"
42markup5ever_rcdom = "0.2.0" 42markup5ever_rcdom = "0.2.0"
43mime = "^0.3.16" 43mime = "^0.3.16"
@@ -45,8 +45,8 @@ mime_guess = "^2.0.4"
45nom = "7.0.0" 45nom = "7.0.0"
46open = "3.2.0" 46open = "3.2.0"
47rand = "0.8.5" 47rand = "0.8.5"
48ratatui = "0.28.1" 48ratatui = "0.29.0"
49ratatui-image = { version = "=1.0.5", features = ["serde"] } 49ratatui-image = { version = "~6.0.0", features = ["serde"] }
50regex = "^1.5" 50regex = "^1.5"
51rpassword = "^7.2" 51rpassword = "^7.2"
52serde = "^1.0" 52serde = "^1.0"
@@ -76,13 +76,15 @@ features = ["zbus", "serde"]
76optional = true 76optional = true
77 77
78[dependencies.modalkit] 78[dependencies.modalkit]
79version = "0.0.21"
79default-features = false 80default-features = false
80git = "https://github.com/ulyssa/modalkit" 81#git = "https://github.com/ulyssa/modalkit"
81rev = "45855daeeb7081eec626a8f9cf657f0fc2ff0a7a" 82#rev = "e40dbb0bfeabe4cfd08facd2acb446080a330d75"
82 83
83[dependencies.modalkit-ratatui] 84[dependencies.modalkit-ratatui]
84git = "https://github.com/ulyssa/modalkit" 85version = "0.0.21"
85rev = "45855daeeb7081eec626a8f9cf657f0fc2ff0a7a" 86#git = "https://github.com/ulyssa/modalkit"
87#rev = "e40dbb0bfeabe4cfd08facd2acb446080a330d75"
86 88
87[dependencies.matrix-sdk] 89[dependencies.matrix-sdk]
88version = "0.10.0" 90version = "0.10.0"
src/base.rs +4 −8
@@ -1319,7 +1319,7 @@ fn emoji_map() -> CompletionMap<String, &'static Emoji> {
1319 1319
1320#[cfg(unix)] 1320#[cfg(unix)]
1321fn picker_from_termios(protocol_type: Option<ProtocolType>) -> Option<Picker> { 1321fn picker_from_termios(protocol_type: Option<ProtocolType>) -> Option<Picker> {
1322 let mut picker = match Picker::from_termios() { 1322 let mut picker = match Picker::from_query_stdio() {
1323 Ok(picker) => picker, 1323 Ok(picker) => picker,
1324 Err(e) => { 1324 Err(e) => {
1325 tracing::error!("Failed to setup image previews: {e}"); 1325 tracing::error!("Failed to setup image previews: {e}");
@@ -1327,12 +1327,8 @@ fn picker_from_termios(protocol_type: Option<ProtocolType>) -> Option<Picker> {
1327 }, 1327 },
1328 }; 1328 };
1329 1329
1330 // `guess_protocol` also does tmux detection,
1331 // run it always then overwrite the guessed protocol if needed
1332 picker.guess_protocol();
1333
1334 if let Some(protocol_type) = protocol_type { 1330 if let Some(protocol_type) = protocol_type {
1335 picker.protocol_type = protocol_type; 1331 picker.set_protocol_type(protocol_type);
1336 } 1332 }
1337 1333
1338 Some(picker) 1334 Some(picker)
@@ -1355,8 +1351,8 @@ fn picker_from_settings(settings: &ApplicationSettings) -> Option<Picker> {
1355 }) = image_preview_protocol 1351 }) = image_preview_protocol
1356 { 1352 {
1357 // User forced type and font_size: use that. 1353 // User forced type and font_size: use that.
1358 let mut picker = Picker::new(font_size); 1354 let mut picker = Picker::from_fontsize(font_size);
1359 picker.protocol_type = protocol_type; 1355 picker.set_protocol_type(protocol_type);
1360 Some(picker) 1356 Some(picker)
1361 } else { 1357 } else {
1362 // Guess, but use type if forced. 1358 // Guess, but use type if forced.
src/message/mod.rs +5 −5
@@ -70,7 +70,7 @@ mod printer;
70 70
71pub use self::compose::text_to_message; 71pub use self::compose::text_to_message;
72 72
73type ProtocolPreview<'a> = (&'a dyn Protocol, u16, u16); 73type ProtocolPreview<'a> = (&'a Protocol, u16, u16);
74 74
75pub type MessageKey = (MessageTimeStamp, OwnedEventId); 75pub type MessageKey = (MessageTimeStamp, OwnedEventId);
76 76
@@ -826,7 +826,7 @@ impl<'a> MessageFormatter<'a> {
826pub enum ImageStatus { 826pub enum ImageStatus {
827 None, 827 None,
828 Downloading(ImagePreviewSize), 828 Downloading(ImagePreviewSize),
829 Loaded(Box<dyn Protocol>), 829 Loaded(Protocol),
830 Error(String), 830 Error(String),
831} 831}
832 832
@@ -1046,7 +1046,7 @@ impl Message {
1046 style: Style, 1046 style: Style,
1047 hide_reply: bool, 1047 hide_reply: bool,
1048 emoji_shortcodes: bool, 1048 emoji_shortcodes: bool,
1049 ) -> (Text, Option<&dyn Protocol>) { 1049 ) -> (Text, Option<&Protocol>) {
1050 if let Some(html) = &self.html { 1050 if let Some(html) = &self.html {
1051 (html.to_text(width, style, hide_reply, emoji_shortcodes), None) 1051 (html.to_text(width, style, hide_reply, emoji_shortcodes), None)
1052 } else { 1052 } else {
@@ -1066,8 +1066,8 @@ impl Message {
1066 placeholder_frame(Some("Downloading..."), width, image_preview_size) 1066 placeholder_frame(Some("Downloading..."), width, image_preview_size)
1067 }, 1067 },
1068 ImageStatus::Loaded(backend) => { 1068 ImageStatus::Loaded(backend) => {
1069 proto = Some(backend.as_ref()); 1069 proto = Some(backend);
1070 placeholder_frame(Some("Loading..."), width, &backend.rect().into()) 1070 placeholder_frame(Some("Loading..."), width, &backend.area().into())
1071 }, 1071 },
1072 ImageStatus::Error(err) => Some(format!("[Image error: {err}]\n")), 1072 ImageStatus::Error(err) => Some(format!("[Image error: {err}]\n")),
1073 }; 1073 };
src/windows/room/scrollback.rs +1 −1
@@ -1402,7 +1402,7 @@ impl<'a> StatefulWidget for Scrollback<'a> {
1402 // line. 1402 // line.
1403 for (x, y, backend) in image_previews { 1403 for (x, y, backend) in image_previews {
1404 let image_widget = Image::new(backend); 1404 let image_widget = Image::new(backend);
1405 let mut rect = backend.rect(); 1405 let mut rect = backend.area();
1406 rect.x = x; 1406 rect.x = x;
1407 rect.y = y; 1407 rect.y = y;
1408 // Don't render outside of scrollback area 1408 // Don't render outside of scrollback area