1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/readline/readline.c (readline_getc): applied a patch in

#3827 by by Akio Tajima <artonx AT yahoo.co.jp>. (see #3827)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32181 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
kouji 2011-06-21 04:30:14 +00:00
parent d2e61d2205
commit e49f890906
2 changed files with 33 additions and 0 deletions

View file

@ -1,3 +1,8 @@
Tue Jun 21 13:25:35 2011 TAKAO Kouji <kouji@takao7.net>
* ext/readline/readline.c (readline_getc): applied a patch in
#3827 by by Akio Tajima <artonx AT yahoo.co.jp>. (see #3827)
Tue Jun 21 13:16:31 2011 TAKAO Kouji <kouji@takao7.net> Tue Jun 21 13:16:31 2011 TAKAO Kouji <kouji@takao7.net>
* ext/readline/extconf.rb: fixed bug, specify --disable-libedit * ext/readline/extconf.rb: fixed bug, specify --disable-libedit

View file

@ -131,6 +131,34 @@ readline_getc(FILE *input)
if (!readline_instream) return rl_getc(input); if (!readline_instream) return rl_getc(input);
GetOpenFile(readline_instream, ifp); GetOpenFile(readline_instream, ifp);
if (rl_instream != ifp->stdio_file) return rl_getc(input); if (rl_instream != ifp->stdio_file) return rl_getc(input);
#if defined(_WIN32)
{
INPUT_RECORD ir;
int n;
static int prior_key = '0';
for (;;) {
if (prior_key > 0xff) {
prior_key = rl_getc(ifp->stdio_file);
return prior_key;
}
if (PeekConsoleInput((HANDLE)_get_osfhandle(ifp->fd), &ir, 1, &n)) {
if (n == 1) {
if (ir.EventType == KEY_EVENT && ir.Event.KeyEvent.bKeyDown) {
prior_key = rl_getc(ifp->stdio_file);
return prior_key;
} else {
ReadConsoleInput((HANDLE)_get_osfhandle(ifp->fd), &ir, 1, &n);
}
} else {
HANDLE h = (HANDLE)_get_osfhandle(ifp->fd);
rb_w32_wait_events(&h, 1, INFINITE);
}
} else {
break;
}
}
}
#endif
c = rb_funcall(readline_instream, id_getbyte, 0, 0); c = rb_funcall(readline_instream, id_getbyte, 0, 0);
if (NIL_P(c)) return EOF; if (NIL_P(c)) return EOF;
return NUM2CHR(c); return NUM2CHR(c);