[hackers] [st] toggle ATTR_REVERSE on selected text, factored some code and fixed Makefile. || Aurélien Aptel

From: <hg_AT_suckless.org>
Date: Tue, 31 Aug 2010 09:02:23 +0000 (UTC)

changeset: 117:136a08071be7
tag: tip
user: Aurélien Aptel <aurelien.aptel_AT_gmail.com>
date: Tue Aug 31 11:02:17 2010 +0200
files: Makefile st.c
description:
toggle ATTR_REVERSE on selected text, factored some code and fixed Makefile.

diff -r 350b0cbf9610 -r 136a08071be7 Makefile
--- a/Makefile Mon Aug 30 23:49:15 2010 +0200
+++ b/Makefile Tue Aug 31 11:02:17 2010 +0200
@@ -8,7 +8,7 @@
 
 all: options st
 
-options: options
+options:
         @echo st build options:
         @echo "CFLAGS = ${CFLAGS}"
         @echo "LDFLAGS = ${LDFLAGS}"
diff -r 350b0cbf9610 -r 136a08071be7 st.c
--- a/st.c Mon Aug 30 23:49:15 2010 +0200
+++ b/st.c Tue Aug 31 11:02:17 2010 +0200
@@ -828,22 +828,17 @@
                         case 25:
                                 term.c.state |= CURSOR_HIDE;
                                 break;
+ case 1049: /* = 1047 and 1048 */
                         case 1047:
                                 if(IS_SET(MODE_ALTSCREEN)) {
                                         tclearregion(0, 0, term.col-1, term.row-1);
                                         tswapscreen();
                                 }
- break;
+ if(escseq.arg[0] == 1047)
+ break;
                         case 1048:
                                 tcursor(CURSOR_LOAD);
                                 break;
- case 1049:
- tcursor(CURSOR_LOAD);
- if(IS_SET(MODE_ALTSCREEN)) {
- tclearregion(0, 0, term.col-1, term.row-1);
- tswapscreen();
- }
- break;
                         default:
                                 goto unknown;
                         }
@@ -888,22 +883,17 @@
                         case 25:
                                 term.c.state &= ~CURSOR_HIDE;
                                 break;
+ case 1049: /* = 1047 and 1048 */
                         case 1047:
                                 if(IS_SET(MODE_ALTSCREEN))
                                         tclearregion(0, 0, term.col-1, term.row-1);
                                 else
                                         tswapscreen();
- break;
+ if(escseq.arg[0] == 1047)
+ break;
                         case 1048:
                                 tcursor(CURSOR_SAVE);
                                 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;
                         }
                 } else {
@@ -1222,6 +1212,7 @@
         xw.bufw = xw.w - 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.hasfocus = 1;
         /* gc */
         dc.gc = XCreateGC(xw.dis, xw.win, 0, NULL);
         XMapWindow(xw.dis, xw.win);
@@ -1322,7 +1313,7 @@
                 for(x = 0; x < term.col; x++) {
                         new = term.line[y][x];
                         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) ||
                                         i >= DRAW_BUF_SIZ)) {
                                 xdraws(buf, base, ox, y, i);
Received on Tue Aug 31 2010 - 11:02:23 CEST

This archive was generated by hypermail 2.2.0 : Tue Aug 31 2010 - 11:12:04 CEST