The name "Diwan" comes from the Arabic language and has deep-rooted cultural significance in the Arab and Islamic world. In its literary context, a "diwan" (dee-waan) refers to an anthology or collection of writings, poems, and literary works by a single author.
- Step the folder structure
- Create a
diwan_cli
folder - Create a
diwan_core
folder - Create a
diwan_lib
folder - Create an
img
folder - Create necessary files:
-
diwan_cli/src/main.rs
-
diwan_core/src/lib.rs
-
diwan_core/src/buffer.rs
-
diwan_core/src/cursor.rs
-
diwan_core/src/editor.rs
-
diwan_core/src/file_io.rs
-
diwan_core/src/input.rs
-
diwan_core/src/renderer.rs
-
diwan_lib/src/lib.rs
-
img/logo.svg
-
- Create a
- Create a
README.md
file - Create a
.gitignore
file - Create a
Cargo.toml
file at root - Crates
- Filter the crates available on the internet
- Add them to the
diwan_core/Cargo.toml
-
crossterm
-
anyhow
-
- CLI has two functions to open the file and to run the editor if the file is not provided
- Create the base of the project
- Implement
Buffer
struct inbuffer.rs
- Methods for inserting and deleting characters
- Implement
Cursor
struct incursor.rs
- [] Methods for moving the cursor
- Implement main logic in
editor.rs
- Integrate buffer and cursor
- Define modes and handle input
- Implement file I/O in
file_io.rs
- Functions for loading and saving text files
- Implement input handling in
input.rs
- Function to handle input
- Implement screen rendering in
renderer.rs
- Function to render the screen efficiently
- Implement
- Efficiency improvements
- Avoid redundant flushing
- Batch updates to minimize cursor movements
- Efficient rendering to update only changed parts of the screen
- Testing
- Write unit tests for buffer operations
- Write unit tests for cursor movements
- Write integration tests for editor commands