@@ -1489,18 +1489,19 @@ pub fn scroll(cx: &mut Context, offset: usize, direction: Direction) {
1489 &annotations,
1489 &annotations,
1492− let head;
1492+ let mut head;
1493 match direction {
1493 match direction {
1494 Forward => {
1494 Forward => {
1495− head = char_idx_at_visual_offset(
1496+ (head, off) = char_idx_at_visual_offset(
1496 doc_text,
1497 doc_text,
1497 view.offset.anchor,
1498 view.offset.anchor,
1498 (view.offset.vertical_offset + scrolloff) as isize,
1499 (view.offset.vertical_offset + scrolloff) as isize,
1500 &text_fmt,
1501 &text_fmt,
1501 &annotations,
1502 &annotations,
1503− .0;
1504+ head += (off != 0) as usize;
1504 if head <= cursor {
1505 if head <= cursor {