From a6171685f6a9811a33c156c2a4dadeac62eab795 Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Wed, 19 Aug 2009 18:32:07 -0700 Subject: [PATCH] Fix where Edwin leaves the cursor in console-screens. toggle-read-only and the set-mark-command leave the terminal's cursor in the modeline or minibuffer (respectively). * src/edwin/buffrm.scm (window-direct-output-cursor!): New procedure. * src/edwin/bufwiu.scm (buffer-window/direct-output-cursor!): New procedure. * src/edwin/edwin.pkg: Export window-direct-output-cursor! to (edwin) for screen code like console-wrap-update!. Export editor-frame-cursor-window to (edwin screen) for screen-cursor-window. * src/edwin/screen.scm (screen-cursor-window): New procedure. * src/edwin/tterm.scm (console-wrap-update!): Leave the terminal's cursor in the screen-cursor-window. (output): Do not die when screen-cursor-y is still #f -- found when interpreting Edwin. --- src/edwin/buffrm.scm | 3 +++ src/edwin/bufwiu.scm | 13 +++++++++++++ src/edwin/edwin.pkg | 2 ++ src/edwin/screen.scm | 3 +++ src/edwin/tterm.scm | 3 ++- 5 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/edwin/buffrm.scm b/src/edwin/buffrm.scm index 680df01f7..6bf87cfa0 100644 --- a/src/edwin/buffrm.scm +++ b/src/edwin/buffrm.scm @@ -232,6 +232,9 @@ USA. (define-integrable (window-char->image frame char) (%window-char->image (frame-text-inferior frame) char)) +(define-integrable (window-direct-output-cursor! frame) + (buffer-window/direct-output-cursor! (frame-text-inferior frame))) + (define-integrable (window-direct-output-forward-char! frame) (buffer-window/direct-output-forward-char! (frame-text-inferior frame))) diff --git a/src/edwin/bufwiu.scm b/src/edwin/bufwiu.scm index 6bdbfe4fc..004d29b98 100644 --- a/src/edwin/bufwiu.scm +++ b/src/edwin/bufwiu.scm @@ -404,6 +404,19 @@ USA. (not (%window-saved-screen window)) (screen-needs-update? (%window-saved-screen window)))) +(define (buffer-window/direct-output-cursor! window) + (if (%window-debug-trace window) + ((%window-debug-trace window) 'window window 'direct-output-cursor!)) + (let ((mask (set-interrupt-enables! interrupt-mask/gc-ok))) + (let ((x-start (inferior-x-start (%window-cursor-inferior window))) + (y-start (inferior-y-start (%window-cursor-inferior window)))) + (screen-direct-output-move-cursor + (%window-saved-screen window) + (fix:+ (%window-saved-x-start window) x-start) + (fix:+ (%window-saved-y-start window) y-start))) + (set-interrupt-enables! mask) + unspecific)) + (define (buffer-window/direct-output-forward-char! window) (if (%window-debug-trace window) ((%window-debug-trace window) 'window window diff --git a/src/edwin/edwin.pkg b/src/edwin/edwin.pkg index 3c5d4f888..10659cd6d 100644 --- a/src/edwin/edwin.pkg +++ b/src/edwin/edwin.pkg @@ -349,6 +349,7 @@ USA. window-direct-output-insert-char! window-direct-output-insert-newline! window-direct-output-insert-substring! + window-direct-output-cursor! window-direct-update! window-home-cursor! window-mark->coordinates @@ -377,6 +378,7 @@ USA. (export (edwin screen) editor-frame-screen editor-frame-select-cursor! + editor-frame-cursor-window editor-frame-select-window! editor-frame-selected-window editor-frame-typein-window diff --git a/src/edwin/screen.scm b/src/edwin/screen.scm index e19744f80..3883ec534 100644 --- a/src/edwin/screen.scm +++ b/src/edwin/screen.scm @@ -134,6 +134,9 @@ USA. (editor-frame-select-window! (screen-root-window screen) window) (screen-modeline-event! screen window 'SELECT-WINDOW)) +(define-integrable (screen-cursor-window screen) + (editor-frame-cursor-window (screen-root-window screen))) + (define-integrable (screen-select-cursor! screen window) (editor-frame-select-cursor! (screen-root-window screen) window)) diff --git a/src/edwin/tterm.scm b/src/edwin/tterm.scm index d17541865..bd15ab955 100644 --- a/src/edwin/tterm.scm +++ b/src/edwin/tterm.scm @@ -514,6 +514,7 @@ USA. (define (console-wrap-update! screen thunk) screen (let ((finished? (thunk))) + (window-direct-output-cursor! (screen-cursor-window screen)) (output-port/flush-output console-i/o-port) finished?)) @@ -1039,7 +1040,7 @@ USA. (if scroll-region (cdr scroll-region) (tn-y-size (screen-description screen)))) - (screen-cursor-y screen)))) + (or (screen-cursor-y screen) 0)))) (define-integrable (output-1 screen command) (output-n screen command 1)) -- 2.25.1