aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto E. Vargas Caballero <k0ga@shike2.com>2014-08-07 10:11:38 +0200
committerRoberto E. Vargas Caballero <k0ga@shike2.com>2014-08-07 10:11:38 +0200
commit8de8ae3923b3b91b034077c8c35acba629588233 (patch)
tree72c5c5005236080a5552196ebbd8ece2068c45d4
parentec3268961d1dc4072f6caa6f97db5436da2ff411 (diff)
downloadst-8de8ae3923b3b91b034077c8c35acba629588233.tar.gz
st-8de8ae3923b3b91b034077c8c35acba629588233.zip
Unset mode when clearing regions
tclearregion() was clearing regions using spaces and the current attributes of the terminal. It was correct with all the modes excepct underline, because they didn't affect the space character, but in the case of underline it was a problem. A easy way of seeing this problem is writing this in the last line of the terminal: tput smul ; echo first; tput rmul; echo second; echo third Fist was underlined, and second and third were not underlined, but the spaces at the right of second was underlined becuause in the previous scrool underline mode was set.
-rw-r--r--st.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/st.c b/st.c
index 45bc89d..e0aae9d 100644
--- a/st.c
+++ b/st.c
@@ -1553,6 +1553,7 @@ tsetchar(char *c, Glyph *attr, int x, int y) {
1553void 1553void
1554tclearregion(int x1, int y1, int x2, int y2) { 1554tclearregion(int x1, int y1, int x2, int y2) {
1555 int x, y, temp; 1555 int x, y, temp;
1556 Glyph *gp;
1556 1557
1557 if(x1 > x2) 1558 if(x1 > x2)
1558 temp = x1, x1 = x2, x2 = temp; 1559 temp = x1, x1 = x2, x2 = temp;
@@ -1567,10 +1568,13 @@ tclearregion(int x1, int y1, int x2, int y2) {
1567 for(y = y1; y <= y2; y++) { 1568 for(y = y1; y <= y2; y++) {
1568 term.dirty[y] = 1; 1569 term.dirty[y] = 1;
1569 for(x = x1; x <= x2; x++) { 1570 for(x = x1; x <= x2; x++) {
1571 gp = &term.line[y][x];
1570 if(selected(x, y)) 1572 if(selected(x, y))
1571 selclear(NULL); 1573 selclear(NULL);
1572 term.line[y][x] = term.c.attr; 1574 gp->fg = term.c.attr.fg;
1573 memcpy(term.line[y][x].c, " ", 2); 1575 gp->bg = term.c.attr.bg;
1576 gp->mode = 0;
1577 memcpy(gp->c, " ", 2);
1574 } 1578 }
1575 } 1579 }
1576} 1580}