Prompting commands now do standard modifications to prompt strings
authorChris Hanson <org/chris-hanson/cph>
Sat, 16 Oct 1993 07:34:43 +0000 (07:34 +0000)
committerChris Hanson <org/chris-hanson/cph>
Sat, 16 Oct 1993 07:34:43 +0000 (07:34 +0000)
BEFORE passing them to custom operations; operations must compensate.

v7/src/edwin/intmod.scm
v7/src/edwin/prompt.scm

index 98aefa68fc42053a67a0f7f4042a32ae3453bbab..76a76e20cc48acba3481f717c16d8df7e19a761e 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Id: intmod.scm,v 1.68 1993/10/16 06:02:08 cph Exp $
+;;;    $Id: intmod.scm,v 1.69 1993/10/16 07:34:12 cph Exp $
 ;;;
 ;;;    Copyright (c) 1986, 1989-93 Massachusetts Institute of Technology
 ;;;
@@ -915,21 +915,19 @@ If this is an error, the debugger examines the error condition."
 (define (parse-command-prompt port prompt)
   (standard-prompt-spacing port)
   (let ((prompt
-        (let ((prefix
-               (string-append (number->string (nearest-cmdl/level)) " ")))
-          (if (and (string-prefix? prefix prompt)
-                   (not (string=? prefix prompt)))
-              (string-tail prompt (string-length prefix))
-              prompt))))
+        (string-trim-right
+         (let ((prefix
+                (string-append (number->string (nearest-cmdl/level)) " ")))
+           (if (and (string-prefix? prefix prompt)
+                    (not (string=? prefix prompt)))
+               (string-tail prompt (string-length prefix))
+               prompt)))))
     (if (not (and suppress-standard-prompts?
                  (or (string=? prompt user-initial-prompt)
                      (member prompt standard-prompts))))
        (begin
          (write-string prompt port)
-         (if (let ((n (string-length prompt)))
-               (and (> n 0)
-                    (not (char=? #\space (string-ref prompt (- n 1))))))
-             (write-char #\space port))))))
+         (write-char #\space port)))))
 
 (define suppress-standard-prompts? #t)
 (define standard-prompts '("]=>" "error>" "break>" "bkpt>" "debug>" "where>"))
index 7b7cef80c1bc0f3b4213ce62fd711a6d1acdf8e1..158508c715e48434f746ae2a35d3f90eb6ded008 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Id: prompt.scm,v 1.159 1993/08/02 22:24:52 cph Exp $
+;;;    $Id: prompt.scm,v 1.160 1993/10/16 07:34:43 cph Exp $
 ;;;
 ;;;    Copyright (c) 1986, 1989-93 Massachusetts Institute of Technology
 ;;;
@@ -669,7 +669,10 @@ a repetition of this command will exit."
 ;;;; Confirmation Prompts
 
 (define (prompt-for-confirmation? prompt)
-  (prompt-for-typein (string-append prompt " (y or n)? ") false
+  (prompt-for-typein (if (string-suffix? " " prompt)
+                        prompt
+                        (string-append prompt " (y or n)? "))
+                    false
     (lambda ()
       (let loop ((lost? false))
        (let ((char (keyboard-read)))