Fix moving to previous word across a wrap boundary
I'm just going to the end of the soft-wrapped line, mirroring the behavior with hard wraps. It's maybe not perfectly technically correct but that behavior would require us to consider word boundaries outside of the current line, which doesn't seem worth the complexity.
This commit is contained in:
committed by
Max Brunsfeld
parent
25c472acd0
commit
e7d03af942
@@ -511,13 +511,16 @@ impl Snapshot {
|
||||
len as u32
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub fn is_line_wrapped(&self, row: u32) -> bool {
|
||||
pub fn soft_wrap_indent(&self, row: u32) -> Option<u32> {
|
||||
let mut cursor = self.transforms.cursor::<_, ()>();
|
||||
cursor.seek(&WrapPoint::new(row + 1, 0), Bias::Right, &());
|
||||
cursor
|
||||
.item()
|
||||
.map_or(false, |transform| !transform.is_isomorphic())
|
||||
cursor.item().and_then(|transform| {
|
||||
if transform.is_isomorphic() {
|
||||
None
|
||||
} else {
|
||||
Some(transform.summary.output.lines.column)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
pub fn longest_row(&self) -> u32 {
|
||||
|
||||
Reference in New Issue
Block a user