|
Posted by Lars Eighner on 09/14/07 23:38
In our last episode, <46eb178b$0$32540$4c368faf@roadrunner.com>, the lovely
and talented Norman Peelman broadcast on comp.lang.php:
> Lars Eighner wrote:
>> The ncurses functions are such a mess (and some of it I suspect is in
>> ncurses itself) that I am thinking the easiest way to write a terminal
>> interface is simply to write ANSI directly to the terminal.
>>
>> Although the manual on the CLI refers me to readline, readline doesn't
>> seem provide a way to get a single key press, and so far as I can tell
>> doesn't provide a reference to how to get a single keypress. I reckon
>> some widgets would be more spiffy with keypresses instead of whole lines.
>>
>> How can I get keypresses?
>>
> If you're on Windows, you can't. You have to press the enter key to
> 'send' the input. Unix/Linux it's supposed to work as expected. Haven't
> tried it yet though.
What is "it's" in "it's supposed to work as expected"?
On FreeBSD readline will not capture key presses (or at least I do not know
how to do so). If I initiate ncurses to use ncurses_getch, it seizes the
display so cannot write ANSI to it (and it overwrites any ANSI I have
written to the screen --- besides which, the whole point of writing an ANSI
interface is to avoid PHP ncurses which are (is) ugly as hell, largely
undocumented, inflexible, object-oriented, and tends to crash the terminal
rather than failing gracefully when it fails.
It is easy enough to draw widgets by writing ANSI directly to a terminal,
but if you cannot move the cursor around with the arrow key or open a
drop-down box with Enter, the widgets are just pretty pictures.
--
Lars Eighner <http://larseighner.com/> <http://myspace.com/larseighner>
Countdown: 493 days to go.
What do you do when you're debranded?
Navigation:
[Reply to this message]
|