Fix where Edwin leaves the cursor in console-screens.
authorMatt Birkholz <matt@birkholz.chandler.az.us>
Thu, 20 Aug 2009 01:32:07 +0000 (18:32 -0700)
committerMatt Birkholz <matt@birkholz.chandler.az.us>
Thu, 20 Aug 2009 01:32:07 +0000 (18:32 -0700)
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
src/edwin/bufwiu.scm
src/edwin/edwin.pkg
src/edwin/screen.scm
src/edwin/tterm.scm

index 680df01f75586b4c11cbf4c4b7ec38731e420a74..6bf87cfa095f2f21b043aee41b67713c1ca3a264 100644 (file)
@@ -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)))
 
index 6bdbfe4fca1152fae2be14e8ce67b44475cfd083..004d29b98236b3124276dc7cc9f71459b79a02cd 100644 (file)
@@ -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
index 3c5d4f888c7bfab8b683cff1200fe3b19bcf8a8f..10659cd6d8be68f5eb51a03cb95b287388849d1b 100644 (file)
@@ -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
index e19744f80ce6933517c3a922076183cd0d4313d4..3883ec53403e653e39ab93ea51f2157106eabda3 100644 (file)
@@ -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))
 
index d1754186563c2d6a6d5d3649847a58c4d64afc9b..bd15ab955f25e52a405da79314bd6b62aae78734 100644 (file)
@@ -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))