mirror of https://github.com/helix-editor/helix
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
879 B
Rust
30 lines
879 B
Rust
use steel::gc::unsafe_erased_pointers::CustomReference;
|
|
|
|
impl steel::rvals::Custom for crate::Position {}
|
|
impl steel::rvals::Custom for crate::Selection {}
|
|
|
|
struct SRopeSlice<'a>(crate::RopeSlice<'a>);
|
|
|
|
steel::custom_reference!(SRopeSlice<'a>);
|
|
impl<'a> CustomReference for SRopeSlice<'a> {}
|
|
|
|
impl<'a> SRopeSlice<'a> {
|
|
pub fn char_to_byte(&self, pos: usize) -> usize {
|
|
self.0.char_to_byte(pos)
|
|
}
|
|
|
|
pub fn byte_slice(&'a self, lower: usize, upper: usize) -> SRopeSlice<'a> {
|
|
SRopeSlice(self.0.byte_slice(lower..upper))
|
|
}
|
|
|
|
pub fn line(&'a self, cursor: usize) -> SRopeSlice<'a> {
|
|
SRopeSlice(self.0.line(cursor))
|
|
}
|
|
|
|
// Reference types are really sus. Not sure how this is going to work, but it might? Hopefully it cleans
|
|
// itself up as we go...
|
|
pub fn as_str(&'a self) -> Option<&'a str> {
|
|
self.0.as_str()
|
|
}
|
|
}
|