From 4bfec48866d4de6d593cb4a7be66cefa4ddad408 Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Wed, 5 Oct 2011 15:01:12 -0700 Subject: [PATCH] Fixed cursor update by being less "clever". 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 | 40 ++--------------------------------- 1 file changed, 2 insertions(+), 38 deletions(-) diff --git a/src/gtk-screen/gtk-screen.scm b/src/gtk-screen/gtk-screen.scm index 36b04e98d..a049d2c95 100644 --- a/src/gtk-screen/gtk-screen.scm +++ b/src/gtk-screen/gtk-screen.scm @@ -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 . Used to blink this ink "on" ;; (restore its ink-widgets list) withOUT consing. (widget-list define standard)) -- 2.25.1