# benwarring/bide architecture

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

- Interactive diagram: https://gitdiagram.com/benwarring/bide
- Repository: https://github.com/benwarring/bide

## Overview

bIDE is a modeless terminal text editor. The principal workflow is terminal input through the event loop and command handling into buffer edits or file operations, followed by rendering; optional language-server responses are multiplexed into the same loop and provide editor features. The graph preserves documented editing, navigation, search, syntax, pane, clipboard and LSP capabilities. Source excerpts establish the event-loop wiring; other links are limited to relationships visible in the source index or README, so unsampled call details are omitted.

Main entry points: [`src/main.c`](https://github.com/benwarring/bide/blob/main/src/main.c) (Event loop), [`src/command.c`](https://github.com/benwarring/bide/blob/main/src/command.c) (Commands), [`src/lsp.c`](https://github.com/benwarring/bide/blob/main/src/lsp.c) (LSP client), [`src/render.c`](https://github.com/benwarring/bide/blob/main/src/render.c) (Screen rendering)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Editor runtime"]
  node_main["Event loop<br/>[main.c]"]
  node_commands["Commands<br/>[command.c]"]
  node_input["Input handling<br/>[input.c]"]
end

subgraph group_editing["Editing and navigation"]
  node_buffer["Buffers and edits<br/>[buffer.c]"]
  node_undo["Undo and redo<br/>[undo.c]"]
  node_files["File operations<br/>[files.c]"]
  node_search["Incremental search<br/>[search.c]"]
  node_fuzzy["Fuzzy matching<br/>[fuzzy.c]"]
  node_list["File and buffer picker<br/>[list.c]"]
  node_panes["Split panes<br/>[pane.c]"]
end

subgraph group_interface["Terminal interface"]
  node_render["Screen rendering<br/>[render.c]"]
  node_terminal["Terminal control<br/>[terminal.c]"]
  node_popup["Completion popup<br/>[popup.c]"]
  node_rain["Startup rain<br/>[rain.c]"]
end

subgraph group_language["Language support"]
  node_syntax["Syntax highlighting<br/>[syntax.c]"]
  node_lsp["LSP client<br/>[lsp.c]"]
  node_lspfeatures["LSP features<br/>[lspfeat.c]"]
  node_json["JSON codec<br/>[json.c]"]
end

subgraph group_services["Runtime services"]
  node_wrappers["System wrappers<br/>[wrappers.c]"]
  node_log["LSP logging<br/>[log.c]"]
end

node_user(("User"))
node_servers{{"Language servers"}}
node_filesystem[("Local files")]
node_clipboard{{"Terminal clipboard"}}

node_user -->|"provides input"| node_main
node_main -->|"reads keys"| node_input
node_main -->|"refreshes screen"| node_render
node_main -->|"polls and dispatches"| node_lsp
node_main -->|"opens file"| node_buffer
node_main -->|"initializes panes"| node_panes
node_main -->|"plays startup effect"| node_rain
node_input -->|"dispatches actions"| node_commands
node_commands -->|"edits buffers"| node_buffer
node_commands -->|"starts search"| node_search
node_commands -->|"opens picker"| node_list
node_commands -->|"controls panes"| node_panes
node_commands -->|"invokes features"| node_lspfeatures
node_buffer -->|"records mutations"| node_undo
node_buffer -->|"reads and saves"| node_filesystem
node_list -->|"ranks matches"| node_fuzzy
node_list -->|"supplies overlay"| node_render
node_panes -->|"provides views"| node_render
node_render -->|"uses highlights"| node_syntax
node_render -->|"writes frames"| node_terminal
node_input -->|"reads terminal input"| node_terminal
node_input -->|"requests clipboard"| node_clipboard
node_lsp -->|"encodes messages"| node_json
node_lspfeatures -->|"uses client services"| node_lsp
node_lspfeatures -->|"offers completion"| node_popup
node_lsp -->|"communicates over pipes"| node_servers
node_lsp -->|"records transcript"| node_log
node_lsp -->|"manages processes"| node_wrappers
node_terminal -->|"wraps terminal calls"| node_wrappers

click node_main "https://github.com/benwarring/bide/blob/main/src/main.c"
click node_commands "https://github.com/benwarring/bide/blob/main/src/command.c"
click node_input "https://github.com/benwarring/bide/blob/main/src/input.c"
click node_buffer "https://github.com/benwarring/bide/blob/main/src/buffer.c"
click node_undo "https://github.com/benwarring/bide/blob/main/src/undo.c"
click node_files "https://github.com/benwarring/bide/blob/main/src/files.c"
click node_search "https://github.com/benwarring/bide/blob/main/src/search.c"
click node_fuzzy "https://github.com/benwarring/bide/blob/main/src/fuzzy.c"
click node_list "https://github.com/benwarring/bide/blob/main/src/list.c"
click node_panes "https://github.com/benwarring/bide/blob/main/src/pane.c"
click node_render "https://github.com/benwarring/bide/blob/main/src/render.c"
click node_terminal "https://github.com/benwarring/bide/blob/main/src/terminal.c"
click node_popup "https://github.com/benwarring/bide/blob/main/src/popup.c"
click node_syntax "https://github.com/benwarring/bide/blob/main/src/syntax.c"
click node_lsp "https://github.com/benwarring/bide/blob/main/src/lsp.c"
click node_lspfeatures "https://github.com/benwarring/bide/blob/main/src/lspfeat.c"
click node_json "https://github.com/benwarring/bide/blob/main/src/json.c"
click node_rain "https://github.com/benwarring/bide/blob/main/src/rain.c"
click node_wrappers "https://github.com/benwarring/bide/blob/main/src/wrappers.c"
click node_log "https://github.com/benwarring/bide/blob/main/src/log.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_main,node_commands,node_input,node_user toneBlue
class node_buffer,node_undo,node_files,node_search,node_fuzzy,node_list,node_panes,node_filesystem toneAmber
class node_render,node_terminal,node_popup,node_rain,node_servers toneMint
class node_syntax,node_lsp,node_lspfeatures,node_json toneRose
class node_wrappers,node_log,node_clipboard toneIndigo
```

## Components

### Editor runtime

- [Event loop](https://github.com/benwarring/bide/blob/main/src/main.c): `src/main.c`
- [Commands](https://github.com/benwarring/bide/blob/main/src/command.c): `src/command.c`
- [Input handling](https://github.com/benwarring/bide/blob/main/src/input.c): `src/input.c`

### Editing and navigation

- [Buffers and edits](https://github.com/benwarring/bide/blob/main/src/buffer.c): `src/buffer.c`
- [Undo and redo](https://github.com/benwarring/bide/blob/main/src/undo.c): `src/undo.c`
- [File operations](https://github.com/benwarring/bide/blob/main/src/files.c): `src/files.c`
- [Incremental search](https://github.com/benwarring/bide/blob/main/src/search.c): `src/search.c`
- [Fuzzy matching](https://github.com/benwarring/bide/blob/main/src/fuzzy.c): `src/fuzzy.c`
- [File and buffer picker](https://github.com/benwarring/bide/blob/main/src/list.c): `src/list.c`
- [Split panes](https://github.com/benwarring/bide/blob/main/src/pane.c): `src/pane.c`

### Terminal interface

- [Screen rendering](https://github.com/benwarring/bide/blob/main/src/render.c): `src/render.c`
- [Terminal control](https://github.com/benwarring/bide/blob/main/src/terminal.c): `src/terminal.c`
- [Completion popup](https://github.com/benwarring/bide/blob/main/src/popup.c): `src/popup.c`
- [Startup rain](https://github.com/benwarring/bide/blob/main/src/rain.c): `src/rain.c`

### Language support

- [Syntax highlighting](https://github.com/benwarring/bide/blob/main/src/syntax.c): `src/syntax.c`
- [LSP client](https://github.com/benwarring/bide/blob/main/src/lsp.c): `src/lsp.c`
- [LSP features](https://github.com/benwarring/bide/blob/main/src/lspfeat.c): `src/lspfeat.c`
- [JSON codec](https://github.com/benwarring/bide/blob/main/src/json.c): `src/json.c`

### Runtime services

- [System wrappers](https://github.com/benwarring/bide/blob/main/src/wrappers.c): `src/wrappers.c`
- [LSP logging](https://github.com/benwarring/bide/blob/main/src/log.c): `src/log.c`

### Other components

- **User**
- **Language servers**
- **Local files**
- **Terminal clipboard**

## Connections

- User → Event loop: provides input (evidence: `README.md`)
- Event loop → Input handling: reads keys (evidence: `src/main.c`)
- Event loop → Screen rendering: refreshes screen (evidence: `src/main.c`)
- Event loop → LSP client: polls and dispatches (evidence: `src/main.c`)
- Event loop → Buffers and edits: opens file (evidence: `src/main.c`)
- Event loop → Split panes: initializes panes (evidence: `src/main.c`)
- Event loop → Startup rain: plays startup effect (evidence: `src/main.c`)
- Input handling → Commands: dispatches actions (evidence: `src/input.c`)
- Commands → Buffers and edits: edits buffers (evidence: `src/command.c`)
- Commands → Incremental search: starts search (evidence: `src/command.c`)
- Commands → File and buffer picker: opens picker (evidence: `src/command.c`)
- Commands → Split panes: controls panes (evidence: `src/command.c`)
- Commands → LSP features: invokes features (evidence: `src/command.c`)
- Buffers and edits → Undo and redo: records mutations
- Buffers and edits → Local files: reads and saves
- File and buffer picker → Fuzzy matching: ranks matches (evidence: `src/list.c`)
- File and buffer picker → Screen rendering: supplies overlay
- Split panes → Screen rendering: provides views
- Screen rendering → Syntax highlighting: uses highlights (evidence: `src/render.c`)
- Screen rendering → Terminal control: writes frames (evidence: `src/render.c`)
- Input handling → Terminal control: reads terminal input (evidence: `src/input.c`)
- Input handling → Terminal clipboard: requests clipboard (evidence: `README.md`)
- LSP client → JSON codec: encodes messages
- LSP features → LSP client: uses client services (evidence: `src/lspfeat.c`)
- LSP features → Completion popup: offers completion
- LSP client → Language servers: communicates over pipes (evidence: `README.md`)
- LSP client → LSP logging: records transcript (evidence: `src/lsp.c`)
- LSP client → System wrappers: manages processes
- Terminal control → System wrappers: wraps terminal calls (evidence: `src/terminal.c`)
