-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
win.getch returns -1 #5
Comments
Yup, do you want to read one char right? |
@tjgillies c#include <ncursesw/curses.h>
int main()
{
WINDOW* scr = initscr();
raw();
wgetch(scr);
endwin();
return 0;
} gcc test.c -lncursesw
./a.out
crystal@[Link("ncursesw")]
lib LibTest
type WindowPtr = Void*
fun initscr : WindowPtr
fun raw
fun wgetch(win : WindowPtr) : Int32
fun endwin
end
scr = LibTest.initscr
LibTest.raw
LibTest.wgetch(scr)
LibTest.endwin crystal test.cr |
I was playing around in another library and I think it has to do with setting timeout. Since there is no timeout set it doesn't wait for input and returns -1 immediately. |
Nice! But it still exit immediately. @[Link("ncursesw")]
lib LibTest
type WindowPtr = Void*
fun initscr : WindowPtr
fun raw
fun nodelay(win : WindowPtr, v : Bool) : Int32
fun notimeout(win : WindowPtr, v : Bool) : Int32
fun wgetch(win : WindowPtr) : Int32
fun endwin
end
scr = LibTest.initscr
LibTest.raw
LibTest.nodelay(scr, false)
LibTest.notimeout(scr, true)
LibTest.wgetch(scr)
LibTest.endwin I don't know why C works. If we lack some method calls, C should fail too. |
You need
I've just added
in |
Sounds like |
Yes I know it seems weird, but I need both Edit: using |
Yeah, you're right. It doesn't make much sense to me, but it's worth updating the README and example. |
Hi @maxdec ! Thank you for many information. It would be a difference of OS where I'm using Anyway, I fixed typo about |
Is there something special I'm supposed to do?
The text was updated successfully, but these errors were encountered: