summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog12
-rw-r--r--doc/NEWS5
-rw-r--r--ext/readline/README57
-rw-r--r--ext/readline/readline.c35
4 files changed, 84 insertions, 25 deletions
diff --git a/ChangeLog b/ChangeLog
index 0d9e2524a4..f71c0c05db 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+Fri Jul 6 00:49:05 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/readline/readline.c (readline_event): merge from 1.7: a
+ non-void function should return a value.
+
+ * ext/readline/readline.c: merge from 1.7: add new methods:
+ Readline::completion_append_character and
+ Readline::completion_append_character=.
+
+ * ext/readline/README, ext/readline/README.jp: merge from 1.7: add
+ an English version of the document.
+
Wed Jul 4 00:12:37 2001 Akinori MUSHA <knu@iDaemons.org>
* lib/find.rb: merge from 1.7: rescue Errno::EACCES as well.
diff --git a/doc/NEWS b/doc/NEWS
index 7697dd3b85..4ba2926f99 100644
--- a/doc/NEWS
+++ b/doc/NEWS
@@ -1,5 +1,10 @@
Summary of the changes since 1.6.4:
+: Readline::completion_append_characte
+: Readline::completion_append_character=
+
+ Added.
+
: Socket::SO_*
Added.
diff --git a/ext/readline/README b/ext/readline/README
index 8a5fe9120f..9bbf325c99 100644
--- a/ext/readline/README
+++ b/ext/readline/README
@@ -1,55 +1,62 @@
-GNU Readline Libraryを利用するための拡張モジュールです。
+Extension for GNU Readline Library
-require "readline"
-include Readline
+Example:
-line = readline("Prompt> ", TRUE)
+ require "readline"
+ include Readline
-のように使用してください。
+ line = readline("Prompt> ", true)
[Readline]
-<モジュール関数>
+<module function>
-readline(prompt, add=nil)
+readline(prompt, add_history=nil)
- 一行入力を読み込みます。
- addがTRUEの場合、ヒストリに読み込んだ文字列を追加します。
+ Reads one line with line editing. The inputted line is added to the
+ history if add_history is true.
-<クラスメソッド>
+<class methods>
completion_proc = proc
- 補完時の動作を決定するProcオブジェクトを指定します。
- procは引数に入力文字列を取り、候補文字列の配列を返すように
- してください。
+ Specifies a Proc object to determine completion behavior. It
+ should take input-string, and return an array of completion
+ candidates.
completion_proc
- 補完時の動作を決定するProcオブジェクトを返します。
+ Returns the completion Proc object.
-completion_case_fold = case_fold
+completion_case_fold = bool
- 補完時に大文字小文字を区別しない場合、TRUEを指定します。
+ Sets whether or not to ignore case on completion.
completion_case_fold
- 補完時に大文字小文字を区別しない場合、TRUEを返します。
+ Returns true if completion ignores case.
+
+completion_append_character = char
+
+ Specifies a character to be appended on completion.
+ Nothing will be appended if an empty string ("") or nil is
+ specified.
+
+completion_append_character
+
+ Returns a string containing a character to be appended on
+ completion. The default is a space (" ").
vi_editing_mode
- VIモードになります。
+ Specifies VI editing mode.
emacs_editing_mode
- Emacsモードになります。
+ Specifies Emacs editing mode.
-<クラス定数>
+<class constants>
HISTORY
-ヒストリに対する操作はこの定数を通して行ってください。
-配列と同じように扱えるようになっています。
-
-
- \ No newline at end of file
+The history buffer. It behaves just like an array.
diff --git a/ext/readline/readline.c b/ext/readline/readline.c
index 876207c224..49e3c04fed 100644
--- a/ext/readline/readline.c
+++ b/ext/readline/readline.c
@@ -26,6 +26,7 @@ readline_event()
{
CHECK_INTS;
rb_thread_schedule();
+ return 0;
}
static VALUE
@@ -167,6 +168,36 @@ readline_s_emacs_editing_mode(self)
}
static VALUE
+readline_s_set_completion_append_character(self, str)
+ VALUE self, str;
+{
+ if (NIL_P(str)) {
+ rl_completion_append_character = '\0';
+ } else {
+ Check_Type(str, T_STRING);
+
+ rl_completion_append_character = RSTRING(str)->ptr[0];
+ }
+
+ return self;
+}
+
+static VALUE
+readline_s_get_completion_append_character(self)
+ VALUE self;
+{
+ VALUE str;
+
+ if (rl_completion_append_character == '\0')
+ return Qnil;
+
+ str = rb_str_new("", 1);
+ RSTRING(str)->ptr[0] = rl_completion_append_character;
+
+ return str;
+}
+
+static VALUE
hist_to_s(self)
VALUE self;
{
@@ -394,6 +425,10 @@ Init_readline()
readline_s_vi_editing_mode, 0);
rb_define_singleton_method(mReadline, "emacs_editing_mode",
readline_s_emacs_editing_mode, 0);
+ rb_define_singleton_method(mReadline, "completion_append_character=",
+ readline_s_set_completion_append_character, 1);
+ rb_define_singleton_method(mReadline, "completion_append_character",
+ readline_s_get_completion_append_character, 0);
histary = rb_obj_alloc(rb_cObject);
rb_extend_object(histary, rb_mEnumerable);