[ruby-trunk - Bug #8675][Assigned] Add Readline.point=(pos)

Issue #8675 has been reported by naruse (Yui NARUSE).


Bug #8675: Add Readline.point=(pos)
https://bugs.ruby-lang.org/issues/8675

Author: naruse (Yui NARUSE)
Status: Assigned
Priority: Normal
Assignee: kouji (Kouji T.)
Category: ext
Target version: current: 2.1.0
ruby -v: ruby -v: ruby 2.1.0dev (2013-07-24 trunk 42146)
[x86_64-freebsd9.1]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN

r42146 でのテスト修正で \A を入力しているのですが、rl_point を直接いじった方が正しい気がするので。

diff --git a/ext/readline/readline.c b/ext/readline/readline.c
index 714b08c…03ab724 100644
— a/ext/readline/readline.c
+++ b/ext/readline/readline.c
@@ -808,6 +808,12 @@ readline_s_get_point(VALUE self)
{
return INT2NUM(rl_point);
}
+static VALUE
+readline_s_set_point(VALUE self, VALUE pos)
+{

  • rl_point = NUM2INT(pos);
  • return pos;
    +}
    #else
    #define readline_s_get_point rb_f_notimplement
    #endif
    @@ -1761,6 +1767,8 @@ Init_readline()
    readline_s_get_line_buffer, 0);
    rb_define_singleton_method(mReadline, “point”,
    readline_s_get_point, 0);
  • rb_define_singleton_method(mReadline, “point=”,
  •                          readline_s_set_point, 1);
    
    rb_define_singleton_method(mReadline, “set_screen_size”,
    readline_s_set_screen_size, 2);
    rb_define_singleton_method(mReadline, “get_screen_size”,

Issue #8675 has been updated by kouji (Kouji T.).

Due date set to 07/31/2013

ありがとうございます。
7月中には取り込む方向で進めますね。
取り込むならユニットテストもほしいですね。あと、libeditでの動作確認も。

Bug #8675: Add Readline.point=(pos)
https://bugs.ruby-lang.org/issues/8675#change-40675

Author: naruse (Yui NARUSE)
Status: Assigned
Priority: Normal
Assignee: kouji (Kouji T.)
Category: ext
Target version: current: 2.1.0
ruby -v: ruby -v: ruby 2.1.0dev (2013-07-24 trunk 42146)
[x86_64-freebsd9.1]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN

r42146 でのテスト修正で \A を入力しているのですが、rl_point を直接いじった方が正しい気がするので。

diff --git a/ext/readline/readline.c b/ext/readline/readline.c
index 714b08c…03ab724 100644
— a/ext/readline/readline.c
+++ b/ext/readline/readline.c
@@ -808,6 +808,12 @@ readline_s_get_point(VALUE self)
{
return INT2NUM(rl_point);
}
+static VALUE
+readline_s_set_point(VALUE self, VALUE pos)
+{

  • rl_point = NUM2INT(pos);
  • return pos;
    +}
    #else
    #define readline_s_get_point rb_f_notimplement
    #endif
    @@ -1761,6 +1767,8 @@ Init_readline()
    readline_s_get_line_buffer, 0);
    rb_define_singleton_method(mReadline, “point”,
    readline_s_get_point, 0);
  • rb_define_singleton_method(mReadline, “point=”,
  •                          readline_s_set_point, 1);
    
    rb_define_singleton_method(mReadline, “set_screen_size”,
    readline_s_set_screen_size, 2);
    rb_define_singleton_method(mReadline, “get_screen_size”,