From: "jeremyevans0 (Jeremy Evans) via ruby-dev" <ruby-dev@ml.ruby-lang.org>
To: ruby-dev@ml.ruby-lang.org
Cc: "jeremyevans0 (Jeremy Evans)" <noreply@ruby-lang.org>
Subject: [ruby-dev:52038] [Ruby master Bug#8782] Don't set rl_getc_function on editline
Date: Tue, 22 Aug 2023 21:05:01 +0000 (UTC) [thread overview]
Message-ID: <redmine.journal-104205.20230822210500.5@ruby-lang.org> (raw)
In-Reply-To: <redmine.issue-8782.20130812163155.5@ruby-lang.org>
Issue #8782 has been updated by jeremyevans0 (Jeremy Evans).
Status changed from Assigned to Closed
Backport deleted (1.9.3: UNKNOWN, 2.0.0: UNKNOWN)
Readline support was removed in commit:59fd67fc3d405e529e038172e769ff20a8fb5535. If this is still an issue, please file it upstream https://github.com/ruby/readline-ext
----------------------------------------
Bug #8782: Don't set rl_getc_function on editline
https://bugs.ruby-lang.org/issues/8782#change-104205
* Author: naruse (Yui NARUSE)
* Status: Closed
* Priority: Normal
* Assignee: kouji (Kouji Takao)
* ruby -v: ruby 2.1.0dev (2013-08-12 trunk 42528) [x86_64-darwin12.4.0]
----------------------------------------
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
--
https://bugs.ruby-lang.org/
parent reply other threads:[~2023-08-22 21:05 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <redmine.issue-8782.20130812163155.5@ruby-lang.org>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=redmine.journal-104205.20230822210500.5@ruby-lang.org \
--to=ruby-dev@ml.ruby-lang.org \
--cc=noreply@ruby-lang.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).