From d61ff34ebcb21fb293fe2cb5906b8ade87561d32 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Fri, 23 Feb 2018 15:24:23 +0000 Subject: [PATCH] vile: add half screen scroll vi commands --- Applications/util/vile.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Applications/util/vile.c b/Applications/util/vile.c index 1156ea96..d0b6c17a 100644 --- a/Applications/util/vile.c +++ b/Applications/util/vile.c @@ -177,6 +177,7 @@ int lnend(void); int pgdown(void); int pgup(void); int pgup_half(void); +int pgdown_half(void); int redraw(void); int right(void); int replace(void); @@ -226,7 +227,6 @@ keytable_t modeless[] = { * Basic vi commands missing (note not all below exactly match vi yet * in their behaviour - much testing is needed * - * CTRL-D/CTRL-U half screen scrolls * CTRL-F/CTRL-B implemented but not exactly as vi * nG goto line n * W and S word skip with punctuation @@ -272,6 +272,7 @@ keytable_t modual[] = { { CTRL('F'), 0, pgdown }, /* Need D for half screen too */ { CTRL('B'), 0, pgup }, { CTRL('U'), 0, pgup_half }, + { CTRL('D'), 0, pgdown_half }, { 'w', 0, wright }, { '^', NORPT, lnbegin }, { '$', NORPT, lnend }, @@ -466,7 +467,8 @@ int pgup(void) return 0; } -/* TODO FIXME */ +/* The cursor stays in the same spot and the page moves up, unless we'd hit + the top in which case the cursor hits the top */ int pgup_half(void) { int i = LINES/2; @@ -477,6 +479,16 @@ int pgup_half(void) return 0; } +int pgdown_half(void) +{ + int i = LINES/2; + while (0 < --i) { + page = nextline(page); + down(); + } + return 0; +} + int wleft(void) { char *p; -- 2.34.1