Kouhei Sutou
kous****@users*****
Thu May 11 11:01:59 JST 2006
Index: kazehakase/data/ext/ruby/kz/actions.rb diff -u kazehakase/data/ext/ruby/kz/actions.rb:1.7 kazehakase/data/ext/ruby/kz/actions.rb:1.8 --- kazehakase/data/ext/ruby/kz/actions.rb:1.7 Wed Apr 26 10:17:55 2006 +++ kazehakase/data/ext/ruby/kz/actions.rb Thu May 11 11:01:59 2006 @@ -11,7 +11,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # -# You should have received a copyED of the GNU General Public License +# You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Index: kazehakase/data/ext/ruby/kz/ruby-dialog.rb diff -u kazehakase/data/ext/ruby/kz/ruby-dialog.rb:1.8 kazehakase/data/ext/ruby/kz/ruby-dialog.rb:1.9 --- kazehakase/data/ext/ruby/kz/ruby-dialog.rb:1.8 Wed May 10 17:43:19 2006 +++ kazehakase/data/ext/ruby/kz/ruby-dialog.rb Thu May 11 11:01:59 2006 @@ -151,12 +151,22 @@ handle_input(event) end end + @entry.signal_connect("activate") do |widget, event| + Kz.barrier do + activate_input + end + false + end + @entry.signal_connect("changed") do |widget, event| + Kz.barrier do + update_input_exp_completion + end + end update_widget_font(@entry, nil, "monospace") @ruby_exp_completion = Gtk::EntryCompletion.new @ruby_exp_model = Gtk::ListStore.new(String) @ruby_exp_completion.model = @ruby_exp_model @ruby_exp_completion.text_column = 0 - @ruby_exp_completion.inline_completion = true @entry.completion = @ruby_exp_completion @entry_last_text = nil @entry @@ -168,6 +178,17 @@ @entry.position = -1 end + def update_input_exp_completion + return if****@entry*****? + result = Kz::RubyCompletion.complete(@entry.text, @sandbox.binding) + result = result.compact.sort + @ruby_exp_model.clear + result.each do |item| + iter = @ruby_exp_model.append + iter[0] = item + end + end + def update_widget_font(widget, size=nil, family=nil) size ||= @default_font_size desc = widget.style.font_desc.copy @@ -197,10 +218,8 @@ def handle_input(event) handled = false case event.keyval - when Gdk::Keyval::GDK_Return - activate_input when Gdk::Keyval::GDK_m - activate_input if event.state.control_mask? + @entry.activate if event.state.control_mask? when Gdk::Keyval::GDK_p handled = previous_history if event.state.control_mask? when Gdk::Keyval::GDK_Up @@ -213,15 +232,6 @@ handled = true when Gdk::Keyval::GDK_i @ruby_exp_completion.insert_prefix if event.state.control_mask? - else - if !@entry.text.strip.empty? - @ruby_exp_model.clear - result = Kz::RubyCompletion.complete(@entry.text, @sandbox.binding) - result.compact.sort.each do |item| - iter = @ruby_exp_model.append - iter[0] = item - end - end end handled end