version 1.1.1.1, 1996/09/21 05:39:42 |
version 1.1.1.2, 2003/04/13 18:21:21 |
|
|
/* |
/* |
* Copyright (c) 1984,1985,1989,1994,1995 Mark Nudelman |
* Copyright (C) 1984-2002 Mark Nudelman |
* All rights reserved. |
|
* |
* |
* Redistribution and use in source and binary forms, with or without |
* You may distribute under the terms of either the GNU General Public |
* modification, are permitted provided that the following conditions |
* License or the Less License, as specified in the README file. |
* are met: |
|
* 1. Redistributions of source code must retain the above copyright |
|
* notice, this list of conditions and the following disclaimer. |
|
* 2. Redistributions in binary form must reproduce the above copyright |
|
* notice in the documentation and/or other materials provided with |
|
* the distribution. |
|
* |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY |
* For more information about less, or for information on how to |
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
* contact the author, see the README file. |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE |
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT |
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
|
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
|
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
|
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
*/ |
*/ |
|
|
|
|
|
|
public int hit_eof; /* Keeps track of how many times we hit end of file */ |
public int hit_eof; /* Keeps track of how many times we hit end of file */ |
public int screen_trashed; |
public int screen_trashed; |
public int squished; |
public int squished; |
|
public int no_back_scroll = 0; |
|
|
extern int sigs; |
extern int sigs; |
extern int top_scroll; |
extern int top_scroll; |
|
|
extern int plusoption; |
extern int plusoption; |
extern int forw_scroll; |
extern int forw_scroll; |
extern int back_scroll; |
extern int back_scroll; |
extern int need_clr; |
|
extern int ignore_eoi; |
extern int ignore_eoi; |
|
extern int clear_bg; |
|
extern int final_attr; |
#if TAGS |
#if TAGS |
extern char *tagoption; |
extern char *tagoption; |
#endif |
#endif |
|
|
|
|
if (!do_repaint) |
if (!do_repaint) |
{ |
{ |
|
/* |
|
* Forget any current line shift we might have |
|
* (from the last line of the previous screenful). |
|
*/ |
|
extern int cshift; |
|
cshift = 0; |
|
|
if (top_scroll && n >= sc_height - 1 && pos != ch_length()) |
if (top_scroll && n >= sc_height - 1 && pos != ch_length()) |
{ |
{ |
/* |
/* |
|
|
* to hit eof in the middle of this screen, |
* to hit eof in the middle of this screen, |
* but we don't yet know if that will happen. }} |
* but we don't yet know if that will happen. }} |
*/ |
*/ |
|
pos_clear(); |
|
add_forw_pos(pos); |
|
force = 1; |
if (top_scroll == OPT_ONPLUS || first_time) |
if (top_scroll == OPT_ONPLUS || first_time) |
clear(); |
clear(); |
home(); |
home(); |
force = 1; |
|
} else |
} else |
{ |
{ |
clear_bot(); |
clear_bot(); |
|
|
/* |
/* |
* End of file: stop here unless the top line |
* End of file: stop here unless the top line |
* is still empty, or "force" is true. |
* is still empty, or "force" is true. |
|
* Even if force is true, stop when the last |
|
* line in the file reaches the top of screen. |
*/ |
*/ |
eof = 1; |
eof = 1; |
if (!force && position(TOP) != NULL_POSITION) |
if (!force && position(TOP) != NULL_POSITION) |
break; |
break; |
|
if (!empty_lines(0, 0) && |
|
!empty_lines(1, 1) && |
|
empty_lines(2, sc_height-1)) |
|
break; |
} |
} |
} |
} |
/* |
/* |
|
|
squished = 1; |
squished = 1; |
continue; |
continue; |
} |
} |
if (top_scroll == 1) |
if (top_scroll == OPT_ON) |
clear_eol(); |
clear_eol(); |
put_line(); |
put_line(); |
|
if (clear_bg && final_attr != AT_NORMAL) |
|
{ |
|
/* |
|
* Writing the last character on the last line |
|
* of the display may have scrolled the screen. |
|
* If we were in standout mode, clear_bg terminals |
|
* will fill the new line with the standout color. |
|
* Now we're in normal mode again, so clear the line. |
|
*/ |
|
clear_eol(); |
|
} |
} |
} |
|
|
if (ignore_eoi) |
if (ignore_eoi) |
|
|
{ |
{ |
POSITION pos; |
POSITION pos; |
|
|
if (quit_at_eof && hit_eof) |
if (quit_at_eof && hit_eof && !(ch_getflags() & CH_HELPFILE)) |
{ |
{ |
/* |
/* |
* If the -e flag is set and we're trying to go |
* If the -e flag is set and we're trying to go |
|
|
public int |
public int |
get_back_scroll() |
get_back_scroll() |
{ |
{ |
|
if (no_back_scroll) |
|
return (0); |
if (back_scroll >= 0) |
if (back_scroll >= 0) |
return (back_scroll); |
return (back_scroll); |
if (top_scroll) |
if (top_scroll) |