qemacs-commit
[Top][All Lists]
Advanced

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

[Qemacs-commit] qemacs buffer.c extra-modes.c lisp.c virgil.c g...


From: Charlie Gordon
Subject: [Qemacs-commit] qemacs buffer.c extra-modes.c lisp.c virgil.c g...
Date: Mon, 17 Apr 2017 05:16:24 -0400 (EDT)

CVSROOT:        /sources/qemacs
Module name:    qemacs
Changes by:     Charlie Gordon <chqrlie>        17/04/17 05:16:24

Modified files:
        .              : buffer.c extra-modes.c lisp.c virgil.c groovy.c 
                         rust.c clang.c icon.c swift.c 

Log message:
        syntax: improve tag display
        - increase identifier buffer lengths
        - fix some bugs in buffer property handling

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/buffer.c?cvsroot=qemacs&r1=1.112&r2=1.113
http://cvs.savannah.gnu.org/viewcvs/qemacs/extra-modes.c?cvsroot=qemacs&r1=1.60&r2=1.61
http://cvs.savannah.gnu.org/viewcvs/qemacs/lisp.c?cvsroot=qemacs&r1=1.28&r2=1.29
http://cvs.savannah.gnu.org/viewcvs/qemacs/virgil.c?cvsroot=qemacs&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/qemacs/groovy.c?cvsroot=qemacs&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/qemacs/rust.c?cvsroot=qemacs&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/qemacs/clang.c?cvsroot=qemacs&r1=1.125&r2=1.126
http://cvs.savannah.gnu.org/viewcvs/qemacs/icon.c?cvsroot=qemacs&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/qemacs/swift.c?cvsroot=qemacs&r1=1.5&r2=1.6

