summaryrefslogtreecommitdiff
path: root/src/fe-text
diff options
context:
space:
mode:
Diffstat (limited to 'src/fe-text')
-rw-r--r--src/fe-text/term-terminfo.c20
-rw-r--r--src/fe-text/terminfo-core.c21
-rw-r--r--src/fe-text/terminfo-core.h5
3 files changed, 42 insertions, 4 deletions
diff --git a/src/fe-text/term-terminfo.c b/src/fe-text/term-terminfo.c
index f17e354f..56ae53c1 100644
--- a/src/fe-text/term-terminfo.c
+++ b/src/fe-text/term-terminfo.c
@@ -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)
diff --git a/src/fe-text/terminfo-core.c b/src/fe-text/terminfo-core.c
index 9cbd4e20..6e3008de 100644
--- a/src/fe-text/terminfo-core.c
+++ b/src/fe-text/terminfo-core.c
@@ -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 ?
diff --git a/src/fe-text/terminfo-core.h b/src/fe-text/terminfo-core.h
index 906d4163..480ffc07 100644
--- a/src/fe-text/terminfo-core.h
+++ b/src/fe-text/terminfo-core.h
@@ -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 */