<div dir="ltr">Hello. <div><br></div><div>I was writing a code like this:</div><div><br></div><div>(define *maxrow* 24)<br></div><div><br></div><div><div>(define (showfile filename)</div><div>  (with-handlers ((exn:fail:filesystem:errno?</div>
<div>                   (lambda (exn) #f)))</div><div>    (letrec ((openfile</div><div>              (lambda ()</div><div>                (with-input-from-file filename</div><div>                  (lambda ()</div><div>                    (let loop ((ls '()) (lbuffer (read-line)))</div>
<div>                      (if (eof-object? lbuffer)</div><div>                          (reverse ls)</div><div>                          (loop (cons lbuffer ls) (read-line)))))))))</div><div>      (let loop ((irow 0) (lbuffer (openfile)))</div>
<div>        (cond ((null? lbuffer) #f)</div><div>              ((= irow (- *maxrow* 3)) (read) ; <- Is this a problem?</div><div>                                       (loop 0 (cdr lbuffer)))</div><div>              (else (display (car lbuffer))</div>
<div>                    (newline)</div><div>                    (loop (+ irow 1) (cdr lbuffer))))))))</div></div><div><br></div><div>What I'd like to do is: </div><div><br></div><div>1. Open a file</div><div>2. Get the context into the buffer expressed as a list.</div>
<div>3. Show the context in 21 rows.</div><div>4. Hit Return Key to see the next 21 rows <- HERE IS THE PROBLEM!</div><div>5. Continue 3 -> 4 till the end of the buffer.</div><div><br></div><div>I tried READ function to do this; however it simply didn't work, 'cause READ got to get something. READ doesn't give up eventhough just hitting a RETURN.</div>
<div>Is there any function to do this instead of READ?</div><div><br></div><div>Possibly need some library like curses in UNIX (though I now use Windows).</div><div>Supposing to write a text editor like vi with Racket, how do you guys to write codes using h, j, k, and l keys as cursor? In the case with standard input and output, as you know, it is impossible to emulate the move.</div>
<div>Is there any library to emulate something like curses in Racket?</div><div><br></div><div>Thanks.</div></div>