How microsoft/terminal works
This repository contains Windows Terminal, the Windows console host, and shared console/terminal infrastructure. A typical Terminal workflow starts with a user launching the app and choosing a profile or command, then creates a tab and terminal control connected to a command-line process; terminal input and output are parsed, represented in the text buffer, and rendered. Settings editing, tabs, panes, theming, search, and console-host functionality are separate product branches. The README documents product scope and capabilities; several runtime links below are dashed where the sampled source does not show the wiring.
Main entry points: TerminalPage.h Terminal page · ConptyConnection.cpp Process connections · IRenderEngine.hpp Render interface · textBuffer.hpp Text buffer
Components 22
Terminal application
- Windows Terminal
src/cascadia/WindowsTerminal/main.cpp - App logic
src/cascadia/TerminalApp/AppLogic.cpp - Terminal page
src/cascadia/TerminalApp/TerminalPage.h - Tabs and panes
src/cascadia/TerminalApp/Tab.cpp
Settings and commands
- Settings editor
src/cascadia/TerminalSettingsEditor/MainPage.cpp - Settings model
src/cascadia/TerminalSettingsModel/CascadiaSettings.cpp - Profile discovery
src/cascadia/TerminalSettingsModel/DynamicProfileUtils.cpp - Command line
src/cascadia/TerminalApp/Commandline.cpp
Terminal runtime
- Terminal control
src/cascadia/TerminalControl/TermControl.h - Terminal core
src/cascadia/TerminalCore/Terminal.cpp - Process connections
src/cascadia/TerminalConnection/ConptyConnection.cpp - VT parser
src/terminal/parser/OutputStateMachineEngine.cpp - Input parser
src/terminal/parser/InputStateMachineEngine.cpp - Text buffer
src/buffer/out/textBuffer.hpp
Console host
- Console host
src/host/server.h - Console API server
src/server/ApiDispatchers.cpp
Rendering
- Render interface
src/renderer/inc/IRenderEngine.hpp - Atlas renderer
src/renderer/atlas/AtlasEngine.cpp - BGFX renderer
src/interactivity/onecore/BgfxEngine.cpp
Other components
- Terminal user
- Console I/O service
- Command-line process
Connections 25
- Terminal user → Windows Terminal: launches
- Windows Terminal → App logic: starts
- App logic → Terminal page: creates
- Terminal page → Tabs and panes: manages
- Terminal page → Settings model: loads settings
- Settings editor → Settings model: edits
- Settings model → Profile discovery: uses generators
- Terminal page → Command line: handles commands
- Terminal page → Terminal control: hosts
- Terminal control → Terminal core: delegates
- Terminal core → Process connections: uses connection
- Process connections → Command-line process: starts process
- Command-line process → Process connections: sends output
- Process connections → VT parser: forwards output
- VT parser → Text buffer: dispatches output
- Terminal control → Input parser: translates input
- Input parser → Process connections: sends input
- Text buffer → Render interface: provides render data
- Render interface → Atlas renderer: implemented by
- Render interface → BGFX renderer: implemented by
- BGFX renderer → Console I/O service: requests display update
src/interactivity/onecore/BgfxEngine.cpp - Console host → Console API server: hosts API server
- Atlas renderer → Text buffer: reads buffer
- Render interface → Text buffer: uses image slices
src/renderer/inc/IRenderEngine.hpp - Input parser → Command-line process: dispatches input