unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Jon Wilson <j85wilson@fastmail.fm>
Subject: readline eats previous text on line
Date: Wed, 27 Sep 2006 16:26:13 -0500	[thread overview]
Message-ID: <451AEC75.90200@fastmail.fm> (raw)

Hi,
I'm trying to read user input (interactive) using guile.  I'd like to use 
(ice-9 readline), so that the user can use backspace and history and such. 
  I'd also like to have a prompt at the beginning of the line.  These last 
two desires seem to be incompatible, at least mod my best efforts.

For instance, please consider the following:

(use-modules (ice-9 rdelim) (ice-9 format) (ice-9 readline))
(activate-readline)

(define (test)
   (define str #f)
   (display "prompt: ")
   (let loop ((n 1000000))
         (if (not (zero? n)) (loop (1- n))))
   (set! str (read-line))
   (newline)
   (display str))

(test)

This prints "prompt: " on a line, and then after a short time, it is 
erased.  The mess with loop in the middle is of course a crufty time delay, 
without which I can't see "prompt: " at all before it disappears.  After it 
has disappeared, I can type whatever I like, and then press enter. 
Whatever I have typed is then printed as expected, on a new line.

This behavior is unchanged (except for how much text is actually read) when 
I substitute read-char or read in for read-line.

This behavior is gone when I remove (activate-readline).

However, without readline, as I said above, the user cannot backspace, 
which is a great annoyance.

Obviously, however, when the normal guile repl uses readline, it has a 
prompt which is not eaten.  How is this accomplished?

Regards,
Jon


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


             reply	other threads:[~2006-09-27 21:26 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-27 21:26 Jon Wilson [this message]
2006-09-28  1:40 ` readline eats previous text on line Kevin Ryde
2006-09-28  1:50   ` Jon Wilson
2006-09-28  7:49     ` Neil Jerram
2006-09-29  0:47       ` Kevin Ryde
2006-09-29 22:33         ` Neil Jerram
2006-09-30 12:25           ` Neil Jerram
2006-10-03  0:15             ` Kevin Ryde
2006-10-03  0:52               ` Kevin Ryde
2006-10-04 23:13               ` Kevin Ryde
2006-10-05 23:06                 ` Neil Jerram
2006-10-05 23:35               ` Neil Jerram
2006-10-06  0:03                 ` Kevin Ryde
2006-12-01 20:24                 ` Jon Wilson
2006-10-03  0:22             ` Kevin Ryde
2006-09-28 21:08   ` Jon Wilson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=451AEC75.90200@fastmail.fm \
    --to=j85wilson@fastmail.fm \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).