qemacs-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemacs-commit] qemacs TODO.org extras.c shell.c stb.c


From: Charlie Gordon
Subject: [Qemacs-commit] qemacs TODO.org extras.c shell.c stb.c
Date: Sun, 11 Feb 2018 06:44:18 -0500 (EST)

CVSROOT:        /sources/qemacs
Module name:    qemacs
Changes by:     Charlie Gordon <chqrlie>        18/02/11 06:44:18

Modified files:
        .              : TODO.org extras.c shell.c stb.c 

Log message:
        Small fixes
        - support SF_NUMBER for buffer sort
        - fix image scaling
        - support ESC c and fix ESC [ J escape sequences
        - add C-u C-x C-n to parse nest-error from current buffer offset

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/TODO.org?cvsroot=qemacs&r1=1.41&r2=1.42
http://cvs.savannah.gnu.org/viewcvs/qemacs/extras.c?cvsroot=qemacs&r1=1.72&r2=1.73
http://cvs.savannah.gnu.org/viewcvs/qemacs/shell.c?cvsroot=qemacs&r1=1.136&r2=1.137
http://cvs.savannah.gnu.org/viewcvs/qemacs/stb.c?cvsroot=qemacs&r1=1.1&r2=1.2

Patches:
Index: TODO.org
===================================================================
RCS file: /sources/qemacs/qemacs/TODO.org,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -b -r1.41 -r1.42
--- TODO.org    15 May 2017 09:58:02 -0000      1.41
+++ TODO.org    11 Feb 2018 11:44:18 -0000      1.42
@@ -5,6 +5,7 @@
 
 * Recent bugs and ideas
 
+** shell: C-c C-c should abort make process
 ** basic: backspace delete hacking tabs
 ** charset: use unichar typedef
 ** charset: limit number of combining marks to 20

Index: extras.c
===================================================================
RCS file: /sources/qemacs/qemacs/extras.c,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -b -r1.72 -r1.73
--- extras.c    25 Apr 2017 17:41:27 -0000      1.72
+++ extras.c    11 Feb 2018 11:44:18 -0000      1.73
@@ -1540,7 +1540,6 @@
         p2 = vp1;
     }
 
