# `MingaEditor.GitStatus.TUIState`
[🔗](https://github.com/jsmestad/minga/blob/main/lib/minga_editor/git_status/tui_state.ex#L1)

TUI-only value owner for the Traditional Git-status sidebar.

The shared git status panel data stays frontend-neutral. This struct tracks
terminal presentation concerns such as cursor position, collapsed sections,
and pending TUI confirmations.

# `discard_confirmation`

```elixir
@type discard_confirmation() :: {Minga.Git.StatusEntry.t(), String.t()} | nil
```

# `flat_entry`

```elixir
@type flat_entry() ::
  {:section_header, atom(), non_neg_integer()}
  | {:file, atom(), Minga.Git.StatusEntry.t()}
```

# `t`

```elixir
@type t() :: %MingaEditor.GitStatus.TUIState{
  collapsed: %{required(atom()) =&gt; true},
  cursor_index: non_neg_integer(),
  discard_confirmation: discard_confirmation()
}
```

# `clamp_cursor`

```elixir
@spec clamp_cursor(t(), [Minga.Git.StatusEntry.t()]) :: t()
```

Clamps cursor position to the current flattened entry list.

# `clear_discard_confirmation`

```elixir
@spec clear_discard_confirmation(t()) :: t()
```

Clears pending discard confirmation state.

# `current_entry`

```elixir
@spec current_entry(t(), [Minga.Git.StatusEntry.t()]) :: flat_entry() | nil
```

Returns the flattened row at the current cursor.

# `flat_entries`

```elixir
@spec flat_entries(t(), [Minga.Git.StatusEntry.t()]) :: [flat_entry()]
```

Returns the flattened rows rendered by the TUI sidebar.

# `new`

```elixir
@spec new() :: t()
```

Builds initial TUI view state.

# `next`

```elixir
@spec next(t(), [Minga.Git.StatusEntry.t()]) :: t()
```

Moves the cursor to the next visible row.

# `next_section`

```elixir
@spec next_section(t(), [Minga.Git.StatusEntry.t()]) :: t()
```

Moves the cursor to the next section header.

# `prev`

```elixir
@spec prev(t()) :: t()
```

Moves the cursor to the previous visible row.

# `prev_section`

```elixir
@spec prev_section(t(), [Minga.Git.StatusEntry.t()]) :: t()
```

Moves the cursor to the previous section header.

# `refresh`

```elixir
@spec refresh(t(), [Minga.Git.StatusEntry.t()]) :: t()
```

Clamps cursor position after the shared git entry list changes.

# `request_discard`

```elixir
@spec request_discard(t(), Minga.Git.StatusEntry.t(), String.t()) :: t()
```

Stores the pending destructive discard confirmation.

# `selected_file`

```elixir
@spec selected_file(t(), [Minga.Git.StatusEntry.t()]) ::
  Minga.Git.StatusEntry.t() | nil
```

Returns the selected file entry, if the cursor is on a file row.

# `toggle_current_section`

```elixir
@spec toggle_current_section(t(), [Minga.Git.StatusEntry.t()]) :: t()
```

Toggles the currently selected section when the cursor is on a section header.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
