@@ -363,6 +363,7 @@ use self::user_messages::PendingSteerCompareKey;
363363use self :: user_messages:: UserMessageDisplay ;
364364mod warnings;
365365use self :: warnings:: WarningDisplayState ;
366+ pub ( crate ) use crate :: branch_summary:: GitWorkspaceDiffStats ;
366367pub ( crate ) use crate :: branch_summary:: StatusLineGitSummary ;
367368use crate :: streaming:: chunking:: AdaptiveChunkingPolicy ;
368369use crate :: streaming:: commit_tick:: CommitTickScope ;
@@ -388,7 +389,8 @@ use unicode_segmentation::UnicodeSegmentation;
388389const USER_SHELL_COMMAND_HELP_TITLE : & str = "Prefix a command with ! to run it locally" ;
389390const USER_SHELL_COMMAND_HELP_HINT : & str = "Example: !ls" ;
390391const DEFAULT_OPENAI_BASE_URL : & str = "https://api.openai.com/v1" ;
391- const DEFAULT_STATUS_LINE_ITEMS : [ & str ; 2 ] = [ "model-with-reasoning" , "current-dir" ] ;
392+ const DEFAULT_STATUS_LINE_ITEMS : [ & str ; 3 ] =
393+ [ "model-with-reasoning" , "current-dir" , "workspace-changes" ] ;
392394// Track information about an in-flight exec command.
393395struct RunningCommand {
394396 command : Vec < String > ,
@@ -1012,6 +1014,14 @@ pub(crate) struct ChatWidget {
10121014 status_line_git_summary_pending : bool ,
10131015 // True once we've attempted a Git summary lookup for the current CWD.
10141016 status_line_git_summary_lookup_complete : bool ,
1017+ // Cached tracked workspace diff stats for the active status-line cwd.
1018+ status_line_workspace_changes : Option < GitWorkspaceDiffStats > ,
1019+ // CWD used to resolve the cached workspace diff stats; change resets workspace state.
1020+ status_line_workspace_changes_cwd : Option < PathBuf > ,
1021+ // True while an async workspace diff stats lookup is in flight.
1022+ status_line_workspace_changes_pending : bool ,
1023+ // True once we've attempted a workspace diff stats lookup for the current CWD.
1024+ status_line_workspace_changes_lookup_complete : bool ,
10151025 // Current thread-goal status shown in the status line when plan mode is inactive.
10161026 current_goal_status_indicator : Option < GoalStatusIndicator > ,
10171027 current_goal_status : Option < GoalStatusState > ,
@@ -2018,6 +2028,22 @@ impl ChatWidget {
20182028 self . refresh_status_surfaces ( ) ;
20192029 }
20202030
2031+ /// Stores async workspace diff stats for the current status-line cwd.
2032+ pub ( crate ) fn set_status_line_workspace_changes (
2033+ & mut self ,
2034+ cwd : PathBuf ,
2035+ stats : Option < GitWorkspaceDiffStats > ,
2036+ ) {
2037+ if self . status_line_workspace_changes_cwd . as_ref ( ) != Some ( & cwd) {
2038+ self . status_line_workspace_changes_pending = false ;
2039+ return ;
2040+ }
2041+ self . status_line_workspace_changes = stats;
2042+ self . status_line_workspace_changes_pending = false ;
2043+ self . status_line_workspace_changes_lookup_complete = true ;
2044+ self . refresh_status_surfaces ( ) ;
2045+ }
2046+
20212047 fn collect_runtime_metrics_delta ( & mut self ) {
20222048 if let Some ( delta) = self . session_telemetry . runtime_metrics_summary ( ) {
20232049 self . apply_runtime_metrics_delta ( delta) ;
@@ -2601,6 +2627,7 @@ impl ChatWidget {
26012627 self . had_work_activity = false ;
26022628 self . request_status_line_branch_refresh ( ) ;
26032629 self . request_status_line_git_summary_refresh ( ) ;
2630+ self . request_status_line_workspace_changes_refresh ( ) ;
26042631 }
26052632 // Mark task stopped and request redraw now that all content is in history.
26062633 self . pending_status_indicator_restore = false ;
@@ -3114,6 +3141,7 @@ impl ChatWidget {
31143141 self . pending_status_indicator_restore = false ;
31153142 self . request_status_line_branch_refresh ( ) ;
31163143 self . request_status_line_git_summary_refresh ( ) ;
3144+ self . request_status_line_workspace_changes_refresh ( ) ;
31173145 self . maybe_show_pending_rate_limit_prompt ( ) ;
31183146 }
31193147
@@ -5202,6 +5230,10 @@ impl ChatWidget {
52025230 status_line_git_summary_cwd : None ,
52035231 status_line_git_summary_pending : false ,
52045232 status_line_git_summary_lookup_complete : false ,
5233+ status_line_workspace_changes : None ,
5234+ status_line_workspace_changes_cwd : None ,
5235+ status_line_workspace_changes_pending : false ,
5236+ status_line_workspace_changes_lookup_complete : false ,
52055237 current_goal_status_indicator : None ,
52065238 current_goal_status : None ,
52075239 goal_status_active_turn_started_at : None ,
0 commit comments