(&mut self)
| 3073 | } |
| 3074 | |
| 3075 | fn sync_prompt_spinner_state(&mut self) -> bool { |
| 3076 | let before_active = self.prompt.spinner_active(); |
| 3077 | let before_kind = self.prompt.spinner_task_kind(); |
| 3078 | |
| 3079 | let Route::Session { session_id } = self.context.current_route() else { |
| 3080 | self.prompt.set_spinner_active(false); |
| 3081 | self.prompt.clear_interrupt_confirmation(); |
| 3082 | return before_active != self.prompt.spinner_active() |
| 3083 | || before_kind != self.prompt.spinner_task_kind(); |
| 3084 | }; |
| 3085 | |
| 3086 | let status = { |
| 3087 | let session_ctx = self.context.session.read(); |
| 3088 | session_ctx.status(&session_id).clone() |
| 3089 | }; |
| 3090 | let is_active = !matches!(status, SessionStatus::Idle); |
| 3091 | self.prompt.set_spinner_active(is_active); |
| 3092 | if !is_active { |
| 3093 | self.prompt.clear_interrupt_confirmation(); |
| 3094 | return before_active != self.prompt.spinner_active() |
| 3095 | || before_kind != self.prompt.spinner_task_kind(); |
| 3096 | } |
| 3097 | |
| 3098 | let task_kind = self.infer_spinner_task_kind(&session_id, &status); |
| 3099 | if self.prompt.spinner_task_kind() != task_kind { |
| 3100 | self.prompt.set_spinner_task_kind(task_kind); |
| 3101 | } |
| 3102 | |
| 3103 | before_active != self.prompt.spinner_active() |
| 3104 | || before_kind != self.prompt.spinner_task_kind() |
| 3105 | } |
| 3106 | |
| 3107 | fn infer_spinner_task_kind(&self, session_id: &str, status: &SessionStatus) -> TaskKind { |
| 3108 | if matches!(status, SessionStatus::Retrying { .. }) { |
no test coverage detected