Use current screen size rather than original terminal size in term_clear_screen()

Also renames the function term_clrscr() to term_clear_screen() and remove the term_clear_screen()
macro.
This commit is contained in:
Kevin Easton
2018-05-05 13:34:13 +10:00
parent 1e97709bd8
commit 563ab3efeb
2 changed files with 8 additions and 8 deletions

View File

@@ -698,7 +698,6 @@ int tputs_x(char *);
#define term_cursor_left() term_left(1)
#define term_cursor_right() term_right(1)
#define term_clear_to_eol() term_clreol()
#define term_clear_screen() term_clrscr()
#ifdef __EMX__
extern int vio_screen;
@@ -720,7 +719,7 @@ SIGNAL_HANDLER(term_cont);
void term_right (int);
void term_left (int);
void term_clreol (void);
void term_clrscr (void);
void term_clear_screen (void);
void term_gotoxy (int, int);
void term_reset (void);
int term_eight_bit (void);

View File

@@ -1351,15 +1351,16 @@ void term_gotoxy (int col, int row)
}
/* A no-brainer. Clear the screen. */
void term_clrscr (void)
void term_clear_screen(void)
{
#if defined(__EMX__) && !defined(__EMXX__) && !defined(GUI)
VioScrollUp(0, 0, -1, -1, -1, &default_pair, vio_screen);
#elif defined(GUI)
gui_clrscr();
#else
int i;
/* This is called from scr-bx with output_screen == NULL */
const long li = output_screen ? output_screen->li : current_term->li;
/* We have a specific cap for clearing the screen */
if (current_term->TI_clear)
@@ -1379,27 +1380,27 @@ void term_clrscr (void)
/* We can also clear by deleteing lines ... */
else if (current_term->TI_dl)
{
tputs_x(tparm1(current_term->TI_dl, current_term->TI_lines));
tputs_x(tparm1(current_term->TI_dl, li));
return;
}
/* ... in this case one line at a time */
else if (current_term->TI_dl1)
{
for (i = 0; i < current_term->TI_lines; i++)
for (i = 0; i < li; i++)
tputs_x(current_term->TI_dl1);
return;
}
/* As a last resort we can insert lines ... */
else if (current_term->TI_il)
{
tputs_x(tparm1(current_term->TI_il, current_term->TI_lines));
tputs_x(tparm1(current_term->TI_il, li));
term_gotoxy (0, 0);
return;
}
/* ... one line at a time */
else if (current_term->TI_il1)
{
for (i = 0; i < current_term->TI_lines; i++)
for (i = 0; i < li; i++)
tputs_x(current_term->TI_il1);
term_gotoxy (0, 0);
}