fix: update architecture-docs (#1487)

This commit is contained in:
a-kenji 2022-06-11 15:23:11 +02:00 committed by GitHub
parent 8340559c78
commit 0cd43a5d1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,13 +1,13 @@
This document details the different components of the code base in plain English. The intention is to provide a high level description rather than a more detailed drill-down of each internal mechanism.
## Screen (src/screen.rs)
## Screen (zellij-server/src/screen.rs)
The Screen is responsible for managing the relationship between the panes currently displayed on screen.
It is in charge of actions such as:
* Coordinating the resizing of panes
* Creating new panes
* Closing existing panes (and filling up their space by other panes)
## Terminal Pane (src/terminal_pane/terminal_pane.rs)
## Terminal Pane (zellij-server/src/pane/terminal_pane.rs)
The TerminalPane represents a pane on screen that connects to a single pty (pseudo terminal) and (presumably) has one shell or other program running inside it.
The TerminalPane has two main roles:
* Keeping track of the Scroll, which represents the buffer of lines in this terminal
@ -19,7 +19,7 @@ The Scroll holds the terminal buffer and is in charge of:
* Keeping track of the cursor position
* Controlling line-wrapping
### Terminal Character (src/terminal_pane/terminal_character.rs)
### Terminal Character (zellij-server/src/panes/terminal_character.rs)
The `TerminalCharacter` represents a single character in the pane. It holds the char itself on the one hand, and an internal `CharacterStyles` struct representing the styling of this character.
This struct derives the `Copy` trait for performance reasons, because it is moved around quite a bit (eg. when line wrapping).
@ -32,10 +32,10 @@ It's important to understand that these styles are ongoing relative to the curre
This is important to note because the styles themselves are saved only on characters that have already been printed. If we receive an instruction to change the style to blue, then print a (blue) character, then receive another instruction to move to a new line, print another (plain) character and then come back, the style would be reset. We would have to receive a new instruction to change the style to blue in order for the next character to be blue.
## Boundaries (src/boundaries.rs)
## Boundaries (zellij-server/src/boundaries.rs)
The Boundaries refer to those lines that are drawn between terminal panes. A few things that happen here:
* The Rect trait is here so that different panes can implement it, giving boundaries a generic way to calculate the size of the pane and draw boundaries around it.
* Here we use the [unicode box drawing characters](https://en.wikipedia.org/wiki/Box-drawing_character) in order to draw the borders. There's some logic here about combining them together for all possible combinations of pane locations.
## PTY Bus (src/pty.rs)
## PTY Bus (zellij-server/src/pty.rs)
The PtyBus keeps track of several asynchronous streams that read from pty sockets (eg. /dev/pts/999), parse those bytes into ANSI/VT events and send them on to the Screen so that they can be received in the relevant TerminalPane.