Velocity/docs/design/introduction.md

1.3 KiB

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 Lines, which contain a Vec of chars. 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 chars, and is the main way of interacting with the text. It contains a Vec of Lines, which contain a Vec of chars.