qemacs-commit
[Top][All Lists]
Advanced

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

[Qemacs-commit] qemacs extras.c


From: Charlie Gordon
Subject: [Qemacs-commit] qemacs extras.c
Date: Tue, 13 Dec 2016 13:26:16 +0000 (UTC)

CVSROOT:        /sources/qemacs
Module name:    qemacs
Changes by:     Charlie Gordon <chqrlie>        16/12/13 13:26:16

Modified files:
        .              : extras.c 

Log message:
        fixed crash bug in do_forward_block for very long lines

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/extras.c?cvsroot=qemacs&r1=1.43&r2=1.44

Patches:
Index: extras.c
===================================================================
RCS file: /sources/qemacs/qemacs/extras.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -b -r1.43 -r1.44
--- extras.c    26 Nov 2016 11:30:29 -0000      1.43
+++ extras.c    13 Dec 2016 13:26:16 -0000      1.44
@@ -429,8 +429,14 @@
     eb_get_pos(s->b, &line_num, &col_num, s->offset);
     offset = eb_goto_bol2(s->b, s->offset, &pos);
     offset1 = offset;
+    /* XXX: deal with truncation */
     len = s->get_colorized_line(s, buf, countof(buf), &offset1, line_num);
-    style = buf[max(pos, len)] >> STYLE_SHIFT;
+    if (pos > len) {
+        /* cannot use colorized line buffer */
+        /* XXX: should use buffer contents */
+        pos = len;
+    }
+    style = buf[pos] >> STYLE_SHIFT;
     level = 0;
 
     if (dir < 0) {
@@ -441,6 +447,8 @@
                 line_num--;
                 offset = eb_prev_line(s->b, offset);
                 offset1 = offset;
+                /* XXX: this will actually ignore the end of very long lines */
+                /* XXX: deal with truncation */
                 pos = s->get_colorized_line(s, buf, countof(buf), &offset1, 
line_num);
                 continue;
             }
@@ -494,6 +502,8 @@
                 if (offset >= s->b->total_size)
                     break;
                 offset1 = offset;
+                /* XXX: this will actually ignore the end of very long lines */
+                /* XXX: deal with truncation */
                 len = s->get_colorized_line(s, buf, countof(buf), &offset1, 
line_num);
                 continue;
             }



reply via email to

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