# Expected Icon Behavior When Pressing 's' (Stage)
## Current Status
| `git.rs` | `.M` (unstaged only) | `○` |
| `state.rs` | `MM` (both staged and unstaged) | `●○` |
| `ACCURACY_VERIFICATION.md` | `?` (untracked) | ` ` (no icon) |
## Expected Behavior After Pressing 's'
### 1. `git.rs` (currently `.M` - unstaged only)
**What happens:**
- `git add src/commands/git.rs` stages ALL unstaged changes
- File becomes `M.` (staged only) - all changes are now staged
**Expected Icon:**
- **Immediately (optimistic):** `●○` (because code sets `staged=true`, preserves `unstaged=true`)
- **After refresh:** `●` (git reports `M.`, so `unstaged=false`)
**Why the temporary `●○`:**
- The optimistic update doesn't know if staging will result in all changes being staged
- It sets `staged=true` but preserves `unstaged=true` to be safe
- The async refresh corrects this based on actual git state
### 2. `state.rs` (currently `MM` - both staged and unstaged)
**What happens:**
- `git add src/app/state.rs` stages ALL unstaged changes
- If no new unstaged changes exist after staging: becomes `M.` (staged only)
- If new unstaged changes appear: remains `MM` (both staged and unstaged)
**Expected Icon:**
- **Immediately (optimistic):** `●○` (stays the same - already has both flags)
- **After refresh:**
- If all changes staged: `●` (git reports `M.`)
- If still has unstaged: `●○` (git reports `MM`)
**Note:** The refresh will show the correct state based on actual git status.
### 3. `ACCURACY_VERIFICATION.md` (currently untracked)
**What happens:**
- `git add ACCURACY_VERIFICATION.md` adds and stages the file
- File becomes `A.` (added, staged)
**Expected Icon:**
- **Immediately (optimistic):** `●` (code sets `staged=true`, `unstaged=false` for untracked)
- **After refresh:** `●` (git reports `A.`, stays staged)
## Summary Table
| `git.rs` | `○` (`.M`) | `●○` (temporary) | `●` (`M.`) |
| `state.rs` | `●○` (`MM`) | `●○` (same) | `●` (`M.`) or `●○` (`MM`) |
| `ACCURACY_VERIFICATION.md` | ` ` (`?`) | `●` (`A.`) | `●` (`A.`) |
## Key Points
1. **Optimistic updates are temporary** - they provide immediate feedback but may not be 100% accurate
2. **Async refresh corrects the state** - based on actual `git status` output
3. **`git add` stages ALL changes** - not just unstaged ones, so files typically become fully staged
4. **MM status can persist** - if new unstaged changes appear after staging
## Current Implementation
The code correctly:
- Sets `staged=true` optimistically
- Preserves `unstaged` state (doesn't assume it becomes false)
- Triggers refresh to get accurate git state
- Updates icons based on final state
This is the correct behavior - the temporary `●○` for `git.rs` is expected and will be corrected by the refresh.