Skip to content

Commit

Permalink
gap buffer p4
Browse files Browse the repository at this point in the history
  • Loading branch information
Kacperacy committed Jun 13, 2024
1 parent e4fde96 commit 53a36e4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/gap_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,12 @@ impl GapBuffer {
self.gap_end += move_size;
}
}

fn to_string(&self) -> String {
let mut result: Vec<char> =
Vec::with_capacity(self.buffer.len() - (self.gap_end - self.gap_start));
result.extend_from_slice(&self.buffer[..self.gap_start]);
result.extend_from_slice(&self.buffer[self.gap_end..]);
result.into_iter().collect()
}
}

0 comments on commit 53a36e4

Please sign in to comment.