diff options
author | hoek <hoek@FreeBSD.org> | 1999-09-03 22:31:21 +0000 |
---|---|---|
committer | hoek <hoek@FreeBSD.org> | 1999-09-03 22:31:21 +0000 |
commit | a14fe466b1bc7f6e0a024da706d5f849e07a3b40 (patch) | |
tree | a3145fa3f31b2a9a15501e50754def79997b3fbe /usr.bin/more/prim.c | |
parent | a32483c43a601f2cc715b32d78e7ca81703c8341 (diff) | |
download | FreeBSD-src-a14fe466b1bc7f6e0a024da706d5f849e07a3b40.zip FreeBSD-src-a14fe466b1bc7f6e0a024da706d5f849e07a3b40.tar.gz |
Thorough revamp of how input commands are processed. This allows customization
of user keys (documentation pending). The only key whose semantics have
changed is the capital 'N' key, which now performs a repeat-search in the
opposite direction (just like in vi).
This commit is a little bulkier than what I had originally planned. I'm not
completely happy with the direction it went, but it's definately an
improvement, and the alternative is to continue becoming irrelevant compared
to GNU less. (Does anyone even _use_ /usr/bin/more these days?)
Diffstat (limited to 'usr.bin/more/prim.c')
-rw-r--r-- | usr.bin/more/prim.c | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/usr.bin/more/prim.c b/usr.bin/more/prim.c index 03fcad8..eb76f95 100644 --- a/usr.bin/more/prim.c +++ b/usr.bin/more/prim.c @@ -313,7 +313,7 @@ prepaint(pos) off_t pos; { hit_eof = 0; - forw(sc_height-1, pos, 0); + forw(sc_height - 1, pos, 0); screen_trashed = 0; } @@ -581,26 +581,18 @@ gomark(c) new_horiz_off = marks[c-'a'].horiz_off; } - /* Try to be nice about changing the horizontal scroll */ - if (!(horiz_off == NO_HORIZ_OFF && new_horiz_off <= sc_width)) { + /* Try to be nice about changing the horizontal scroll and wrapping */ + if (new_horiz_off > sc_width / 3 + horiz_off) { /* - * We're going to have to change the horiz_off, even if - * it's currently set to NO_HORIZ_OFF: if we don't change - * horiz_off the bookmarked location won't show on the screen. + * We should change horiz_off: if we don't change horiz_off + * the bookmarked location won't be readily visible. */ - if (horiz_off != new_horiz_off) { - /* We'll need to repaint(), too... */ - horiz_off = new_horiz_off; - prepaint(pos); - } else { - /* No need to repaint. */ - jump_loc(pos); - } + horiz_off = new_horiz_off; + prepaint(pos); } else { /* - * The user doesn't want horizontal scrolling, and we can - * fortunately honour the bookmark request without doing - * any horizontal scrolling. + * We can honour the bookmark request without doing any + * horizontal scrolling. */ jump_loc(pos); } |