# generalfundam1/tsheet architecture

> Architecture diagram of the GitHub repository generalfundam1/tsheet, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/generalfundam1/tsheet
- Repository: https://github.com/generalfundam1/tsheet

## Overview

tsheet is a C terminal spreadsheet. Users open or create a sheet, edit and format selected cells, then save or use clipboard, conversion, and graph features. The graph follows documented responsibilities and sampled implementation details; several connections between the editor and feature modules are dashed because the excerpts do not show the calls.

Main entry points: [`app.c`](https://github.com/generalfundam1/tsheet/blob/main/app.c) (Editor and commands), [`graph.c`](https://github.com/generalfundam1/tsheet/blob/main/graph.c) (Graph generation), [`sheet.c`](https://github.com/generalfundam1/tsheet/blob/main/sheet.c) (Cells and formulas), [`ui.c`](https://github.com/generalfundam1/tsheet/blob/main/ui.c) (Grid and dialogs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Terminal interaction"]
  node_editor["Editor and commands<br/>[app.c]"]
  node_menus["Menus and bindings<br/>[config.h]"]
  node_renderer["Grid and dialogs<br/>[ui.c]"]
  node_terminal["Terminal input/output<br/>[term.c]"]
end

subgraph group_sheet["Spreadsheet core"]
  node_model["Cells and formulas<br/>[sheet.c]"]
  node_shared["Shared types<br/>[tsheet.h]"]
end

subgraph group_formats["Files and clipboard"]
  node_textio["Text and structured files<br/>[io.c]"]
  node_office["XLSX and ODS reader<br/>[read.c]"]
  node_html["HTML tables<br/>[html.c]"]
  node_clipboard["System clipboard<br/>[clip.c]"]
end

subgraph group_features["Data features"]
  node_units["Unit conversions<br/>[units.c]"]
  node_graphs["Graph generation<br/>[graph.c]"]
end

node_user(("User"))
node_gnuplot["gnuplot"]
node_viewer["PDF viewer"]

node_user -->|"edits sheet"| node_editor
node_editor -->|"uses actions"| node_menus
node_editor -->|"updates display"| node_renderer
node_terminal -.->|"provides input"| node_editor
node_editor -.->|"writes display"| node_terminal
node_editor -.->|"edits cells"| node_model
node_renderer -.->|"renders cells"| node_model
node_editor -.->|"loads and saves"| node_textio
node_editor -.->|"opens workbooks"| node_office
node_editor -.->|"copies and pastes"| node_clipboard
node_editor -.->|"exchanges tables"| node_html
node_editor -.->|"converts values"| node_units
node_editor -.->|"requests graph"| node_graphs
node_graphs -->|"reads selected cells"| node_model
node_graphs -->|"renders plot"| node_gnuplot
node_graphs -->|"opens PDF"| node_viewer

click node_editor "https://github.com/generalfundam1/tsheet/blob/main/app.c"
click node_menus "https://github.com/generalfundam1/tsheet/blob/main/config.h"
click node_renderer "https://github.com/generalfundam1/tsheet/blob/main/ui.c"
click node_terminal "https://github.com/generalfundam1/tsheet/blob/main/term.c"
click node_model "https://github.com/generalfundam1/tsheet/blob/main/sheet.c"
click node_shared "https://github.com/generalfundam1/tsheet/blob/main/tsheet.h"
click node_textio "https://github.com/generalfundam1/tsheet/blob/main/io.c"
click node_office "https://github.com/generalfundam1/tsheet/blob/main/read.c"
click node_html "https://github.com/generalfundam1/tsheet/blob/main/html.c"
click node_clipboard "https://github.com/generalfundam1/tsheet/blob/main/clip.c"
click node_units "https://github.com/generalfundam1/tsheet/blob/main/units.c"
click node_graphs "https://github.com/generalfundam1/tsheet/blob/main/graph.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_editor,node_menus,node_renderer,node_terminal,node_user,node_viewer toneBlue
class node_model,node_shared toneAmber
class node_textio,node_office,node_html,node_clipboard toneMint
class node_units,node_graphs toneRose
class node_gnuplot toneIndigo
```

## Components

### Terminal interaction

- [Editor and commands](https://github.com/generalfundam1/tsheet/blob/main/app.c): `app.c`
- [Menus and bindings](https://github.com/generalfundam1/tsheet/blob/main/config.h): `config.h`
- [Grid and dialogs](https://github.com/generalfundam1/tsheet/blob/main/ui.c): `ui.c`
- [Terminal input/output](https://github.com/generalfundam1/tsheet/blob/main/term.c): `term.c`

### Spreadsheet core

- [Cells and formulas](https://github.com/generalfundam1/tsheet/blob/main/sheet.c): `sheet.c`
- [Shared types](https://github.com/generalfundam1/tsheet/blob/main/tsheet.h): `tsheet.h`

### Files and clipboard

- [Text and structured files](https://github.com/generalfundam1/tsheet/blob/main/io.c): `io.c`
- [XLSX and ODS reader](https://github.com/generalfundam1/tsheet/blob/main/read.c): `read.c`
- [HTML tables](https://github.com/generalfundam1/tsheet/blob/main/html.c): `html.c`
- [System clipboard](https://github.com/generalfundam1/tsheet/blob/main/clip.c): `clip.c`

### Data features

- [Unit conversions](https://github.com/generalfundam1/tsheet/blob/main/units.c): `units.c`
- [Graph generation](https://github.com/generalfundam1/tsheet/blob/main/graph.c): `graph.c`

### Other components

- **User**
- **gnuplot**
- **PDF viewer**

## Connections

- User → Editor and commands: edits sheet (evidence: `README.md`)
- Editor and commands → Menus and bindings: uses actions (evidence: `README.md`)
- Editor and commands → Grid and dialogs: updates display (evidence: `README.md`)
- Terminal input/output → Editor and commands: provides input
- Editor and commands → Terminal input/output: writes display
- Editor and commands → Cells and formulas: edits cells
- Grid and dialogs → Cells and formulas: renders cells
- Editor and commands → Text and structured files: loads and saves
- Editor and commands → XLSX and ODS reader: opens workbooks
- Editor and commands → System clipboard: copies and pastes
- Editor and commands → HTML tables: exchanges tables
- Editor and commands → Unit conversions: converts values
- Editor and commands → Graph generation: requests graph
- Graph generation → Cells and formulas: reads selected cells (evidence: `graph.c`)
- Graph generation → gnuplot: renders plot (evidence: `graph.c`)
- Graph generation → PDF viewer: opens PDF (evidence: `graph.c`)
