From: Chris Hanson Date: Tue, 14 May 1996 05:41:08 +0000 (+0000) Subject: Move the cursor only when its position is changed. Previously, the X-Git-Tag: 20090517-FFI~5518 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=b29934611aab85e5144eaa076a24bed67b614caa;p=mit-scheme.git Move the cursor only when its position is changed. Previously, the cursor was being moved many times in a row to the same location. This was caused by repeated screen updates being run as a result of processing input events. Input events can be quite common even when there is no typing going on, as a result of window-system operations, mouse tracking, etc. --- diff --git a/v7/src/edwin/screen.scm b/v7/src/edwin/screen.scm index 4d0b79ad0..e71c6d0ca 100644 --- a/v7/src/edwin/screen.scm +++ b/v7/src/edwin/screen.scm @@ -1,6 +1,6 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: screen.scm,v 1.109 1996/05/14 01:49:49 cph Exp $ +;;; $Id: screen.scm,v 1.110 1996/05/14 05:41:08 cph Exp $ ;;; ;;; Copyright (c) 1989-96 Massachusetts Institute of Technology ;;; @@ -255,8 +255,8 @@ highlight-enable ;; Cursor position. - cursor-x - cursor-y) + (cursor-x #f) + (cursor-y #f)) (define (make-matrix screen) (let ((matrix (%make-matrix)) @@ -275,8 +275,6 @@ (set-matrix-highlight! matrix highlight) (set-matrix-enable! matrix enable) (set-matrix-highlight-enable! matrix highlight-enable)) - (set-matrix-cursor-x! matrix 0) - (set-matrix-cursor-y! matrix 0) matrix)) (define (set-screen-size! screen x-size y-size) @@ -321,9 +319,11 @@ (initialize-new-line-contents screen y) (if highlight (begin - (boolean-vector-set! (matrix-highlight-enable new-matrix) y true) + (boolean-vector-set! (matrix-highlight-enable new-matrix) + y #t) (initialize-new-line-highlight screen y) - (boolean-vector-set! (vector-ref (matrix-highlight new-matrix) y) + (boolean-vector-set! (vector-ref (matrix-highlight new-matrix) + y) x highlight)))) ((boolean-vector-ref (matrix-highlight-enable new-matrix) y) (boolean-vector-set! (vector-ref (matrix-highlight new-matrix) y) @@ -661,10 +661,12 @@ (set-screen-in-update?! screen old-flag) finished?))))) -(define-integrable (screen-update-cursor screen) +(define (screen-update-cursor screen) (let ((x (matrix-cursor-x (screen-new-matrix screen))) (y (matrix-cursor-y (screen-new-matrix screen)))) - (terminal-move-cursor screen x y) + (if (not (and (eqv? x (matrix-cursor-x (screen-current-matrix screen))) + (eqv? y (matrix-cursor-y (screen-current-matrix screen))))) + (terminal-move-cursor screen x y)) (set-matrix-cursor-x! (screen-current-matrix screen) x) (set-matrix-cursor-y! (screen-current-matrix screen) y)))