Project

General

Profile

Actions

Bug #8782

closed

Don't set rl_getc_function on editline

Added by naruse (Yui NARUSE) about 12 years ago. Updated about 2 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 2.1.0dev (2013-08-12 trunk 42528) [x86_64-darwin12.4.0]
Backport:
[ruby-dev:47617]
Tags:

Description

r42402 ไปฅๆฅ OS X ็ญ‰ใฎ editline ็’ฐๅขƒใงใฏ #define rl_getc(f) EOF ใŒไฝฟใ‚ใ‚Œใ‚‹ใ‚ˆใ†ใซใชใฃใฆใ—ใพใฃใฆๆฎ‹ๅฟตใชใ“ใจใซใชใฃใฆใ„ใŸใ‚ใ‘ใงใ™ใŒใ€
ใใ‚‚ใใ‚‚ editline ใฎ readline wrapper ใฏ non ASCII ใซๅฏพๅฟœใ—ใฆใ„ใพใ›ใ‚“ใ€‚
(editline ่‡ชไฝ“ใซใฏ UTF-8 ใฎใฟใฎๅฏพๅฟœใŒๅ…ฅใฃใŸใŒใ€readline wrapper ใฏ src/readline.c ใฎ _getc_function ใ‚’็ตŒ็”ฑใ™ใ‚‹ใฎใง non ASCII ใฏๅŒ–ใ‘ใ‚‹)

ใฎใงใ€ใ„ใฃใ rl_getc_function ใ‚’ไฝฟใ‚ใชใ„ใ‚ˆใ†ใซใ—ใฆใฏใฉใ†ใงใ—ใ‚‡ใ†ใ€‚
ไปฅไธ‹ใฎใ‚ˆใ†ใชใƒ‘ใƒƒใƒใ‚’ๅฝ“ใฆใ‚‹ใจใ€readline ใชใ—ใฎ OS X ใฎ irb ใงๆ—ฅๆœฌ่ชžใŒไฝฟใˆใ‚‹ใ‚ˆใ†ใซใชใ‚Šใพใ™ใ€‚

diff --git a/ext/readline/extconf.rb b/ext/readline/extconf.rb
index 0b121c1..bc0ee77 100644
--- a/ext/readline/extconf.rb
+++ b/ext/readline/extconf.rb
@@ -94,4 +94,5 @@ readline.have_func("clear_history")
readline.have_func("rl_redisplay")
readline.have_func("rl_insert_text")
readline.have_func("rl_delete_text")
+readline.have_func("el_init")
create_makefile("readline")
diff --git a/ext/readline/readline.c b/ext/readline/readline.c
index 0f76d1a..85109f0 100644
--- a/ext/readline/readline.c
+++ b/ext/readline/readline.c
@@ -130,12 +130,7 @@ static VALUE readline_instream;
static VALUE readline_outstream;

#if defined HAVE_RL_GETC_FUNCTIONยถ

-#ifndef HAVE_RL_GETC
-#define rl_getc(f) EOF
-#endifยถ

-static int readline_getc(FILE *);
+# ifndef HAVE_EL_INIT
static int
readline_getc(FILE *input)
{
@@ -187,6 +182,7 @@ readline_getc(FILE *input)
#endif
return FIX2INT(c);
}
+# endif
#elif defined HAVE_RL_EVENT_HOOK
#define BUSY_WAIT 0

@@ -1771,7 +1767,9 @@ Init_readline()
/* libedit check rl_getc_function only when rl_initialize() is called, /
/
and using_history() call rl_initialize(). /
/
This assignment should be placed before using_history() */
+# ifndef HAVE_EL_INIT
rl_getc_function = readline_getc;
+# endif
#elif defined HAVE_RL_EVENT_HOOK
rl_event_hook = readline_event;
#endif

Updated by akr (Akira Tanaka) almost 12 years ago

rl_getc_function ใ‚’่จญๅฎšใ—ใชใ„ใจใ€readline() ๅ†…ใงใƒ–ใƒญใƒƒใ‚ฏใ—ใŸๆ™‚ใซไป–ใฎใ‚นใƒฌใƒƒใƒ‰ใŒใ™ในใฆๆญขใพใฃใฆใ—ใพใ†ใฎใงใฏใชใ„ใ‹ใจๆ€ใ„ใพใ™ใ€‚

ใ“ใ‚Œใฏใ€็พๅœจใ€rl_getc_function ๅ†…ใง read ใ‚ทใ‚นใƒ†ใƒ ใ‚ณใƒผใƒซใ‚’ๅ‘ผใณๅ‡บใ™ใจใ“ใ‚ใ ใ‘ใ‚’ blocking region ใซใ—ใฆใ€ไป–ใฎใ‚นใƒฌใƒƒใƒ‰ใŒๅ‹•ใ‘ใ‚‹ใ‚ˆใ†ใซใ—ใฆใ„ใ‚‹ใ‹ใ‚‰ใงใ™ใ€‚

readline() ้–ขๆ•ฐๅ…จไฝ“ใ‚’ blocking region ๅ†…ใงๅฎŸ่กŒใ™ใ‚‹ใจใ„ใ†ๆ‰‹ใฏใ‚ใ‚‹ใ‹ใ‚‚ใ—ใ‚Œใพใ›ใ‚“ใ€‚

Updated by hsbt (Hiroshi SHIBATA) over 11 years ago

  • Target version changed from 2.1.0 to 2.2.0
Actions #3

Updated by naruse (Yui NARUSE) over 7 years ago

  • Target version deleted (2.2.0)

Updated by jeremyevans0 (Jeremy Evans) about 2 years ago

  • Status changed from Assigned to Closed
  • Backport deleted (1.9.3: UNKNOWN, 2.0.0: UNKNOWN)

Readline support was removed in 59fd67fc3d405e529e038172e769ff20a8fb5535. If this is still an issue, please file it upstream https://github.com/ruby/readline-ext

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0