Skip to content

Commit 2c829ea

Browse files
tmmampagent
andauthored
fix(zbugs-rune): open an issue at once, without fading (#185)
Selecting an issue faded the last one's text out while the new one's faded in, and the list's highlight crossfaded beside it, for about 0.4 s: every Rune element fades in and out by default, and a press or key animates its commit. The issue pane now lands its changes at once (`El::instant_changes`), the highlight moves in the same frame, and the last issue stays until the next one's rows come, a frame later from the local store, rather than a frame of "Loading…" between. As zbugs-swift and zbugs-gpui do. Amp-Thread-ID: https://ampcode.com/threads/T-b98159d5-62b9-4743-85ee-2b18907aaa6a Co-authored-by: Amp <amp@ampcode.com>
1 parent 51c7d75 commit 2c829ea

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

‎apps/zbugs-rune/src/main.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -538,11 +538,10 @@ impl App {
538538
if self.selected.as_ref() == Some(&id) {
539539
return;
540540
}
541-
self.detail = None;
542-
self.detail_result = ResultType::Unknown;
541+
// The last issue and its comments stay until this one's rows come,
542+
// a frame later from the local store, rather than "Loading…" between.
543543
self.picker = None;
544544
self.editing_comment = None;
545-
self.comments.clear();
546545
self.comments_limit = COMMENTS_PAGE;
547546
self.comment = TextEdit::new("");
548547
self.watch_detail(&id);
@@ -687,6 +686,7 @@ impl App {
687686
};
688687
let id = issue.id.clone();
689688
tx.scroll_into_view(id.clone());
689+
tx.color_motion(rune::Spring::NONE);
690690
self.select(id);
691691
// Near the end of what's loaded: the next page.
692692
if let Some(i) = to {

‎apps/zbugs-rune/src/view.rs‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,11 @@ fn issue_row(s: &App, issue: &Issue, k: &Kit) -> El {
701701
.w_full()
702702
.px(12.0)
703703
.py(9.0)
704-
.on_press(move |s: &mut App| s.select(id.clone()))
704+
.on_press_tx(move |s: &mut App, tx| {
705+
// The highlight moves at once, with the issue beside it.
706+
tx.color_motion(rune::Spring::NONE);
707+
s.select(id.clone());
708+
})
705709
.child(text_col.w_full());
706710
if selected {
707711
r = r.fill(k.c.layer_02);
@@ -795,8 +799,11 @@ fn detail(s: &App, k: &Kit, layer: &mut Vec<El>) -> El {
795799
.build(k)
796800
.key("search"),
797801
);
802+
// Another issue lands at once, as in zbugs-swift and zbugs-gpui: without
803+
// this, Rune fades the last issue's text out while the new one fades in.
798804
let frame = col()
799805
.key("detail")
806+
.instant_changes()
800807
.grow(1.0)
801808
.h_full()
802809
.min_w(0.0)

0 commit comments

Comments
 (0)