Patches:
Index: buffer.c
===================================================================
RCS file: /sources/qemacs/qemacs/buffer.c,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -b -r1.112 -r1.113
--- buffer.c    15 Apr 2017 09:39:02 -0000      1.112
+++ buffer.c    17 Apr 2017 09:16:24 -0000      1.113
@@ -2588,27 +2588,31 @@
 }
 
 void eb_add_property(EditBuffer *b, int offset, int type, void *data) {
-    QEProperty *p = qe_mallocz(QEProperty);
+    QEProperty *p;
     QEProperty **pp;
 
     if (!b->property_list) {
         eb_add_callback(b, eb_plist_callback, NULL, 0);
     }
 
-    p->offset = offset;
-    p->type = type;
-    p->data = data;
-    for (pp = &b->property_list; *pp; pp = &(*pp)->next) {
-        if ((*pp)->offset >= offset) {
-            if ((*pp)->offset == offset && p->type == type && type == 
QE_PROP_TAG) {
+    for (pp = &b->property_list; (p = *pp) != NULL; pp = &(*pp)->next) {
+        if (p->offset >= offset) {
+            if (p->offset == offset) {
+                if (p->type == type && type == QE_PROP_TAG) {
                 /* prevent tag duplicates */
                 if (strequal(p->data, data))
                     return;
+                }
                 continue;
             }
             break;
         }
     }
+
+    p = qe_mallocz(QEProperty);
+    p->offset = offset;
+    p->type = type;
+    p->data = data;
     p->next = *pp;
     *pp = p;
 }
@@ -2617,7 +2621,8 @@
     QEProperty *found = NULL;
     QEProperty *p;
     for (p = b->property_list; p && p->offset < offset2; p = p->next) {
-        if (p->offset >= offset) {
+        if (p->offset >= offset && p->type == type) {
+            /* return the last property between offset and offset2 */
             found = p;
         }
     }
@@ -2628,8 +2633,10 @@
     QEProperty *p;
     QEProperty **pp;
 
-    if (b->property_list) {
-        for (pp = &b->property_list; (p = *pp) != NULL;) {
+    if (!b->property_list)
+        return;
+
+    for (pp = &b->property_list; (p = *pp) != NULL && p->offset < offset2;) {
             if (p->offset >= offset && p->offset < offset2) {
                 *pp = (*pp)->next;
                 if (p->type & QE_PROP_FREE) {
@@ -2643,7 +2650,6 @@
         if (!b->property_list) {
             eb_free_callback(b, eb_plist_callback, NULL);
         }
-    }
 }
 
 /* buffer data type handling */

Index: extra-modes.c
===================================================================
RCS file: /sources/qemacs/qemacs/extra-modes.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -b -r1.60 -r1.61
--- extra-modes.c       16 Apr 2017 21:51:20 -0000      1.60
+++ extra-modes.c       17 Apr 2017 09:16:24 -0000      1.61
@@ -1600,7 +1600,7 @@
 {
     int i = 0, start = i, c, sep = 0, level = 0, level1, klen, style;
     int state = cp->colorize_state;
-    char kbuf[32];
+    char kbuf[64];
 
     if (state & IN_LUA_LONGLIT) {
         /* either a comment or a string */
@@ -1865,7 +1865,7 @@
 {
     int i = 0, start = i, c, sep = 0, klen;
     int state = cp->colorize_state;
-    char kbuf[32];
+    char kbuf[64];
 
     if (state & IN_JULIA_STRING) {
         sep = '\"';
@@ -2040,7 +2040,7 @@
 {
     int i = 0, start = i, c, style = 0, sep = 0, level = 0, klen;
     int state = cp->colorize_state;
-    char kbuf[32];
+    char kbuf[64];
 
     if (state & IN_HASKELL_COMMENT)
         goto parse_comment;
@@ -2276,7 +2276,7 @@
 {
     int i = 0, start = i, c, style = 0, sep, klen, prev, i1;
     int state = cp->colorize_state;
-    char kbuf[32];
+    char kbuf[64];
 
     if (state & IN_COFFEE_STRING) {
         sep = '\'';
@@ -2623,7 +2623,7 @@
 {
     int i = 0, start = i, c, style = 0, sep, klen, i1, tag = 0;
     int state = cp->colorize_state;
-    char kbuf[32];
+    char kbuf[64];
 
     if (state & IN_PYTHON_STRING) {
         sep = '\'';
@@ -2909,7 +2909,7 @@
     int i = 0, j, start = i, c, style = 0, indent, sig;
     static int sep, sep0, level;        /* XXX: ugly patch */
     int state = cp->colorize_state;
-    char kbuf[32];
+    char kbuf[64];
 
     for (indent = 0; qe_isblank(str[indent]); indent++)
         continue;
@@ -3622,7 +3622,7 @@
 {
     int i = 0, start = i, c, style = 0, sep, klen, nc, has_under;
     int state = cp->colorize_state;
-    char kbuf[32];
+    char kbuf[64];
 
     if (state & IN_ELIXIR_STRING)
         goto parse_string;

Index: lisp.c
===================================================================
RCS file: /sources/qemacs/qemacs/lisp.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- lisp.c      16 Apr 2017 21:51:20 -0000      1.28
+++ lisp.c      17 Apr 2017 09:16:24 -0000      1.29
@@ -219,7 +219,7 @@
     int colstate = cp->colorize_state;
     int i = 0, start = i, len, level, style, style1, has_expr;
     int mode_flags = syn->colorize_flags;
-    char kbuf[32];
+    char kbuf[64];
 
     level = colstate & IN_LISP_LEVEL;
     style1 = style = 0;

Index: virgil.c
===================================================================
RCS file: /sources/qemacs/qemacs/virgil.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- virgil.c    25 Mar 2017 18:14:59 -0000      1.3
+++ virgil.c    17 Apr 2017 09:16:24 -0000      1.4
@@ -216,7 +216,7 @@
 {
     int i = 0, start = i, c, style, sep = 0, klen, haslower;
     int state = cp->colorize_state;
-    char kbuf[32];
+    char kbuf[64];
 
     /* all these states are exclusive */
     if (state & IN_VIRGIL_COMMENT) {

Index: groovy.c
===================================================================
RCS file: /sources/qemacs/qemacs/groovy.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- groovy.c    25 Mar 2017 18:15:00 -0000      1.5
+++ groovy.c    17 Apr 2017 09:16:24 -0000      1.6
@@ -215,7 +215,7 @@
 {
     int i = 0, start = i, c, style, sep = 0, klen, haslower;
     int state = cp->colorize_state;
-    char kbuf[32];
+    char kbuf[64];
 
     /* all these states are exclusive */
     if (state & IN_GROOVY_COMMENT) {

Index: rust.c
===================================================================
RCS file: /sources/qemacs/qemacs/rust.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- rust.c      16 Apr 2017 21:51:20 -0000      1.7
+++ rust.c      17 Apr 2017 09:16:24 -0000      1.8
@@ -60,7 +60,7 @@
                                unsigned int *str, int n, ModeDef *syn)
 {
     int i = 0, start, i1, i2, indent, c, state, style, klen, delim;
-    char kbuf[32];
+    char kbuf[64];
 
     for (indent = 0; qe_isblank(str[indent]); indent++)
         continue;

Index: clang.c
===================================================================
RCS file: /sources/qemacs/qemacs/clang.c,v
retrieving revision 1.125
retrieving revision 1.126
diff -u -b -r1.125 -r1.126
--- clang.c     16 Apr 2017 21:51:20 -0000      1.125
+++ clang.c     17 Apr 2017 09:16:24 -0000      1.126
@@ -117,8 +117,10 @@
     ||  (c == '@' && flavor != CLANG_PIKE)
     ||  (flavor == CLANG_RUST && c >= 128)) {
         for (;;) {
-            if (j < buf_size - 1)
+            if (j < buf_size - 1) {
+                /* XXX: utf-8 bug */
                 buf[j++] = (c < 0xFF) ? c : 0xFF;
+            }
             i++;
             c = p[i];
             if (c == '-' && flavor == CLANG_CSS)
@@ -187,7 +189,7 @@
 {
     int i = 0, start, i1, i2, indent, level;
     int c, style, style0, style1, type_decl, klen, delim, prev, tag;
-    char kbuf[32];
+    char kbuf[64];
     int mode_flags = syn->colorize_flags;
     int flavor = (mode_flags & CLANG_FLAVOR);
     int state = cp->colorize_state;
@@ -1548,7 +1550,7 @@
 {
     int i = 0, start, i1, indent;
     int c, style, klen, delim, prev, tag;
-    char kbuf[32];
+    char kbuf[64];
     int mode_flags = syn->colorize_flags;
     int flavor = (mode_flags & CLANG_FLAVOR);
     int state = cp->colorize_state;

Index: icon.c
===================================================================
RCS file: /sources/qemacs/qemacs/icon.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- icon.c      16 Apr 2017 21:51:20 -0000      1.6
+++ icon.c      17 Apr 2017 09:16:24 -0000      1.7
@@ -55,7 +55,7 @@
                                unsigned int *str, int n, ModeDef *syn)
 {
     int i, start, indent, c, state, style, klen, delim;
-    char kbuf[32];
+    char kbuf[64];
 
     for (i = 0; qe_isblank(str[i]); i++)
         continue;

Index: swift.c
===================================================================
RCS file: /sources/qemacs/qemacs/swift.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- swift.c     25 Mar 2017 18:15:01 -0000      1.5
+++ swift.c     17 Apr 2017 09:16:24 -0000      1.6
@@ -181,7 +181,7 @@
 {
     int i = 0, start = 0, c, style, klen, level;
     int state = cp->colorize_state;
-    char kbuf[32];
+    char kbuf[64];
 
     if (state) {
         /* if already in a state, go directly in the code parsing it */



reply via email to

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