qemacs-commit
[Top][All Lists]
Advanced

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

[Qemacs-commit] qemacs qe.c


From: Charlie Gordon
Subject: [Qemacs-commit] qemacs qe.c
Date: Fri, 07 Feb 2014 20:16:42 +0000

CVSROOT:        /sources/qemacs
Module name:    qemacs
Changes by:     Charlie Gordon <chqrlie>        14/02/07 20:16:42

Modified files:
        .              : qe.c 

Log message:
        fix scroll issues on some charsets and eol_dos
        
        * update offset_top correctly for non utf8 variable width charsets 
          and eol_dos buffers.  This was causing infinite loops in some cases.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.c?cvsroot=qemacs&r1=1.146&r2=1.147

Patches:
Index: qe.c
===================================================================
RCS file: /sources/qemacs/qemacs/qe.c,v
retrieving revision 1.146
retrieving revision 1.147
diff -u -b -r1.146 -r1.147
--- qe.c        6 Feb 2014 00:26:25 -0000       1.146
+++ qe.c        7 Feb 2014 20:16:42 -0000       1.147
@@ -904,9 +904,12 @@
     if (dir < 0) {
         /* difficult case: we need to go backward on displayed text */
         while (cm.linec <= 0) {
-            if (s->offset_top <= 0)
+            int offset_top = s->offset_top;
+
+            if (offset_top <= 0)
                 return;
-            s->offset_top = s->mode->text_backward_offset(s, s->offset_top - 
1);
+            eb_prevc(s->b, offset_top, &offset_top);
+            s->offset_top = s->mode->text_backward_offset(s, offset_top);
 
             /* adjust y_disp so that the cursor is at the same position */
             s->y_disp += cm.yc;
@@ -998,12 +1001,15 @@
     if (s->y_disp > 0) {
         display_init(ds, s, DISP_CURSOR_SCREEN);
         do {
-            if (s->offset_top <= 0) {
+            int offset_top = s->offset_top;
+
+            if (offset_top <= 0) {
                 /* cannot go back: we stay at the top of the screen and
                    exit loop */
                 s->y_disp = 0;
             } else {
-                s->offset_top = s->mode->text_backward_offset(s, s->offset_top 
- 1);
+                eb_prevc(s->b, offset_top, &offset_top);
+                s->offset_top = s->mode->text_backward_offset(s, offset_top);
                 ds->y = 0;
                 s->mode->text_display(s, ds, s->offset_top);
                 s->y_disp -= ds->y;
@@ -1142,9 +1148,12 @@
             } else {
                 /* no suitable position found: go to previous line */
                 if (yc <= 0) {
-                    if (s->offset_top <= 0)
+                    int offset_top = s->offset_top;
+
+                    if (offset_top <= 0)
                         break;
-                    s->offset_top = s->mode->text_backward_offset(s, 
s->offset_top - 1);
+                    eb_prevc(s->b, offset_top, &offset_top);
+                    s->offset_top = s->mode->text_backward_offset(s, 
offset_top);
                     /* adjust y_disp so that the cursor is at the same 
position */
                     s->y_disp += cm.yc;
                     get_cursor_pos(s, &cm);
@@ -3557,7 +3566,8 @@
         }
 
         while (ds->y < s->height && offset > 0) {
-            offset = s->mode->text_backward_offset(s, offset - 1);
+            eb_prevc(s->b, offset, &offset);
+            offset = s->mode->text_backward_offset(s, offset);
             s->mode->text_display(s, ds, offset);
         }
         s->offset_top = offset;



reply via email to

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