-    // XXX: should support SF_NUMBER
     pos1 = p1->start;
     pos2 = p2->start;
     for (;;) {
@@ -1549,11 +1548,37 @@
             c1 = eb_nextc(cp->b, pos1, &pos1);
             if (!(cp->flags & SF_DICT) || qe_isalpha(c1))
                 break;
+            c1 = 0;
         }
         while (pos2 < p2->end) {
             c2 = eb_nextc(cp->b, pos2, &pos2);
             if (!(cp->flags & SF_DICT) || qe_isalpha(c2))
                 break;
+            c2 = 0;
+        }
+        if ((cp->flags & SF_NUMBER) && qe_isdigit(c1) && qe_isdigit(c2)) {
+            unsigned long long n1 = c1 - '0';
+            unsigned long long n2 = c2 - '0';
+            c1 = 0;
+            while (pos1 < p1->end) {
+                c1 = eb_nextc(cp->b, pos1, &pos1);
+                if (!qe_isdigit(c1))
+                    break;
+                n1 = n1 * 10 + c1 - '0';
+                c1 = 0;
+            }
+            c2 = 0;
+            while (pos2 < p2->end) {
+                c2 = eb_nextc(cp->b, pos2, &pos2);
+                if (!qe_isdigit(c2))
+                    break;
+                n2 = n2 * 10 + c2 - '0';
+                c2 = 0;
+            }
+            if (n1 < n2)
+                return -1;
+            if (n1 > n2)
+                return +1;
         }
         if (cp->flags & SF_FOLD) {
             // XXX: should support unicode case folding

Index: shell.c
===================================================================
RCS file: /sources/qemacs/qemacs/shell.c,v
retrieving revision 1.136
retrieving revision 1.137
diff -u -b -r1.136 -r1.137
--- shell.c     20 May 2017 20:43:14 -0000      1.136
+++ shell.c     11 Feb 2018 11:44:18 -0000      1.137
@@ -1238,6 +1238,9 @@
         case '8':   // Restore Cursor (DECRC). [rc]
             qe_term_goto_xy(s, s->save_x, s->save_y, 0);
             break;
+        case 'c':   // Full Reset (RIS). [rs1, reset_1string]
+            s->shifted = s->charset[s->cset = 0];
+            break;
         case '9':   // Forward Index (DECFI), VT420 and up.
         case '=':   // Application Keypad (DECKPAM). [smkx]
         case '>':   // Normal Keypad (DECKPNM). [rmkx, is2, rs2]
@@ -1255,7 +1258,6 @@
         case 'X':   // Start of String (SOS  is 0x98).
         case 'Z':   // Return Terminal ID (DECID is 0x9a).
                     // Obsolete form of CSI c  (DA).
-        case 'c':   // Full Reset (RIS). [rs1, reset_1string]
         case 'l':   // Memory Lock (per HP terminals).  Locks memory above the 
cursor.
         case 'm':   // Memory Unlock (per HP terminals).
         case 'n':   // Invoke the G2 Character Set as GL (LS2).
@@ -1451,51 +1453,39 @@
             /* XXX: should just force top of window to in infinite scroll mode 
*/
             {   /*     0: Below (default), 1: Above, 2: All, 3: Saved Lines 
(xterm) */
                 /* XXX: should handle eol style */
-                int cur_line, col_num1, col_num2, nc1, nc2, n1, n2;
-                int cur_offset = offset;
+                int offset0, offset1, bos, eos, col, row;
 
-                n1 = n2 = nc1 = nc2 = 0;
-                qe_term_get_pos(s, offset, NULL, &cur_line, &col_num1);
-                offset1 = eb_goto_bol(s->b, offset);
-                offset2 = eb_goto_eol(s->b, offset);
-                qe_term_get_pos(s, offset2, NULL, &cur_line, &col_num2);
+                bos = eos = 0;
                 // default param is 0
                 if (s->params[0] <= 0) {
                     /* Erase to end of screen */
-                    nc2 = col_num2 - col_num1;
-                    n2 = s->rows - cur_line - 1;
+                    eos = 1;
                 } else
                 if (s->params[0] == 1) {
                     /* Erase from beginning of screen */
-                    offset = offset1;
-                    nc1 = col_num1;
-                    n1 = cur_line - 1;
+                    bos = 1;
                 } else
-                if (s->params[0] == 2) {
+                if (s->params[0] == 2 || s->params[0] == 3) {
                     /* Erase complete screen */
-                    offset = offset1;
-                    nc1 = col_num1;
-                    nc2 = col_num2 - col_num1;
-                    n1 = cur_line - 1;
-                    n2 = s->rows - cur_line - 1;
+                    bos = eos = 1;
                 }
                 /* update cursor as overwriting characters may change offsets 
*/
+                if (bos) {
+                    qe_term_get_pos(s, offset, &offset0, &col, &row);
+                    offset1 = eb_goto_bol(s->b, offset);
                 qe_term_set_style(s);
-                if (n1) {
-                    qe_term_goto_xy(s, 0, 0, 0);
-                    offset = s->cur_offset;
-                    offset = qe_term_delete_lines(s, offset, n1);
-                    offset = qe_term_insert_lines(s, offset, n1);
+                    if (row > 0) {
+                        offset = qe_term_delete_lines(s, offset0, row);
+                        offset = qe_term_insert_lines(s, offset, row);
+                    } else {
+                        offset = eb_goto_bol(s->b, offset);
                 }
-                cur_offset = offset = qe_term_erase_chars(s, offset, nc1);
-                qe_term_erase_chars(s, offset, nc2);
-                if (n2) {
-                    offset = qe_term_skip_lines(s, offset, 1);
-                    offset = qe_term_delete_lines(s, offset, n2);
-                    offset = qe_term_insert_lines(s, offset, n2);
+                    offset = qe_term_erase_chars(s, offset, col);
                 }
-                /* update cur_offset that may have been changed by callback */ 
-                s->cur_offset = cur_offset;
+                if (eos) {
+                    eb_delete(s->b, offset, s->b->total_size - offset);
+                }
+                s->cur_offset = offset;
             }
             break;
         case 'K':  /* EL: Erase in Line. */
@@ -1535,9 +1525,9 @@
         case 'L':  /* IL: Insert Ps Line(s) (default = 1). */
             //TRACE_MSG(s, "insert lines");
             {
-                int col, row, zone;
+                int row, zone;
                 offset = eb_goto_bol(s->b, offset);
-                qe_term_get_pos(s, offset, NULL, &col, &row);
+                qe_term_get_pos(s, offset, NULL, NULL, &row);
                 zone = max(0, s->scroll_bottom - row);
                 param1 = min(param1, zone);
                 qe_term_set_style(s);
@@ -1550,9 +1540,9 @@
         case 'M':  /* DL: Delete Ps Line(s) (default = 1). */
             //TRACE_MSG(s, "delete lines");
             {
-                int col, row, zone;
+                int row, zone;
                 offset = eb_goto_bol(s->b, offset);
-                qe_term_get_pos(s, offset, NULL, &col, &row);
+                qe_term_get_pos(s, offset, NULL, NULL, &row);
                 zone = max(0, s->scroll_bottom - row);
                 param1 = min(param1, zone);
                 qe_term_set_style(s);
@@ -2846,7 +2836,7 @@
     set_error_offset(b, 0);
 }
 
-static void do_compile_error(EditState *s, int dir)
+static void do_compile_error(EditState *s, int arg, int dir)
 {
     QEmacsState *qs = s->qe_state;
     EditState *e;
@@ -2858,6 +2848,11 @@
     int c, line_num, col_num, len;
     char error_message[128];
 
+    if (arg != NO_ARG) {
+        /* called with a prefix: set the error source to the current buffer */
+        set_error_offset(s->b, s->offset);
+    }
+
     /* CG: should have a buffer flag for error source.
      * first check if current buffer is an error source.
      * if not, then scan for appropriate error source
@@ -3115,10 +3110,10 @@
     CMD2( KEY_NONE, KEY_NONE,
           "man", do_man, ESs,
           "s{Show man page for: }|man|")
-    CMD1( KEY_CTRLX(KEY_CTRL('p')), KEY_NONE,
-          "previous-error", do_compile_error, -1) /* u */
-    CMD1( KEY_CTRLX(KEY_CTRL('n')), KEY_CTRLX('`'),
-          "next-error", do_compile_error, 1) /* u */
+    CMD3( KEY_CTRLX(KEY_CTRL('p')), KEY_NONE,
+          "previous-error", do_compile_error, ESii, -1, "uiv")
+    CMD3( KEY_CTRLX(KEY_CTRL('n')), KEY_CTRLX('`'),
+          "next-error", do_compile_error, ESii, 1, "uiv")
     CMD_DEF_END,
 };
 

Index: stb.c
===================================================================
RCS file: /sources/qemacs/qemacs/stb.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- stb.c       15 May 2017 09:58:02 -0000      1.1
+++ stb.c       11 Feb 2018 11:44:18 -0000      1.2
@@ -54,8 +54,9 @@
 
     if (s->display_invalid) {
         if (ms && ms->stb_image) {
-            int x0, y0, w, h;
 #if 0
+            int x0, y0, w, h;
+
             /* No scaling */
             w = min(s->width, ms->pic.width);
             h = min(s->height, ms->pic.height / s->screen->dpy.yfactor);
@@ -68,10 +69,13 @@
             put_status(s, "%dx%dx%d",
                        ms->pic.width, ms->pic.height, ms->stb_channels * 8);
 #else
+            int x0 = 0;
+            int y0 = 0;
+            int w = ms->pic.width;
+            int h = (ms->pic.height + s->screen->dpy.yfactor - 1) / 
s->screen->dpy.yfactor;
             int factor = 1024;
 
-            w = ms->pic.width;
-            h = ms->pic.height / s->screen->dpy.yfactor;
+            if (w > 0 && h > 0) {
             /* compute scaling factor for scale up or down */
             factor = min(4 * 1024, min(s->width * 1024 / w, s->height * 1024 / 
h));
             /* Do not scale up on text display */
@@ -84,6 +88,7 @@
             qe_draw_picture(s->screen, s->xleft + x0, s->ytop + y0, w, h,
                             &ms->pic, 0, 0, ms->pic.width, ms->pic.height,
                             0, QERGB(128, 128, 128));
+            }
             fill_border(s, x0, y0, w, h, col);
             put_status(s, "%dx%dx%d",
                        ms->pic.width, ms->pic.height, ms->stb_channels * 8);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]