@@ -1489,18 +1489,19 @@ pub fn scroll(cx: &mut Context, offset: usize, direction: Direction) {
14891489 &annotations,
14901490 );
14911491
1492− let head;
1492+ let mut head;
14931493 match direction {
14941494 Forward => {
1495− head = char_idx_at_visual_offset(
1495+ let off;
1496+ (head, off) = char_idx_at_visual_offset(
14961497 doc_text,
14971498 view.offset.anchor,
14981499 (view.offset.vertical_offset + scrolloff) as isize,
14991500 0,
15001501 &text_fmt,
15011502 &annotations,
1502− )
1503− .0;
1503+ );
1504+ head += (off != 0) as usize;
15041505 if head <= cursor {
15051506 return;
15061507 }