Changeset d574d61


Ignore:
Timestamp:
Sep 18, 2010, 5:07:39 PM (14 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.10, release-1.7, release-1.8, release-1.9
Children:
fa23002
Parents:
9eb38bb
git-author:
David Benjamin <davidben@mit.edu> (08/01/10 14:50:27)
git-committer:
David Benjamin <davidben@mit.edu> (09/18/10 17:07:39)
Message:
Add owl_viewwin_up and owl_viewwin_down

So we have one consistent place for the clipping logic. Also, take
BOTTOM_OFFSET into account in owl_viewwin_pageup.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • viewwin.c

    r9eb38bb rd574d61  
    116116}
    117117
    118 void owl_viewwin_pagedown(owl_viewwin *v)
    119 {
    120   int winlines;
    121   owl_window_get_position(v->window, &winlines, 0, 0, 0);
    122   v->topline+=winlines - BOTTOM_OFFSET;
     118void owl_viewwin_down(owl_viewwin *v, int amount) {
     119  int winlines;
     120  owl_window_get_position(v->window, &winlines, 0, 0, 0);
     121  v->topline += amount;
    123122  if ( (v->topline+winlines-BOTTOM_OFFSET) > v->textlines) {
    124123    v->topline = v->textlines - winlines + BOTTOM_OFFSET;
     
    127126}
    128127
     128void owl_viewwin_up(owl_viewwin *v, int amount)
     129{
     130  v->topline -= amount;
     131  if (v->topline<0) v->topline=0;
     132  owl_viewwin_dirty(v);
     133}
     134
     135void owl_viewwin_pagedown(owl_viewwin *v)
     136{
     137  int winlines;
     138  owl_window_get_position(v->window, &winlines, 0, 0, 0);
     139  owl_viewwin_down(v, winlines - BOTTOM_OFFSET);
     140}
     141
    129142void owl_viewwin_linedown(owl_viewwin *v)
    130143{
    131   int winlines;
    132   owl_window_get_position(v->window, &winlines, 0, 0, 0);
    133   v->topline++;
    134   if ( (v->topline+winlines-BOTTOM_OFFSET) > v->textlines) {
    135     v->topline = v->textlines - winlines + BOTTOM_OFFSET;
    136   }
    137   owl_viewwin_dirty(v);
     144  owl_viewwin_down(v, 1);
    138145}
    139146
     
    142149  int winlines;
    143150  owl_window_get_position(v->window, &winlines, 0, 0, 0);
    144   v->topline-=winlines;
    145   if (v->topline<0) v->topline=0;
    146   owl_viewwin_dirty(v);
    147 
     151  owl_viewwin_up(v, winlines - BOTTOM_OFFSET);
    148152}
    149153
    150154void owl_viewwin_lineup(owl_viewwin *v)
    151155{
    152   v->topline--;
    153   if (v->topline<0) v->topline=0;
    154   owl_viewwin_dirty(v);
     156  owl_viewwin_up(v, 1);
    155157}
    156158
Note: See TracChangeset for help on using the changeset viewer.