                  { --- Screen page scrolling --- }

procedure scroll_up_line(n:integer);    { scroll screen page up n lines }
var i,m: integer;
begin
m:=min(n,n_lines-page_bottom_line);
if m>0 then
    begin
    page_top_line:=page_top_line+m;
    find_page_bottom_line;
    for i:=1 to m do
        begin
        page_top_index:=page_top_index+ch_to_eol(page_top_index)+1;
        find_page_bottom_index;
        cursor_to(SCREENLEFT,SCREENTOP); DelLine;
        cursor_to(SCREENLEFT,SCREENBOTTOM);
        display_rest_line(page_bottom_index,SCREENLEFT,SCREENBOTTOM);
        end;
    end;
end; { scroll_up }

procedure scroll_down_line(n:integer);    { scroll screen page down n lines }
var i,m: integer;
begin
m:=min(n,page_top_line-1);
if m>0 then
    begin
    page_top_line:=page_top_line-m;
    find_page_bottom_line;
    cursor_to(SCREENLEFT,SCREENTOP);
    for i:=1 to m do
        begin
        page_top_index:=page_top_index-ch_to_bol(page_top_index-1)-1;
        find_page_bottom_index;
        InsLine;
        display_rest_line(page_top_index,SCREENLEFT,SCREENTOP);
        end;
    end;
end; { scroll_down }

