From c7d7d9a493a10e8c94ebafd782174df4db7d23f7 Mon Sep 17 00:00:00 2001 From: Arthur Gleckler Date: Tue, 18 Jun 1991 20:31:43 +0000 Subject: [PATCH] Make Edwin buffer and window output ports correctly support the operation X-SIZE. X-SIZE on a buffer output port now returns the character width of the most narrow window showing the port's buffer, or 79 if no window shows the buffer. X-SIZE on a window output port now returns the character width of the window. --- v7/src/edwin/bufout.scm | 14 ++++++++++++-- v7/src/edwin/winout.scm | 8 ++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/v7/src/edwin/bufout.scm b/v7/src/edwin/bufout.scm index e6b6e9757..d7b2d2d1d 100644 --- a/v7/src/edwin/bufout.scm +++ b/v7/src/edwin/bufout.scm @@ -1,6 +1,6 @@ ;;; -*-Scheme-*- ;;; -;;; $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/bufout.scm,v 1.4 1991/05/15 21:19:11 cph Exp $ +;;; $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/bufout.scm,v 1.5 1991/06/18 20:31:43 arthur Exp $ ;;; ;;; Copyright (c) 1986, 1989-91 Massachusetts Institute of Technology ;;; @@ -115,6 +115,15 @@ (define (operation/close port) (mark-temporary! (output-port/mark port))) +(define (operation/x-size port) + (let ((sizes + (map window-x-size + (buffer-windows + (mark-buffer (output-port/mark port)))))) + (if (null? sizes) + 79 + (apply min sizes)))) + (define mark-output-port-template (make-output-port `((CLOSE ,operation/close) (FLUSH-OUTPUT ,operation/flush-output) @@ -122,5 +131,6 @@ (FRESH-LINES ,operation/fresh-lines) (PRINT-SELF ,operation/print-self) (WRITE-CHAR ,operation/write-char) - (WRITE-STRING ,operation/write-string)) + (WRITE-STRING ,operation/write-string) + (X-SIZE ,operation/x-size)) false)) \ No newline at end of file diff --git a/v7/src/edwin/winout.scm b/v7/src/edwin/winout.scm index aa7061bd5..3dea2cbd6 100644 --- a/v7/src/edwin/winout.scm +++ b/v7/src/edwin/winout.scm @@ -1,6 +1,6 @@ ;;; -*-Scheme-*- ;;; -;;; $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/winout.scm,v 1.5 1991/03/11 01:14:58 cph Exp $ +;;; $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/winout.scm,v 1.6 1991/06/18 20:30:48 arthur Exp $ ;;; ;;; Copyright (c) 1986, 1989-91 Massachusetts Institute of Technology ;;; @@ -121,6 +121,9 @@ (if (window-needs-redisplay? window) (window-direct-update! window false)))) +(define (operation/x-size port) + (window-x-size (output-port/state port))) + (define (operation/print-self state port) (unparse-string state "to window ") (unparse-object state (output-port/state port))) @@ -131,5 +134,6 @@ (FRESH-LINES ,operation/fresh-lines) (PRINT-SELF ,operation/print-self) (WRITE-CHAR ,operation/write-char) - (WRITE-STRING ,operation/write-string)) + (WRITE-STRING ,operation/write-string) + (X-SIZE ,operation/x-size)) false)) \ No newline at end of file -- 2.25.1