Treat NSTextInputClient ranges as UTF-16
This commit is contained in:
parent
32662b6b92
commit
b02681ee8a
4 changed files with 115 additions and 70 deletions
|
@ -1,10 +1,10 @@
|
|||
use super::{ExcerptId, MultiBufferSnapshot, ToOffset, ToPoint};
|
||||
use super::{ExcerptId, MultiBufferSnapshot, ToOffset, ToOffsetUtf16, ToPoint};
|
||||
use std::{
|
||||
cmp::Ordering,
|
||||
ops::{Range, Sub},
|
||||
};
|
||||
use sum_tree::Bias;
|
||||
use text::{rope::TextDimension, Point};
|
||||
use text::{rope::TextDimension, OffsetUtf16, Point};
|
||||
|
||||
#[derive(Clone, Eq, PartialEq, Debug, Hash)]
|
||||
pub struct Anchor {
|
||||
|
@ -89,6 +89,12 @@ impl ToOffset for Anchor {
|
|||
}
|
||||
}
|
||||
|
||||
impl ToOffsetUtf16 for Anchor {
|
||||
fn to_offset_utf16(&self, snapshot: &MultiBufferSnapshot) -> OffsetUtf16 {
|
||||
self.summary(snapshot)
|
||||
}
|
||||
}
|
||||
|
||||
impl ToPoint for Anchor {
|
||||
fn to_point<'a>(&self, snapshot: &MultiBufferSnapshot) -> Point {
|
||||
self.summary(snapshot)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue