]> git.armaanb.net Git - st.git/commitdiff
Merge branch 'master' of ssh://suckless.org/gitrepos/st
authorRoberto E. Vargas Caballero <k0ga@shike2.com>
Tue, 14 Apr 2015 07:47:19 +0000 (09:47 +0200)
committerRoberto E. Vargas Caballero <k0ga@shike2.com>
Tue, 14 Apr 2015 07:47:19 +0000 (09:47 +0200)
TODO
st.c

diff --git a/TODO b/TODO
index 90e3d568a070f0242fe2421df788e17530f15ffc..5f74cd524f72ad272fa750ae86502156c5e7fd6e 100644 (file)
--- a/TODO
+++ b/TODO
@@ -19,7 +19,6 @@ bugs
 ----
 
 * fix shift up/down (shift selection in emacs)
-* fix -e handling
 * remove DEC test sequence when appropriate
 
 misc
diff --git a/st.c b/st.c
index 6bfa834b7ddf8128c413a2076b34c34fe8316729..40840ce58f515b6fd115d4f01f1a4116ce2df1e8 100644 (file)
--- a/st.c
+++ b/st.c
@@ -1,4 +1,4 @@
-/* See LICENSE for licence details. */
+/* See LICENSE for license details. */
 #include <ctype.h>
 #include <errno.h>
 #include <fcntl.h>
@@ -944,7 +944,7 @@ getsel(void) {
        ptr = str = xmalloc(bufsize);
 
        /* append every set & selected glyph to the selection */
-       for(y = sel.nb.y; y < sel.ne.y + 1; y++) {
+       for(y = sel.nb.y; y <= sel.ne.y; y++) {
                linelen = tlinelen(y);
 
                if(sel.type == SEL_RECTANGULAR) {
@@ -1576,11 +1576,9 @@ tmoveto(int x, int y) {
                miny = 0;
                maxy = term.row - 1;
        }
-       LIMIT(x, 0, term.col-1);
-       LIMIT(y, miny, maxy);
        term.c.state &= ~CURSOR_WRAPNEXT;
-       term.c.x = x;
-       term.c.y = y;
+       term.c.x = LIMIT(x, 0, term.col-1);
+       term.c.y = LIMIT(y, miny, maxy);
 }
 
 void
@@ -2451,21 +2449,19 @@ tdectest(char c) {
 
 void
 tstrsequence(uchar c) {
-       if (c & 0x80) {
-               switch (c) {
-               case 0x90:   /* DCS -- Device Control String */
-                       c = 'P';
-                       break;
-               case 0x9f:   /* APC -- Application Program Command */
-                       c = '_';
-                       break;
-               case 0x9e:   /* PM -- Privacy Message */
-                       c = '^';
-                       break;
-               case 0x9d:   /* OSC -- Operating System Command */
-                       c = ']';
-                       break;
-               }
+       switch (c) {
+       case 0x90:   /* DCS -- Device Control String */
+               c = 'P';
+               break;
+       case 0x9f:   /* APC -- Application Program Command */
+               c = '_';
+               break;
+       case 0x9e:   /* PM -- Privacy Message */
+               c = '^';
+               break;
+       case 0x9d:   /* OSC -- Operating System Command */
+               c = ']';
+               break;
        }
        strreset();
        strescseq.type = c;
@@ -2774,7 +2770,6 @@ tresize(int col, int row) {
        int i;
        int minrow = MIN(row, term.row);
        int mincol = MIN(col, term.col);
-       int slide = term.c.y - row + 1;
        bool *bp;
        TCursor c;
 
@@ -2784,21 +2779,17 @@ tresize(int col, int row) {
                return;
        }
 
-       /* free unneeded rows */
-       i = 0;
-       if(slide > 0) {
-               /*
-                * slide screen to keep cursor where we expect it -
-                * tscrollup would work here, but we can optimize to
-                * memmove because we're freeing the earlier lines
-                */
-               for(/* i = 0 */; i < slide; i++) {
-                       free(term.line[i]);
-                       free(term.alt[i]);
-               }
-               memmove(term.line, term.line + slide, row * sizeof(Line));
-               memmove(term.alt, term.alt + slide, row * sizeof(Line));
+       /*
+        * slide screen to keep cursor where we expect it -
+        * tscrollup would work here, but we can optimize to
+        * memmove because we're freeing the earlier lines
+        */
+       for(i = 0; i <= term.c.y - row; i++) {
+               free(term.line[i]);
+               free(term.alt[i]);
        }
+       memmove(term.line, term.line + i, row * sizeof(Line));
+       memmove(term.alt, term.alt + i, row * sizeof(Line));
        for(i += row; i < term.row; i++) {
                free(term.line[i]);
                free(term.alt[i]);
@@ -3922,17 +3913,13 @@ run(void) {
        long deltatime;
 
        /* Waiting for window mapping */
-       while(1) {
+       do {
                XNextEvent(xw.dpy, &ev);
-               if(XFilterEvent(&ev, None))
-                       continue;
                if(ev.type == ConfigureNotify) {
                        w = ev.xconfigure.width;
                        h = ev.xconfigure.height;
-               } else if(ev.type == MapNotify) {
-                       break;
                }
-       }
+       } while(ev.type != MapNotify);
 
        ttynew();
        cresize(w, h);
@@ -4026,7 +4013,6 @@ usage(void) {
 
 int
 main(int argc, char *argv[]) {
-       char *titles;
        uint cols = 80, rows = 24;
 
        xw.l = xw.t = 0;
@@ -4044,10 +4030,8 @@ main(int argc, char *argv[]) {
                /* eat all remaining arguments */
                if(argc > 1) {
                        opt_cmd = &argv[1];
-                       if(argv[1] != NULL && opt_title == NULL) {
-                               titles = xstrdup(argv[1]);
-                               opt_title = basename(titles);
-                       }
+                       if(argv[1] != NULL && opt_title == NULL)
+                               opt_title = basename(xstrdup(argv[1]));
                }
                goto run;
        case 'f':