char* view_getctx(View* view);
void view_selctx(View* view);
void view_scroll(View* view, int move);
-void view_csrsummon(View* view);
void view_scrollpage(View* view, int move);
void view_setln(View* view, size_t line);
void view_indent(View* view, int dir);
}
}
-void view_csrsummon(View* view) {
- Row* midrow = view->rows[view->nrows/2];
- size_t col = SIZE_MAX, row = SIZE_MAX, off = midrow->off;
- find_cursor(view, &col, &row);
- if (row != SIZE_MAX && col != SIZE_MAX)
- off += (col >= midrow->rlen ? (midrow->rlen - 1) : col);
- view_jumpto(view, false, off);
- view->sync_needed = false;
-}
-
void view_scrollpage(View* view, int move) {
move = (move < 0 ? -1 : 1) * view->nrows;
view_scroll(view, move);
- view_csrsummon(view);
}
void view_indent(View* view, int dir) {
view_byrune(win_view(FOCUSED), RIGHT, extsel);
}
-static void cursor_warp(char* arg) {
- view_csrsummon(win_view(FOCUSED));
-}
-
static void page_up(char* arg) {
view_scrollpage(win_view(FOCUSED), UP);
}
{ ModAny, KEY_DOWN, cursor_dn },
{ ModAny, KEY_LEFT, cursor_left },
{ ModAny, KEY_RIGHT, cursor_right },
- { ModCtrl, ';', cursor_warp },
/* Standard Unix Shortcuts */
{ ModCtrl, 'u', del_to_bol },
void onshutdown(void) {
quit(0);
- exit(0);
}
static void oninput(Rune rune) {