Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f0f7f73976 | ||
|
|
9385525c8d |
No files matched your search
Generated
+16
@@ -216,6 +216,15 @@ version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
|
||||
|
||||
[[package]]
|
||||
name = "crop"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0f7cba78cdac608a5e2e645de47e566c0f63e1b6110318736581ec97d5669767"
|
||||
dependencies = [
|
||||
"str_indices",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossterm"
|
||||
version = "0.27.0"
|
||||
@@ -497,6 +506,7 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"color-eyre",
|
||||
"crop",
|
||||
"crossterm",
|
||||
"eyre",
|
||||
"futures",
|
||||
@@ -673,6 +683,12 @@ dependencies = [
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "str_indices"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e9557cb6521e8d009c51a8666f09356f4b817ba9ba0981a305bd86aee47bd35c"
|
||||
|
||||
[[package]]
|
||||
name = "strsim"
|
||||
version = "0.10.0"
|
||||
|
||||
@@ -9,6 +9,7 @@ rust-version = "1.75.0"
|
||||
[dependencies]
|
||||
clap = { version = "4.4.11", features = ["derive"] }
|
||||
color-eyre = "0.6.2"
|
||||
crop = "0.4.1"
|
||||
crossterm = { version = "0.27.0", features = ["event-stream"] }
|
||||
eyre = "0.6.11"
|
||||
futures = "0.3.29"
|
||||
|
||||
+6
-3
@@ -1,5 +1,7 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use crop::Rope;
|
||||
|
||||
use crate::configuration::{Configuration, CursorMovement, EditorAction};
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
@@ -74,13 +76,14 @@ impl Cursor {
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct Buffer {
|
||||
text_lines: Vec<String>,
|
||||
text: Rope,
|
||||
pub(crate) cursor_pos: Cursor,
|
||||
}
|
||||
|
||||
impl Buffer {
|
||||
pub(crate) fn visible_lines(&self) -> impl Iterator<Item = &str> + '_ {
|
||||
self.text_lines.iter().map(|l| l.as_ref())
|
||||
pub(crate) fn visible_lines(&self) -> impl Iterator<Item = String> + '_ {
|
||||
//TODO revisit this
|
||||
self.text.lines().map(|line| line.chunks().collect::<String>())
|
||||
}
|
||||
|
||||
fn insert_char(&mut self, ch: char) {
|
||||
|
||||
Reference in new issue
Block a user