toggle ATTR_REVERSE on selected text, factored some code and fixed Makefile.

This commit is contained in:
Aurélien Aptel 2010-08-31 11:02:17 +02:00
parent 596bb133a5
commit 160bda1b60
2 changed files with 9 additions and 18 deletions

View file

@ -8,7 +8,7 @@ OBJ = ${SRC:.c=.o}
all: options st all: options st
options: options options:
@echo st build options: @echo st build options:
@echo "CFLAGS = ${CFLAGS}" @echo "CFLAGS = ${CFLAGS}"
@echo "LDFLAGS = ${LDFLAGS}" @echo "LDFLAGS = ${LDFLAGS}"

25
st.c
View file

@ -828,22 +828,17 @@ csihandle(void) {
case 25: case 25:
term.c.state |= CURSOR_HIDE; term.c.state |= CURSOR_HIDE;
break; break;
case 1049: /* = 1047 and 1048 */
case 1047: case 1047:
if(IS_SET(MODE_ALTSCREEN)) { if(IS_SET(MODE_ALTSCREEN)) {
tclearregion(0, 0, term.col-1, term.row-1); tclearregion(0, 0, term.col-1, term.row-1);
tswapscreen(); tswapscreen();
} }
break; if(escseq.arg[0] == 1047)
break;
case 1048: case 1048:
tcursor(CURSOR_LOAD); tcursor(CURSOR_LOAD);
break; break;
case 1049:
tcursor(CURSOR_LOAD);
if(IS_SET(MODE_ALTSCREEN)) {
tclearregion(0, 0, term.col-1, term.row-1);
tswapscreen();
}
break;
default: default:
goto unknown; goto unknown;
} }
@ -888,22 +883,17 @@ csihandle(void) {
case 25: case 25:
term.c.state &= ~CURSOR_HIDE; term.c.state &= ~CURSOR_HIDE;
break; break;
case 1049: /* = 1047 and 1048 */
case 1047: case 1047:
if(IS_SET(MODE_ALTSCREEN)) if(IS_SET(MODE_ALTSCREEN))
tclearregion(0, 0, term.col-1, term.row-1); tclearregion(0, 0, term.col-1, term.row-1);
else else
tswapscreen(); tswapscreen();
break; if(escseq.arg[0] == 1047)
break;
case 1048: case 1048:
tcursor(CURSOR_SAVE); tcursor(CURSOR_SAVE);
break; break;
case 1049:
tcursor(CURSOR_SAVE);
if(IS_SET(MODE_ALTSCREEN))
tclearregion(0, 0, term.col-1, term.row-1);
else
tswapscreen();
break;
default: goto unknown; default: goto unknown;
} }
} else { } else {
@ -1222,6 +1212,7 @@ xinit(void) {
xw.bufw = xw.w - 2*BORDER; xw.bufw = xw.w - 2*BORDER;
xw.bufh = xw.h - 2*BORDER; xw.bufh = xw.h - 2*BORDER;
xw.buf = XCreatePixmap(xw.dis, xw.win, xw.bufw, xw.bufh, XDefaultDepth(xw.dis, xw.scr)); xw.buf = XCreatePixmap(xw.dis, xw.win, xw.bufw, xw.bufh, XDefaultDepth(xw.dis, xw.scr));
xw.hasfocus = 1;
/* gc */ /* gc */
dc.gc = XCreateGC(xw.dis, xw.win, 0, NULL); dc.gc = XCreateGC(xw.dis, xw.win, 0, NULL);
XMapWindow(xw.dis, xw.win); XMapWindow(xw.dis, xw.win);
@ -1322,7 +1313,7 @@ draw(int redraw_all) {
for(x = 0; x < term.col; x++) { for(x = 0; x < term.col; x++) {
new = term.line[y][x]; new = term.line[y][x];
if(selbx!=-1 && new.c && selected(x, y)) if(selbx!=-1 && new.c && selected(x, y))
new.mode = ATTR_REVERSE; new.mode ^= ATTR_REVERSE;
if(i > 0 && (!(new.state & GLYPH_SET) || ATTRCMP(base, new) || if(i > 0 && (!(new.state & GLYPH_SET) || ATTRCMP(base, new) ||
i >= DRAW_BUF_SIZ)) { i >= DRAW_BUF_SIZ)) {
xdraws(buf, base, ox, y, i); xdraws(buf, base, ox, y, i);