@@ -1953,3 +1953,50 @@ pub fn space_mode(cx: &mut Context) {
1957+pub fn view_mode(cx: &mut Context) {
1958+ cx.on_next_key(move |cx, event| {
1960+ code: KeyCode::Char(ch),
1964+ // if lock, call cx again
1965+ // TODO: temporarily show VIE in the mode list
1973+ let (view, doc) = cx.current();
1974+ let pos = doc.selection(view.id).cursor();
1975+ // TODO: extract this centering into a function to share with _goto?
1976+ let line = doc.text().char_to_line(pos);
1978+ let relative = match ch {
1979+ 'z' | 'c' => view.area.height as usize / 2,
1981+ 'b' => view.area.height as usize,
1982+ _ => unreachable!()
1984+ view.first_line = line.saturating_sub(relative);
1987+ let (view, doc) = cx.current();
1988+ let pos = doc.selection(view.id).cursor();
1989+ let pos = coords_at_pos(doc.text().slice(..), pos);
1991+ const OFFSET: usize = 7; // gutters
1992+ view.first_col = pos.col.saturating_sub((view.area.width as usize - OFFSET) / 2);
1995+ 'j' => scroll(cx, 1, Direction::Forward),
1996+ 'k' => scroll(cx, 1, Direction::Backward),