# amiralimanzar/zed-rtl architecture

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

- Interactive diagram: https://gitdiagram.com/amiralimanzar/zed-rtl
- Repository: https://github.com/amiralimanzar/zed-rtl

## Overview

Zed RTL is a Windows patch for Zed’s text shaping and caret positioning. The main user workflow is to launch the patcher, which obtains an architecture- and version-matched patched executable and replaces the installed Zed executable after backing it up; the README also documents restoring the backup and using a local build. The patch modifies shaping and line-layout code so RTL handling applies across Zed’s editor, terminal, and remote sessions. The patcher-to-PowerShell handoff is visible in source; installation details and patch effects are documented in the README, while the PowerShell implementation was not sampled.

Main entry points: [`scripts/patch-zed.ps1`](https://github.com/amiralimanzar/zed-rtl/blob/main/scripts/patch-zed.ps1) (Install script), [`patch/zed-rtl.patch`](https://github.com/amiralimanzar/zed-rtl/blob/main/patch/zed-rtl.patch) (Zed patch), [`patcher/src/main.rs`](https://github.com/amiralimanzar/zed-rtl/blob/main/patcher/src/main.rs) (Patcher launcher), [`patch/direct_write.rs`](https://github.com/amiralimanzar/zed-rtl/blob/main/patch/direct_write.rs) (Windows text shaping)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_patcher["Installation"]
  node_launcher["Patcher launcher<br/>[main.rs]"]
  node_patch_script["Install script<br/>[patch-zed.ps1]"]
  node_release_build["Patched build"]
  node_backup[("Original executable backup")]
end

subgraph group_patch["RTL changes"]
  node_patch_artifact["Zed patch<br/>[zed-rtl.patch]"]
  node_shaping["Windows text shaping<br/>[direct_write.rs]"]
  node_caret["Caret positioning<br/>[zed-rtl.patch]"]
end

subgraph group_zed["Zed runtime"]
  node_installed_zed["Installed Zed executable"]
  node_surfaces["Editor, terminal, remote"]
end

node_user(("Windows user"))

node_user -->|"runs"| node_launcher
node_launcher -->|"launches"| node_patch_script
node_patch_script -->|"backs up"| node_backup
node_patch_script -->|"downloads"| node_release_build
node_patch_script -->|"replaces"| node_installed_zed
node_release_build -->|"supplies build"| node_installed_zed
node_patch_artifact -->|"changes"| node_shaping
node_patch_artifact -->|"changes"| node_caret
node_installed_zed -->|"renders text"| node_surfaces

click node_launcher "https://github.com/amiralimanzar/zed-rtl/blob/main/patcher/src/main.rs"
click node_patch_script "https://github.com/amiralimanzar/zed-rtl/blob/main/scripts/patch-zed.ps1"
click node_patch_artifact "https://github.com/amiralimanzar/zed-rtl/blob/main/patch/zed-rtl.patch"
click node_shaping "https://github.com/amiralimanzar/zed-rtl/blob/main/patch/direct_write.rs"
click node_caret "https://github.com/amiralimanzar/zed-rtl/blob/main/patch/zed-rtl.patch"

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_launcher,node_patch_script,node_release_build,node_backup,node_user toneBlue
class node_patch_artifact,node_shaping,node_caret toneAmber
class node_installed_zed,node_surfaces toneMint
```

## Components

### Installation

- [Patcher launcher](https://github.com/amiralimanzar/zed-rtl/blob/main/patcher/src/main.rs): `patcher/src/main.rs`
- [Install script](https://github.com/amiralimanzar/zed-rtl/blob/main/scripts/patch-zed.ps1): `scripts/patch-zed.ps1`
- **Patched build**
- **Original executable backup**

### RTL changes

- [Zed patch](https://github.com/amiralimanzar/zed-rtl/blob/main/patch/zed-rtl.patch): `patch/zed-rtl.patch`
- [Windows text shaping](https://github.com/amiralimanzar/zed-rtl/blob/main/patch/direct_write.rs): `patch/direct_write.rs`
- [Caret positioning](https://github.com/amiralimanzar/zed-rtl/blob/main/patch/zed-rtl.patch): `patch/zed-rtl.patch`

### Zed runtime

- **Installed Zed executable**
- **Editor, terminal, remote**

### Other components

- **Windows user**

## Connections

- Windows user → Patcher launcher: runs (evidence: `README.md`)
- Patcher launcher → Install script: launches (evidence: `patcher/src/main.rs`)
- Install script → Original executable backup: backs up (evidence: `README.md`)
- Install script → Patched build: downloads (evidence: `README.md`)
- Install script → Installed Zed executable: replaces (evidence: `README.md`)
- Patched build → Installed Zed executable: supplies build (evidence: `README.md`)
- Zed patch → Windows text shaping: changes (evidence: `README.md`)
- Zed patch → Caret positioning: changes (evidence: `README.md`)
- Installed Zed executable → Editor, terminal, remote: renders text (evidence: `README.md`)
