Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-core/src/movement.rs')
| -rw-r--r-- | helix-core/src/movement.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/helix-core/src/movement.rs b/helix-core/src/movement.rs index 54eb02fd..f5c2b2ed 100644 --- a/helix-core/src/movement.rs +++ b/helix-core/src/movement.rs @@ -79,19 +79,19 @@ pub fn move_vertically_visual( Direction::Backward => -(count as isize), }; - // TODO how to handle inline annotations that span an entire visual line (very unlikely). - // Compute visual offset relative to block start to avoid trasversing the block twice row_off += visual_pos.row as isize; - let new_pos = char_idx_at_visual_offset( + let (mut new_pos, virtual_rows) = char_idx_at_visual_offset( slice, block_off, row_off, new_col as usize, text_fmt, annotations, - ) - .0; + ); + if dir == Direction::Forward { + new_pos += (virtual_rows != 0) as usize; + } // Special-case to avoid moving to the end of the last non-empty line. if behaviour == Movement::Extend && slice.line(slice.char_to_line(new_pos)).len_chars() == 0 { |