fix(git): blink remote input carets

This commit is contained in:
Kayshen-X 2026-05-31 17:04:55 +08:00
parent 9ca7cace20
commit 2ab2105f9c
3 changed files with 26 additions and 1 deletions

View file

@ -176,7 +176,17 @@ impl GitPanel<'_> {
self.theme.muted_foreground,
);
} else {
let line = if focused {
// Blink the caret on the same 530 ms cadence as the commit
// box (shared `commit_caret_anchor_ms`), rather than a static
// `|`. The host wakes the loop while these inputs are focused
// so the toggle actually animates.
let caret = focused
&& jian_core::anim::blink_visible(
self.now_ms,
self.state.commit_caret_anchor_ms,
530,
);
let line = if caret {
format!("{shown}|")
} else {
shown.to_string()

View file

@ -718,6 +718,18 @@ impl WidgetHostNative {
530,
));
}
// Remote-settings inputs (remote URL + HTTPS username:token) share
// the same caret cadence; without this wake their caret stays
// static while focused.
if self.editor_state.editor_ui.git_panel.remote_focused
|| self.editor_state.editor_ui.git_panel.https_focused
{
return Some(jian_core::anim::next_blink_flip_ms(
self.now_ms,
self.editor_state.editor_ui.git_panel.commit_caret_anchor_ms,
530,
));
}
// Clone-wizard field caret, and while a `git clone` runs — keep
// the loop ticking so the caret blinks and `poll_git_clone_job`
// drains the worker's result on a later frame.

View file

@ -62,11 +62,14 @@ impl WidgetHostNative {
panel.remote_focused = true;
panel.commit_focused = false;
panel.https_focused = false;
// Seed the shared caret anchor so it starts solid, then blinks.
panel.commit_caret_anchor_ms = now;
}
Some(GitPanelHit::HttpsInput) => {
panel.https_focused = true;
panel.commit_focused = false;
panel.remote_focused = false;
panel.commit_caret_anchor_ms = now;
}
Some(GitPanelHit::SetRemote) => {
if !panel.remote_draft.trim().is_empty() {