Skip to content

Commit

Permalink
gap buffer p8
Browse files Browse the repository at this point in the history
  • Loading branch information
Kacperacy committed Jun 17, 2024
1 parent 87aa10a commit 96fc4c0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
1 change: 0 additions & 1 deletion src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ impl App {
let current_line = &mut self.content[self.cursor_position.y];

if current_line.len() > pos.x {
// TODO: fix
let new_line = current_line.split_off(pos.x);

self.insert_to_content(pos.y + 1, new_line);
Expand Down
10 changes: 4 additions & 6 deletions src/gap_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,12 @@ impl GapBuffer {

new_buffer[..new_capacity].copy_from_slice(&self.buffer[self.gap_end..]);

let split_buffer = GapBuffer {
self.gap_end = self.buffer.len();

GapBuffer {
buffer: new_buffer,
gap_start: 0,
gap_end: new_capacity,
};

self.gap_end = self.buffer.len();

split_buffer
}
}
}

0 comments on commit 96fc4c0

Please sign in to comment.