forked from PsychoticNinja/irssi
terminfo's term_clrtoeol() uses the clrtoeol() command only when using the default colors. otherwise it just goes and fills the line with spaces.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1941 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
2500457729
commit
3cdedf5b4b
@ -177,9 +177,13 @@ void term_window_clear(TERM_WINDOW *window)
|
||||
int y;
|
||||
|
||||
terminfo_set_normal();
|
||||
for (y = 0; y < window->height; y++) {
|
||||
term_move(window, 0, y);
|
||||
term_clrtoeol(window);
|
||||
if (window->y == 0 && window->height == term_height) {
|
||||
term_clear();
|
||||
} else {
|
||||
for (y = 0; y < window->height; y++) {
|
||||
term_move(window, 0, y);
|
||||
term_clrtoeol(window);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -280,7 +284,15 @@ void term_addstr(TERM_WINDOW *window, char *str)
|
||||
|
||||
void term_clrtoeol(TERM_WINDOW *window)
|
||||
{
|
||||
terminfo_clrtoeol();
|
||||
if (last_fg == -1 && last_bg == -1 &&
|
||||
(last_attrs & (ATTR_UNDERLINE|ATTR_REVERSE)) == 0) {
|
||||
/* clrtoeol() doesn't necessarily understand colors */
|
||||
terminfo_clrtoeol();
|
||||
} else if (vcx < term_width) {
|
||||
/* we'll need to fill the line ourself. */
|
||||
terminfo_repeat(' ', term_width-vcx);
|
||||
terminfo_move(vcx, vcy);
|
||||
}
|
||||
}
|
||||
|
||||
void term_move_cursor(int x, int y)
|
||||
|
@ -269,6 +269,21 @@ static void _clrtoeol(TERM_REC *term)
|
||||
tput(tparm(term->TI_el));
|
||||
}
|
||||
|
||||
/* Repeat character (rep / rp) */
|
||||
static void _repeat(TERM_REC *term, int chr, int count)
|
||||
{
|
||||
tput(tparm(term->TI_rep, chr, count));
|
||||
}
|
||||
|
||||
/* Repeat character (manual) */
|
||||
static void _repeat_manual(TERM_REC *term, int chr, int count)
|
||||
{
|
||||
while (count > 0) {
|
||||
putc(chr, term->out);
|
||||
count--;
|
||||
}
|
||||
}
|
||||
|
||||
/* Reset all terminal attributes */
|
||||
static void _set_normal(TERM_REC *term)
|
||||
{
|
||||
@ -554,6 +569,12 @@ static int term_setup(TERM_REC *term)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Repeating character */
|
||||
if (term->TI_rep)
|
||||
term->repeat = _repeat;
|
||||
else
|
||||
term->repeat = _repeat_manual;
|
||||
|
||||
/* Bold, underline, standout */
|
||||
term->set_bold = term->TI_bold ? _set_bold : _ignore;
|
||||
term->set_uline = term->TI_smul && term->TI_rmul ?
|
||||
|
@ -8,6 +8,7 @@
|
||||
#define terminfo_scroll(y1, y2, count) current_term->scroll(current_term, y1, y2, count)
|
||||
#define terminfo_clear() current_term->clear(current_term)
|
||||
#define terminfo_clrtoeol() current_term->clrtoeol(current_term)
|
||||
#define terminfo_repeat(chr, count) current_term->repeat(current_term, chr, count)
|
||||
#define terminfo_set_fg(color) current_term->set_fg(current_term, color)
|
||||
#define terminfo_set_bg(color) current_term->set_bg(current_term, color)
|
||||
#define terminfo_set_normal() current_term->set_normal(current_term)
|
||||
@ -27,6 +28,7 @@ struct _TERM_REC {
|
||||
|
||||
void (*clear)(TERM_REC *term);
|
||||
void (*clrtoeol)(TERM_REC *term);
|
||||
void (*repeat)(TERM_REC *term, int chr, int count);
|
||||
|
||||
void (*set_fg)(TERM_REC *term, int color);
|
||||
void (*set_bg)(TERM_REC *term, int color);
|
||||
@ -61,6 +63,9 @@ struct _TERM_REC {
|
||||
/* Clearing to end of line */
|
||||
const char *TI_el;
|
||||
|
||||
/* Repeating character */
|
||||
const char *TI_rep;
|
||||
|
||||
/* Colors */
|
||||
int has_colors;
|
||||
const char *TI_sgr0; /* turn off all attributes */
|
||||
|
Loading…
x
Reference in New Issue
Block a user