Not too sure about your exact needs but:

- if you want to modify a shell terminal, hopefully someone else can help
you (maybe a keystroke can trigger a command that interacts with a racket
program running in the background?)

- if you want a Racket terminal (to evaluate Racket expressions) or just
some text terminal (say for a text adventure game), maybe you would be
better off making a GUI component if you can afford it, where you can
easily receive keystrokes and modify the text that the user inputs. Have a
look at GRacket for a GUI Racket terminal, otherwise a simple text% editor
should do it:
https://docs.racket-lang.org/gui/text_.html?q=gracket
Then you can derive a class from text% and implement the 'on-char' method
for example. This definitely has a larger implementation+doc-reading time
than a simple 'read-line', but once you've dealt with the boring GUI stuff,
it should be much simpler to do what you want with the user input,
including changing the currently selected text and navigating between
several text proposals with the arrow keys for example.

(
Also maybe have a look at open-input-text-editor:
https://docs.racket-lang.org/gui/Editor_Functions.html?q=gracket#%28def._%28%28lib._mred%2Fmain..rkt%29._open-input-text-editor%29%29
)

HTH,
Laurent

On Sun, Oct 30, 2016 at 2:54 PM, Ken MacKenzie <deviloc...@gmail.com> wrote:

> So a curiosity question.  Right now I am reading in a line of terminal
> input from the user and handling it.  I am thinking of switching the
> program to handle the input character by character, and just wondering how
> to do that but also have it seem to the user that the program is waiting
> for them to press enter, appear the same as a read-line basically.
>
> The reason I want to do that is trigger some events for certain non-alpha
> for now, white space and punctuation.  The other thing is eventually I may
> with to begin some background processing as the user is completing the full
> input string.  Basically the appearance of better performance using the
> bottle neck of the time it takes a user to create the input.  Granted I
> will have to deal with backspace or other cases where the user changes
> there mind.  Basically doing some predictive text analysis sort of.
>
> So what is the best way to read keypress or character by character input
> in racket.  For now dealing with a CLI/terminal interface to keep it simple
> as I work to test and refine my methods.
>
> Ken
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to