Velocity/docs/design/introduction.md

18 lines
1.3 KiB
Markdown
Raw Normal View History

2023-04-28 14:25:34 +01:00
# Introduction
Velocity is a fast and hackable text editor made for programming. It is split into two main parts, the backend and the frontend.
The backend, written in performant Rust, is the core of the editor and handles text manipulation, files, buffers, views, etc.
The frontend, which can be written in any language, is the UI of the editor and handles rendering, keybinds, etc.
## Editor
The `struct Editor` is the main class of the backend. It contains the current state of the editor, the views, and the configuration.
The `Editor` is the main way to interact with the backend, and is used by the frontend to manipulate the editor.
## View
The `struct View` defines a way of viewing a buffer, it contains information such as the current cursor locations, the scroll position, and the buffer
## Buffer
The `struct Buffer` contains the text of a file, and is the main way of interacting with the text. It contains a `Vec` of `Line`s, which contain a `Vec` of `char`s.
Buffers can be `BufferKind::Read`, meaning the file is read-only, or `BufferKind::Write` allowing edits to be made to the file, or can be `BufferKind::Scratch` which are not associated with a file.
## Line
The `struct Line` contains a `Vec` of `char`s, and is the main way of interacting with the text. It contains a `Vec` of `Line`s, which contain a `Vec` of `char`s.