[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How does one read multi-line text blocks?



Hi,
     I've written a program which at one point needs to ask the user
for a large amount of text. Currently I am doing this by repeated
'read-line' statements (I've appended the code below). Although this
works, I find it quite unsatisfactory because it means that the user
can only edit (and for that matter, only paste) a line at a time. I
would much prefer to be able to read a multi-line block all at once,
which would allow to the user to play around with the wording until
s/he was satisfied, as well as allowing him/her to paste in the text
from another source. Can anyone help me see how to do this?

              Thanks in advance.
                                          Chris


;Here's the read loop:

     (do
          ((input (read-line) (read-line))
                  (output "" (format nil "~a ~a" output input)))
          ;Hmmm- I can't see why I didn't just check directly
   ;for a carriage return char here...but this works.
          ((equal (car (coerce input 'list)) nil)
                  output)))))


*****************************************************************
*   Chris Westbury cxea@mcgilla.ca                              *
*   Department Of Psychology, McGill University                 *
*                                                               *
*    "We dignify our stupidities when we set them up in type."  *
*                                     Michel De Montaigne       *
* ***************************************************************