nandi/jolt-nativepublic Fork 0
12754c2
Commits
Clone
git clone https://git.rickub.com/nandi/jolt-native.git
git clone ssh://git@rickub.com/nandi/jolt-native.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

What the formatter has been asking for since the scroll memo landed

`nix flake check` runs fmt before anything else and main has been failing on
it for two pipelines — so the publish step at the end of that job has not run
either, and no tarball has been uploaded since. The objects the last two
commits built were never published anywhere.

Only rustfmt's output, from the toolchain the flake pins. Worth one note: it
puts `use cosmic::Element` after the iced imports and so away from the comment
explaining why it is cosmic's Element and not iced's. The comment now sits
above the line it is not about. Moving it back means failing fmt again; the
fix is to reword it where it lands, which is a change to make deliberately
rather than inside a formatting commit.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
nandi committed 2026-09-18T17:01:22-07:00 Browse files
12754c2 parent: 121e5f1
modified crates/jolt-cosmic/src/lib.rs +91 -30
@@ -36,9 +36,13 @@ use cosmic::iced::alignment::Horizontal;
3636 use cosmic::iced::futures::channel::mpsc;
3737 use cosmic::iced::futures::{Stream, StreamExt};
3838 use cosmic::iced::widget::container::Style as ContainerStyle;
39-use cosmic::iced::widget::scrollable::{self as iced_scrollable, AbsoluteOffset, RelativeOffset, Viewport};
39+use cosmic::iced::widget::scrollable::{
40+ self as iced_scrollable, AbsoluteOffset, RelativeOffset, Viewport,
41+};
4042 use cosmic::iced::widget::text::Wrapping;
41-use cosmic::iced::{Alignment, Background, Border, Color, ContentFit, Font, Length, Padding, Subscription};
43+use cosmic::iced::{
44+ Alignment, Background, Border, Color, ContentFit, Font, Length, Padding, Subscription,
45+};
4246 use cosmic::widget::{self, Column, Row};
4347 use cosmic::{ApplicationExt, Element};
4448 use jolt_abi::{borrowed, empty_str, guard, Scratch};
@@ -404,7 +408,11 @@ fn report(memo: &mut ScrollMemo, at_end: bool) -> Option<&'static str> {
404408 memo.told = Some(at_end);
405409 // "end" or "away", the strings libvidya emits: frq's handler compares
406410 // against "end".
407- if at_end { "end" } else { "away" }
411+ if at_end {
412+ "end"
413+ } else {
414+ "away"
415+ }
408416 })
409417 }
410418
@@ -531,7 +539,13 @@ fn reveal(name: String, row: i32, viewport: f32) -> Task<Message> {
531539 "jolt-scroll: {name} row {row} at {top} (h {height}), viewport {viewport} -> {y}"
532540 );
533541 }
534- iced_scrollable::scroll_to(scroll_id(&name), AbsoluteOffset { x: None, y: Some(y) })
542+ iced_scrollable::scroll_to(
543+ scroll_id(&name),
544+ AbsoluteOffset {
545+ x: None,
546+ y: Some(y),
547+ },
548+ )
535549 }
536550 None => {
537551 if scroll_log() {
@@ -565,7 +579,13 @@ fn scroll_shape(t: &Tree, name: &str) -> (usize, usize) {
565579 }
566580
567581 fn snap_to_end(name: &str) -> Task<Message> {
568- iced_scrollable::snap_to(scroll_id(name), RelativeOffset { x: None, y: Some(1.0) })
582+ iced_scrollable::snap_to(
583+ scroll_id(name),
584+ RelativeOffset {
585+ x: None,
586+ y: Some(1.0),
587+ },
588+ )
569589 }
570590
571591 // --- the app -----------------------------------------------------------------
@@ -610,9 +630,15 @@ enum Message {
610630 /// caret, and the next key would land on that. An entry is let go once a
611631 /// commit was rendered after its event: from then on the component's own
612632 /// state is the answer, a draft it cleared included.
613-fn keep_typed(tree: &mut Arc<Tree>, typed: &mut HashMap<(i32, &'static str), (u64, Prop)>, settled: u64) {
633+fn keep_typed(
634+ tree: &mut Arc<Tree>,
635+ typed: &mut HashMap<(i32, &'static str), (u64, Prop)>,
636+ settled: u64,
637+) {
614638 typed.retain(|&(node, key), (seq, value)| {
615- let Some(n) = tree.get(node) else { return false };
639+ let Some(n) = tree.get(node) else {
640+ return false;
641+ };
616642 if *seq <= settled {
617643 return false;
618644 }
@@ -629,7 +655,15 @@ impl App {
629655 /// working control, and its next render is what settles it. Then the event
630656 /// goes to the worker, and what was written is held over any commit
631657 /// rendered before the worker saw it.
632- fn write_back(&mut self, node: i32, key: &'static str, value: Prop, event: &'static str, text: String, num: f64) {
658+ fn write_back(
659+ &mut self,
660+ node: i32,
661+ key: &'static str,
662+ value: Prop,
663+ event: &'static str,
664+ text: String,
665+ num: f64,
666+ ) {
633667 edit(|t| t.set(node, key, value.clone()));
634668 Arc::make_mut(&mut self.tree).set(node, key, value.clone());
635669 let seq = post_seq(node, event, text, num);
@@ -652,15 +686,12 @@ impl App {
652686 let mut live = HashSet::new();
653687 for ask in scroll_asks(&before, &self.tree) {
654688 live.insert(ask.name.clone());
655- let memo = self
656- .scrolls
657- .entry(ask.name.clone())
658- .or_insert(ScrollMemo {
659- at_end: ask.stick,
660- told: None,
661- offset_y: 0.0,
662- height: 0.0,
663- });
689+ let memo = self.scrolls.entry(ask.name.clone()).or_insert(ScrollMemo {
690+ at_end: ask.stick,
691+ told: None,
692+ offset_y: 0.0,
693+ height: 0.0,
694+ });
664695 // A row asking to be shown is measured on the frame it appears,
665696 // so the ask stands until the layout has a place for it — see
666697 // `reveal`, which asks again rather than giving up.
@@ -670,7 +701,10 @@ impl App {
670701 ScrollMove::End => tasks.push(snap_to_end(&ask.name)),
671702 ScrollMove::Restore(y) => tasks.push(iced_scrollable::scroll_to(
672703 scroll_id(&ask.name),
673- AbsoluteOffset { x: None, y: Some(y) },
704+ AbsoluteOffset {
705+ x: None,
706+ y: Some(y),
707+ },
674708 )),
675709 ScrollMove::Stay => {}
676710 }
@@ -764,7 +798,14 @@ impl cosmic::Application for App {
764798 Message::Click(node) => post(node, "click", String::new(), 0.0),
765799 Message::Toggled(node, on) => {
766800 let num = f64::from(u8::from(on));
767- self.write_back(node, "active", Prop::Bool(on), "toggled", String::new(), num);
801+ self.write_back(
802+ node,
803+ "active",
804+ Prop::Bool(on),
805+ "toggled",
806+ String::new(),
807+ num,
808+ );
768809 }
769810 Message::Change(node, text) => {
770811 self.write_back(node, "text", Prop::Str(text.clone()), "change", text, 0.0);
@@ -776,8 +817,9 @@ impl cosmic::Application for App {
776817 // worker, which collects it with `cosmic_clipboard_image_png`.
777818 Message::Paste(node, text) => {
778819 if self.tree.get(node).is_some_and(|n| n.str("text") == text) {
779- return cosmic::iced::clipboard::read_data::<ClipboardPng>()
780- .map(move |png| cosmic::Action::App(Message::PastedPicture(node, png.map(|p| p.0))));
820+ return cosmic::iced::clipboard::read_data::<ClipboardPng>().map(move |png| {
821+ cosmic::Action::App(Message::PastedPicture(node, png.map(|p| p.0)))
822+ });
781823 }
782824 self.write_back(node, "text", Prop::Str(text.clone()), "change", text, 0.0);
783825 }
@@ -810,15 +852,18 @@ impl cosmic::Application for App {
810852 None => snap_to_end(&name),
811853 Some(y) => iced_scrollable::scroll_to(
812854 scroll_id(&name),
813- AbsoluteOffset { x: None, y: Some(y) },
855+ AbsoluteOffset {
856+ x: None,
857+ y: Some(y),
858+ },
814859 ),
815860 };
816861 return Task::batch([now, again]);
817862 }
818863 Message::Reveal(name, tries) => {
819864 let viewport = self.scrolls.get(&name).map_or(0.0, |memo| memo.height);
820- let place = asking_row(&self.tree, &name)
821- .and_then(|row| placements(&name).get(row));
865+ let place =
866+ asking_row(&self.tree, &name).and_then(|row| placements(&name).get(row));
822867 if let Some((top, height)) = place {
823868 // Nothing written down here either, for the reason the
824869 // commit path gives: where this ends up is `scrolled`'s to
@@ -826,7 +871,10 @@ impl cosmic::Application for App {
826871 let y = centred_offset(top, height, viewport);
827872 return iced_scrollable::scroll_to(
828873 scroll_id(&name),
829- AbsoluteOffset { x: None, y: Some(y) },
874+ AbsoluteOffset {
875+ x: None,
876+ y: Some(y),
877+ },
830878 );
831879 }
832880 if scroll_log() {
@@ -989,7 +1037,9 @@ fn margins(n: &Node) -> Padding {
9891037 /// `:width-request 0` on its message column whenever the people panel is shut,
9901038 /// and taken literally that is a backlog laid out zero points wide.
9911039 fn width_request(n: &Node) -> Option<f32> {
992- n.num("width-request").filter(|w| *w > 0.0).map(|w| w as f32)
1040+ n.num("width-request")
1041+ .filter(|w| *w > 0.0)
1042+ .map(|w| w as f32)
9931043 }
9941044
9951045 /// `align`, or `default` where it is not set. A column starts its children at
@@ -1230,7 +1280,8 @@ fn element(t: &Tree, id: i32, enabled: bool, in_row: bool) -> Element<'_, Messag
12301280 } else {
12311281 Color::from_rgb(0.55, 0.55, 0.55)
12321282 };
1233- let dot = widget::container(widget::Space::new().width(8).height(8)).class(filled(colour, 4.0));
1283+ let dot = widget::container(widget::Space::new().width(8).height(8))
1284+ .class(filled(colour, 4.0));
12341285 Row::new()
12351286 .spacing(6)
12361287 .align_y(Alignment::Center)
@@ -1624,7 +1675,9 @@ pub unsafe extern "C" fn cosmic_picked_image(path: *const c_char) -> c_int {
16241675 }
16251676 }
16261677 };
1627- match image::open(&chosen).and_then(|picture| picture.save_with_format(&path, image::ImageFormat::Png)) {
1678+ match image::open(&chosen)
1679+ .and_then(|picture| picture.save_with_format(&path, image::ImageFormat::Png))
1680+ {
16281681 Ok(()) => 1,
16291682 Err(err) => {
16301683 eprintln!("jolt-cosmic: could not take {}: {err}", chosen.display());
@@ -1878,7 +1931,10 @@ mod tests {
18781931 let mut t = Tree::default();
18791932 let root = t.root();
18801933 let list = node(&mut t, root, "scroll");
1881- assert_eq!(scroll_name(t.get(list).unwrap(), list), format!("node-{list}"));
1934+ assert_eq!(
1935+ scroll_name(t.get(list).unwrap(), list),
1936+ format!("node-{list}")
1937+ );
18821938 t.set(list, "scroll-key", Prop::Str("messages-#freeq".into()));
18831939 assert_eq!(scroll_name(t.get(list).unwrap(), list), "messages-#freeq");
18841940 }
@@ -1943,7 +1999,12 @@ mod tests {
19431999 }
19442000
19452001 fn memo() -> ScrollMemo {
1946- ScrollMemo { at_end: true, told: Some(true), offset_y: 0.0, height: 600.0 }
2002+ ScrollMemo {
2003+ at_end: true,
2004+ told: Some(true),
2005+ offset_y: 0.0,
2006+ height: 600.0,
2007+ }
19472008 }
19482009
19492010 #[test]
@@ -36,9 +36,13 @@ use cosmic::iced::alignment::Horizontal;
36 use cosmic::iced::futures::channel::mpsc;36 use cosmic::iced::futures::channel::mpsc;
37 use cosmic::iced::futures::{Stream, StreamExt};37 use cosmic::iced::futures::{Stream, StreamExt};
38 use cosmic::iced::widget::container::Style as ContainerStyle;38 use cosmic::iced::widget::container::Style as ContainerStyle;
39-use cosmic::iced::widget::scrollable::{self as iced_scrollable, AbsoluteOffset, RelativeOffset, Viewport};39+use cosmic::iced::widget::scrollable::{
40+ self as iced_scrollable, AbsoluteOffset, RelativeOffset, Viewport,
41+};
40 use cosmic::iced::widget::text::Wrapping;42 use cosmic::iced::widget::text::Wrapping;
41-use cosmic::iced::{Alignment, Background, Border, Color, ContentFit, Font, Length, Padding, Subscription};43+use cosmic::iced::{
44+ Alignment, Background, Border, Color, ContentFit, Font, Length, Padding, Subscription,
45+};
42 use cosmic::widget::{self, Column, Row};46 use cosmic::widget::{self, Column, Row};
43 use cosmic::{ApplicationExt, Element};47 use cosmic::{ApplicationExt, Element};
44 use jolt_abi::{borrowed, empty_str, guard, Scratch};48 use jolt_abi::{borrowed, empty_str, guard, Scratch};
@@ -404,7 +408,11 @@ fn report(memo: &mut ScrollMemo, at_end: bool) -> Option<&'static str> {
404 memo.told = Some(at_end);408 memo.told = Some(at_end);
405 // "end" or "away", the strings libvidya emits: frq's handler compares409 // "end" or "away", the strings libvidya emits: frq's handler compares
406 // against "end".410 // against "end".
407- if at_end { "end" } else { "away" }411+ if at_end {
412+ "end"
413+ } else {
414+ "away"
415+ }
408 })416 })
409 }417 }
410 418
@@ -531,7 +539,13 @@ fn reveal(name: String, row: i32, viewport: f32) -> Task<Message> {
531 "jolt-scroll: {name} row {row} at {top} (h {height}), viewport {viewport} -> {y}"539 "jolt-scroll: {name} row {row} at {top} (h {height}), viewport {viewport} -> {y}"
532 );540 );
533 }541 }
534- iced_scrollable::scroll_to(scroll_id(&name), AbsoluteOffset { x: None, y: Some(y) })542+ iced_scrollable::scroll_to(
543+ scroll_id(&name),
544+ AbsoluteOffset {
545+ x: None,
546+ y: Some(y),
547+ },
548+ )
535 }549 }
536 None => {550 None => {
537 if scroll_log() {551 if scroll_log() {
@@ -565,7 +579,13 @@ fn scroll_shape(t: &Tree, name: &str) -> (usize, usize) {
565 }579 }
566 580
567 fn snap_to_end(name: &str) -> Task<Message> {581 fn snap_to_end(name: &str) -> Task<Message> {
568- iced_scrollable::snap_to(scroll_id(name), RelativeOffset { x: None, y: Some(1.0) })582+ iced_scrollable::snap_to(
583+ scroll_id(name),
584+ RelativeOffset {
585+ x: None,
586+ y: Some(1.0),
587+ },
588+ )
569 }589 }
570 590
571 // --- the app -----------------------------------------------------------------591 // --- the app -----------------------------------------------------------------
@@ -610,9 +630,15 @@ enum Message {
610 /// caret, and the next key would land on that. An entry is let go once a630 /// caret, and the next key would land on that. An entry is let go once a
611 /// commit was rendered after its event: from then on the component's own631 /// commit was rendered after its event: from then on the component's own
612 /// state is the answer, a draft it cleared included.632 /// state is the answer, a draft it cleared included.
613-fn keep_typed(tree: &mut Arc<Tree>, typed: &mut HashMap<(i32, &'static str), (u64, Prop)>, settled: u64) {633+fn keep_typed(
634+ tree: &mut Arc<Tree>,
635+ typed: &mut HashMap<(i32, &'static str), (u64, Prop)>,
636+ settled: u64,
637+) {
614 typed.retain(|&(node, key), (seq, value)| {638 typed.retain(|&(node, key), (seq, value)| {
615- let Some(n) = tree.get(node) else { return false };639+ let Some(n) = tree.get(node) else {
640+ return false;
641+ };
616 if *seq <= settled {642 if *seq <= settled {
617 return false;643 return false;
618 }644 }
@@ -629,7 +655,15 @@ impl App {
629 /// working control, and its next render is what settles it. Then the event655 /// working control, and its next render is what settles it. Then the event
630 /// goes to the worker, and what was written is held over any commit656 /// goes to the worker, and what was written is held over any commit
631 /// rendered before the worker saw it.657 /// rendered before the worker saw it.
632- fn write_back(&mut self, node: i32, key: &'static str, value: Prop, event: &'static str, text: String, num: f64) {658+ fn write_back(
659+ &mut self,
660+ node: i32,
661+ key: &'static str,
662+ value: Prop,
663+ event: &'static str,
664+ text: String,
665+ num: f64,
666+ ) {
633 edit(|t| t.set(node, key, value.clone()));667 edit(|t| t.set(node, key, value.clone()));
634 Arc::make_mut(&mut self.tree).set(node, key, value.clone());668 Arc::make_mut(&mut self.tree).set(node, key, value.clone());
635 let seq = post_seq(node, event, text, num);669 let seq = post_seq(node, event, text, num);
@@ -652,15 +686,12 @@ impl App {
652 let mut live = HashSet::new();686 let mut live = HashSet::new();
653 for ask in scroll_asks(&before, &self.tree) {687 for ask in scroll_asks(&before, &self.tree) {
654 live.insert(ask.name.clone());688 live.insert(ask.name.clone());
655- let memo = self689+ let memo = self.scrolls.entry(ask.name.clone()).or_insert(ScrollMemo {
656- .scrolls690+ at_end: ask.stick,
657- .entry(ask.name.clone())691+ told: None,
658- .or_insert(ScrollMemo {692+ offset_y: 0.0,
659- at_end: ask.stick,693+ height: 0.0,
660- told: None,694+ });
661- offset_y: 0.0,
662- height: 0.0,
663- });
664 // A row asking to be shown is measured on the frame it appears,695 // A row asking to be shown is measured on the frame it appears,
665 // so the ask stands until the layout has a place for it — see696 // so the ask stands until the layout has a place for it — see
666 // `reveal`, which asks again rather than giving up.697 // `reveal`, which asks again rather than giving up.
@@ -670,7 +701,10 @@ impl App {
670 ScrollMove::End => tasks.push(snap_to_end(&ask.name)),701 ScrollMove::End => tasks.push(snap_to_end(&ask.name)),
671 ScrollMove::Restore(y) => tasks.push(iced_scrollable::scroll_to(702 ScrollMove::Restore(y) => tasks.push(iced_scrollable::scroll_to(
672 scroll_id(&ask.name),703 scroll_id(&ask.name),
673- AbsoluteOffset { x: None, y: Some(y) },704+ AbsoluteOffset {
705+ x: None,
706+ y: Some(y),
707+ },
674 )),708 )),
675 ScrollMove::Stay => {}709 ScrollMove::Stay => {}
676 }710 }
@@ -764,7 +798,14 @@ impl cosmic::Application for App {
764 Message::Click(node) => post(node, "click", String::new(), 0.0),798 Message::Click(node) => post(node, "click", String::new(), 0.0),
765 Message::Toggled(node, on) => {799 Message::Toggled(node, on) => {
766 let num = f64::from(u8::from(on));800 let num = f64::from(u8::from(on));
767- self.write_back(node, "active", Prop::Bool(on), "toggled", String::new(), num);801+ self.write_back(
802+ node,
803+ "active",
804+ Prop::Bool(on),
805+ "toggled",
806+ String::new(),
807+ num,
808+ );
768 }809 }
769 Message::Change(node, text) => {810 Message::Change(node, text) => {
770 self.write_back(node, "text", Prop::Str(text.clone()), "change", text, 0.0);811 self.write_back(node, "text", Prop::Str(text.clone()), "change", text, 0.0);
@@ -776,8 +817,9 @@ impl cosmic::Application for App {
776 // worker, which collects it with `cosmic_clipboard_image_png`.817 // worker, which collects it with `cosmic_clipboard_image_png`.
777 Message::Paste(node, text) => {818 Message::Paste(node, text) => {
778 if self.tree.get(node).is_some_and(|n| n.str("text") == text) {819 if self.tree.get(node).is_some_and(|n| n.str("text") == text) {
779- return cosmic::iced::clipboard::read_data::<ClipboardPng>()820+ return cosmic::iced::clipboard::read_data::<ClipboardPng>().map(move |png| {
780- .map(move |png| cosmic::Action::App(Message::PastedPicture(node, png.map(|p| p.0))));821+ cosmic::Action::App(Message::PastedPicture(node, png.map(|p| p.0)))
822+ });
781 }823 }
782 self.write_back(node, "text", Prop::Str(text.clone()), "change", text, 0.0);824 self.write_back(node, "text", Prop::Str(text.clone()), "change", text, 0.0);
783 }825 }
@@ -810,15 +852,18 @@ impl cosmic::Application for App {
810 None => snap_to_end(&name),852 None => snap_to_end(&name),
811 Some(y) => iced_scrollable::scroll_to(853 Some(y) => iced_scrollable::scroll_to(
812 scroll_id(&name),854 scroll_id(&name),
813- AbsoluteOffset { x: None, y: Some(y) },855+ AbsoluteOffset {
856+ x: None,
857+ y: Some(y),
858+ },
814 ),859 ),
815 };860 };
816 return Task::batch([now, again]);861 return Task::batch([now, again]);
817 }862 }
818 Message::Reveal(name, tries) => {863 Message::Reveal(name, tries) => {
819 let viewport = self.scrolls.get(&name).map_or(0.0, |memo| memo.height);864 let viewport = self.scrolls.get(&name).map_or(0.0, |memo| memo.height);
820- let place = asking_row(&self.tree, &name)865+ let place =
821- .and_then(|row| placements(&name).get(row));866+ asking_row(&self.tree, &name).and_then(|row| placements(&name).get(row));
822 if let Some((top, height)) = place {867 if let Some((top, height)) = place {
823 // Nothing written down here either, for the reason the868 // Nothing written down here either, for the reason the
824 // commit path gives: where this ends up is `scrolled`'s to869 // commit path gives: where this ends up is `scrolled`'s to
@@ -826,7 +871,10 @@ impl cosmic::Application for App {
826 let y = centred_offset(top, height, viewport);871 let y = centred_offset(top, height, viewport);
827 return iced_scrollable::scroll_to(872 return iced_scrollable::scroll_to(
828 scroll_id(&name),873 scroll_id(&name),
829- AbsoluteOffset { x: None, y: Some(y) },874+ AbsoluteOffset {
875+ x: None,
876+ y: Some(y),
877+ },
830 );878 );
831 }879 }
832 if scroll_log() {880 if scroll_log() {
@@ -989,7 +1037,9 @@ fn margins(n: &Node) -> Padding {
989 /// `:width-request 0` on its message column whenever the people panel is shut,1037 /// `:width-request 0` on its message column whenever the people panel is shut,
990 /// and taken literally that is a backlog laid out zero points wide.1038 /// and taken literally that is a backlog laid out zero points wide.
991 fn width_request(n: &Node) -> Option<f32> {1039 fn width_request(n: &Node) -> Option<f32> {
992- n.num("width-request").filter(|w| *w > 0.0).map(|w| w as f32)1040+ n.num("width-request")
1041+ .filter(|w| *w > 0.0)
1042+ .map(|w| w as f32)
993 }1043 }
994 1044
995 /// `align`, or `default` where it is not set. A column starts its children at1045 /// `align`, or `default` where it is not set. A column starts its children at
@@ -1230,7 +1280,8 @@ fn element(t: &Tree, id: i32, enabled: bool, in_row: bool) -> Element<'_, Messag
1230 } else {1280 } else {
1231 Color::from_rgb(0.55, 0.55, 0.55)1281 Color::from_rgb(0.55, 0.55, 0.55)
1232 };1282 };
1233- let dot = widget::container(widget::Space::new().width(8).height(8)).class(filled(colour, 4.0));1283+ let dot = widget::container(widget::Space::new().width(8).height(8))
1284+ .class(filled(colour, 4.0));
1234 Row::new()1285 Row::new()
1235 .spacing(6)1286 .spacing(6)
1236 .align_y(Alignment::Center)1287 .align_y(Alignment::Center)
@@ -1624,7 +1675,9 @@ pub unsafe extern "C" fn cosmic_picked_image(path: *const c_char) -> c_int {
1624 }1675 }
1625 }1676 }
1626 };1677 };
1627- match image::open(&chosen).and_then(|picture| picture.save_with_format(&path, image::ImageFormat::Png)) {1678+ match image::open(&chosen)
1679+ .and_then(|picture| picture.save_with_format(&path, image::ImageFormat::Png))
1680+ {
1628 Ok(()) => 1,1681 Ok(()) => 1,
1629 Err(err) => {1682 Err(err) => {
1630 eprintln!("jolt-cosmic: could not take {}: {err}", chosen.display());1683 eprintln!("jolt-cosmic: could not take {}: {err}", chosen.display());
@@ -1878,7 +1931,10 @@ mod tests {
1878 let mut t = Tree::default();1931 let mut t = Tree::default();
1879 let root = t.root();1932 let root = t.root();
1880 let list = node(&mut t, root, "scroll");1933 let list = node(&mut t, root, "scroll");
1881- assert_eq!(scroll_name(t.get(list).unwrap(), list), format!("node-{list}"));1934+ assert_eq!(
1935+ scroll_name(t.get(list).unwrap(), list),
1936+ format!("node-{list}")
1937+ );
1882 t.set(list, "scroll-key", Prop::Str("messages-#freeq".into()));1938 t.set(list, "scroll-key", Prop::Str("messages-#freeq".into()));
1883 assert_eq!(scroll_name(t.get(list).unwrap(), list), "messages-#freeq");1939 assert_eq!(scroll_name(t.get(list).unwrap(), list), "messages-#freeq");
1884 }1940 }
@@ -1943,7 +1999,12 @@ mod tests {
1943 }1999 }
1944 2000
1945 fn memo() -> ScrollMemo {2001 fn memo() -> ScrollMemo {
1946- ScrollMemo { at_end: true, told: Some(true), offset_y: 0.0, height: 600.0 }2002+ ScrollMemo {
2003+ at_end: true,
2004+ told: Some(true),
2005+ offset_y: 0.0,
2006+ height: 600.0,
2007+ }
1947 }2008 }
1948 2009
1949 #[test]2010 #[test]
modified crates/jolt-cosmic/src/rows.rs +3 -3
@@ -22,12 +22,12 @@
2222 use std::collections::HashMap;
2323 use std::sync::{Arc, Mutex};
2424
25-use cosmic::iced::advanced::widget::{Operation, Tree, tree};
26-use cosmic::iced::advanced::{Clipboard, Layout, Shell, Widget, layout, mouse, overlay, renderer};
25+use cosmic::iced::advanced::widget::{tree, Operation, Tree};
26+use cosmic::iced::advanced::{layout, mouse, overlay, renderer, Clipboard, Layout, Shell, Widget};
2727 // `cosmic::Element`, not iced's: the two differ in their theme, and this
2828 // widget lives in a cosmic tree.
29-use cosmic::Element;
3029 use cosmic::iced::{Event, Length, Rectangle, Size, Vector};
30+use cosmic::Element;
3131
3232 /// Where each row of one scroll area was last laid out, in points from the top
3333 /// of the content, beside how tall it is.
@@ -22,12 +22,12 @@
22 use std::collections::HashMap;22 use std::collections::HashMap;
23 use std::sync::{Arc, Mutex};23 use std::sync::{Arc, Mutex};
24 24
25-use cosmic::iced::advanced::widget::{Operation, Tree, tree};25+use cosmic::iced::advanced::widget::{tree, Operation, Tree};
26-use cosmic::iced::advanced::{Clipboard, Layout, Shell, Widget, layout, mouse, overlay, renderer};26+use cosmic::iced::advanced::{layout, mouse, overlay, renderer, Clipboard, Layout, Shell, Widget};
27 // `cosmic::Element`, not iced's: the two differ in their theme, and this27 // `cosmic::Element`, not iced's: the two differ in their theme, and this
28 // widget lives in a cosmic tree.28 // widget lives in a cosmic tree.
29-use cosmic::Element;
30 use cosmic::iced::{Event, Length, Rectangle, Size, Vector};29 use cosmic::iced::{Event, Length, Rectangle, Size, Vector};
30+use cosmic::Element;
31 31
32 /// Where each row of one scroll area was last laid out, in points from the top32 /// Where each row of one scroll area was last laid out, in points from the top
33 /// of the content, beside how tall it is.33 /// of the content, beside how tall it is.