eazygit 0.5.1

A fast TUI for Git with staging, conflicts, rebase, and palette-first UX
Documentation
use crate::git::StatusSummary;
use crate::config::ThemeConfig;
use std::collections::HashMap;
use super::types::*;

#[derive(Debug, Clone)]
pub struct AppState {
    pub running: bool, // whether the app should keep running
    pub theme: ThemeConfig, // Color theme configuration
    pub last_status: String, // last raw status output (placeholder)
    pub status_summary: StatusSummary,
    pub status_lines: Vec<String>,
    pub status_entries: Vec<crate::git::parsers::status::StatusEntry>,
    pub status_selected: usize,
    pub status_selected_path: String,
    pub last_diff_path: String,
    pub last_diff: String,
    pub last_diff_truncated: bool,
    pub last_diff_total: usize,
    pub last_diff_fetched_at: Option<String>,
    pub diff_mode: DiffMode,
    pub diff_parsed: crate::git::DiffParseResult,
    pub show_help: bool,
    pub repo_path: String,
    pub last_status_error: Option<String>,
    pub error_guidance: Option<crate::app::error_guidance::ErrorGuidance>,
    pub focus: FocusPane,
    pub key_help: Vec<KeyHelp>,
    pub last_refreshed: Option<String>,
    pub refreshing: bool,
    pub last_refresh_time: Option<std::time::Instant>,
    pub help_selected: usize, // which help item is highlighted when help is open
    pub detail_scroll: usize, // vertical scroll offset in detail pane
    pub detail_scroll_x: usize, // horizontal scroll offset in detail pane
    pub current_branch: String, // current git branch name
    // Multi-select for batch operations
    pub selected_files: std::collections::HashSet<String>,
    // Branch list
    pub branches: Vec<BranchEntry>,
    pub branch_selected: usize,
    // Commit log
    pub commits: Vec<CommitEntry>,
    pub commit_selected: usize,
    // Commit message input
    pub commit_input: String,
    pub commit_mode: bool, // true when in commit message input mode
    pub amend_mode: bool, // true when amending (vs. new commit)
    // Amend-specific fields
    pub amend_author_name: String,
    pub amend_author_email: String,
    pub last_commit_info: Option<LastCommitInfo>,
    pub amend_editing_field: Option<AmendField>, // Which field is being edited (if any)
    pub commit_template: Option<String>, // commit message template from config
    // Feedback message
    pub feedback_message: Option<String>,
    // Status filter
    pub status_filter: String,
    pub filter_mode: bool,
    // Per-file scroll offsets
    pub file_scrolls: HashMap<String, (usize, usize)>, // path -> (y, x)
    // Stash list
    pub stashes: Vec<StashEntry>,
    pub stash_selected: usize,
    // Branch create mode
    pub branch_create_mode: bool,
    pub branch_name_input: String,
    // Stash creation
    pub stash_create_mode: bool,
    pub stash_message_input: String,
    // Hunk navigation
    pub hunks: Vec<(usize, usize)>,
    pub hunk_selected: usize,
    // Word-diff mode
    pub word_diff: bool,
    // Line-level staging: selected line indices in current diff
    pub selected_lines: std::collections::HashSet<usize>,
    pub line_select_mode: bool,
    // Tags
    pub tags: Vec<TagEntry>,
    pub tag_selected: usize,
    // Delta availability
    pub has_delta: bool,
    pub use_delta: bool,
    // Diff context lines
    pub diff_context: usize,
    // Whitespace mode
    pub ignore_whitespace: bool,
    // Side-by-side view
    pub side_by_side: bool,
    // File tree view
    pub tree_view: bool,
    // Reflog
    pub reflog_entries: Vec<ReflogEntry>,
    pub reflog_selected: usize,
    // Commit details
    pub commit_detail: Option<String>,
    // File history mode (viewing log for a specific file)
    pub file_history_path: Option<String>,
    // Log filter (future: filter commits by author/message)
    #[allow(dead_code)]
    pub log_filter: String,
    #[allow(dead_code)]
    pub log_filter_mode: bool,
    // Show graph in log
    pub log_graph: bool,
    pub log_graph_text: String,
    // Log action menu
    pub log_action_menu: bool,
    pub log_action_selected: usize,
    pub log_action_commit_hash: Option<String>,
    // Confirm modal (generic)
    pub confirm_action: Option<crate::app::actions::Action>,
    pub confirm_message: Option<String>,
    // Remotes
    #[allow(dead_code)]
    pub remotes: Vec<RemoteEntry>,
    #[allow(dead_code)]
    pub remote_selected: usize,
    // Command palette
    pub command_palette: bool,
    pub palette_input: String,
    pub palette_selected: usize,
    // Multi-select in log for rebase
    pub log_selected_hashes: std::collections::HashSet<String>,
    pub rebase_base: Option<String>,
    /// Whether to use --root flag for rebase (explicit user choice)
    pub rebase_use_root: bool,
    // Async tasks
    pub async_tasks: Vec<AsyncTask>,
    // Themes
    pub available_themes: Vec<String>,
    #[allow(dead_code)]
    pub font_family: Option<String>,
    #[allow(dead_code)]
    pub font_size: Option<u16>,
    pub theme_picker: bool,
    pub theme_picker_selected: usize,
    pub theme_preview_prior: Option<ThemeConfig>,
    // Diff rendering
    pub load_full_diff: bool,
    pub diff_focus: bool,
    // Reset confirmation
    pub reset_pending: Option<String>,
    // Op indicator/log
    pub op_status: Option<String>,
    pub op_log: std::collections::VecDeque<String>,
    pub show_op_log: bool,
    // Merge notifier
    pub merge_base_branch: String,
    pub merge_notifier_enabled: bool,
    pub merge_notifier_ahead: Option<i32>,
    pub merge_notifier_interval_secs: u64,
    pub merge_notifier_last_check: Option<std::time::Instant>,
    pub merge_base_picker: bool,
    pub merge_base_selected: usize,
    pub push_ff_only_enforce: bool,
    pub merge_base_candidates: Vec<String>,
    pub merge_notifier_log: std::collections::VecDeque<String>,
    pub show_merge_log: bool,
    // Prune merged confirmation
    pub prune_merged_pending: bool,
    // Remote prune confirmation
    pub remote_prune_pending: bool,
    // Pull/rebase toggles
    pub pull_ff_only: bool,
    pub pull_autostash: bool,
    pub pull_timeout_secs: u64,
    pub rebase_timeout_secs: u64,
    // Auto-fetch cadence
    pub auto_fetch_enabled: bool,
    pub auto_fetch_interval_secs: u64,
    pub auto_fetch_last_check: Option<std::time::Instant>,
    pub auto_fetch_remote: String,
    // PR helper
    pub pr_helper: bool,
    pub pr_list: Vec<PrItem>,
    pub pr_selected: usize,
    // Conflict filter
    pub conflicts_only: bool,
    pub conflicts_popup: bool,
    pub conflicts_popup_selected: usize,
    pub conflicts_guided: bool,
    pub conflicts_guided_selected: usize,
    // Unified rebase session (replaces dual state system)
    pub rebase_session: crate::app::rebase::RebaseSession,
    // Legacy rebase UI state (to be removed after migration)
    pub rebase_editor_open: bool,
    pub rebase_recovery_open: bool,
    pub rebase_dirty: bool,
    pub rebase_todo: Vec<String>,
    pub rebase_todo_selected: usize,
    pub show_rebase_todo: bool,
    pub rebase_todo_dirty: bool,
    pub rebase_todo_original: Vec<String>,
    pub rebase_todo_path: Option<String>,
    pub rebase_todo_editing: bool,
    pub rebase_todo_edit_buffer: String,
    // Reword fields
    pub reword_focus_field: RewordField,
    pub reword_author_name: Option<String>,
    pub reword_author_email: Option<String>,
    // Edit operation fields
    pub edit_focus_field: RewordField,
    pub edit_author_name: Option<String>,
    pub edit_author_email: Option<String>,
    // Workflow assistant
    pub workflow_context: Option<crate::app::workflow::WorkflowContext>,
    // Custom commands from config
    pub custom_commands: std::collections::HashMap<String, String>,
    pub background_image_path: Option<String>,
    pub background_opacity: f32,
}