Fixed cursor update by being less "clever".
authorMatt Birkholz <matt@birkholz.chandler.az.us>
Wed, 5 Oct 2011 22:01:12 +0000 (15:01 -0700)
committerMatt Birkholz <matt@birkholz.chandler.az.us>
Wed, 5 Oct 2011 22:01:12 +0000 (15:01 -0700)
No need for a permanent mark in cursor-ink-point; removed the slot.
Update-cursor just calls redraw-cursor to re-compute cursor ink
positions at the end of every update, regardless of change-regions.
Set-box-ink! will do no unnecessary damage.

src/gtk-screen/gtk-screen.scm

index 36b04e98d8de1ef5b4799faa620ead51e80352de..a049d2c95301adf5cc381d8bf55e259f4c4eff03 100644 (file)
@@ -1039,9 +1039,7 @@ USA.
   (call-next-method widget)
   (let ((cursor (text-widget-cursor-ink widget)))
     (if cursor
-       (let ((mark (cursor-ink-point cursor)))
-         (fix-ink-remove! cursor)
-         (if mark (mark-temporary! mark)))))
+       (fix-ink-remove! cursor)))
   (and-let* ((drawing (text-widget-override-drawing widget))
             (ink (car (fix-drawing-display-list drawing)))
             ((text-ink? ink))
@@ -2181,37 +2179,8 @@ USA.
   (let ((window (text-widget-buffer-frame widget))
        (cursor (text-widget-cursor-ink widget)))
     (%trace ";\t    cursor: "cursor"\n")
+    (redraw-cursor widget (window-point window))
 
-    (define (in-change-region? point)
-      (let ((group (mark-group point))
-           (index (mark-index point)))
-       (let ((start (group-start-changes-index group))
-             (end (group-end-changes-index group)))
-         (and start (fix:<= start index) (fix:<= index end)))))
-
-    (let ((window-point (window-point window))
-         (cursor-point (cursor-ink-point cursor)))
-      (cond ((and cursor-point
-                 (mark= cursor-point window-point)
-                 (not (in-change-region? cursor-point)))
-            (%trace ";\t    unchanged at "(mark-index cursor-point)
-                    " = "(mark-index window-point)" ("
-                    (and (in-change-region? cursor-point) #t)")\n"))
-           ((and cursor-point
-                 (mark= cursor-point window-point))
-            (%trace ";\t    in change region"
-                    " at "(mark-index cursor-point)
-                    " ("(mark-index window-point)")\n")
-            (redraw-cursor widget window-point))
-           (cursor-point
-            (%trace ";\t    changed from "(mark-index cursor-point)
-                    " to "(mark-index window-point)"\n")
-            (redraw-cursor widget window-point))
-           (else
-            (%trace ";\t    new at "(mark-index window-point)"\n")
-            (set-cursor-ink-point! cursor
-                                   (mark-permanent-copy window-point))
-            (redraw-cursor widget window-point))))
     ;; Get cursor appearance right per current mode.  An active
     ;; typein window looks selected, else invisible.  An active buffer
     ;; looks selected, else visible.
@@ -2276,14 +2245,12 @@ USA.
       (let ((half-width (quotient (gtk-screen-char-width screen) 2))
            (line-height (gtk-screen-line-height screen)))
        (set-box-ink! cursor x y half-width line-height))
-      (move-mark-to! (cursor-ink-point cursor) point)
       #t)
 
     (define (set-box! x y width height)
       (if (fix:< width 5)
          (set-box-ink! cursor x y 5 height)
          (set-box-ink! cursor x y width height))
-      (move-mark-to! (cursor-ink-point cursor) point)
       #t)
 
     (main)))
@@ -2449,9 +2416,6 @@ USA.
   ;; #t if the cursor should be drawn.
   (visible? define standard initial-value #t)
 
-  ;; The index (a marker) at which the cursor was last placed.
-  (point define standard initial-value #f)
-
   ;; A list of one <fix-layout>.  Used to blink this ink "on"
   ;; (restore its ink-widgets list) withOUT consing.
   (widget-list define standard))