From: oxman Date: 2005-01-15T23:21:13+09:00 Subject: Re: ruby-gnome2 : problem with signal "insert-text" The code : #!/usr/bin/ruby1.8 require 'gtk2' Gtk.init window = Gtk::Window.new window.signal_connect("destroy") { puts "destroy" Gtk.main_quit } textviewer = Gtk::TextView.new window.add(textviewer) window.set_default_size(600,400) window.show_all buffer = textviewer.buffer buffer.create_tag("blue", {"foreground" => "blue"}) buffer.signal_connect_after('insert-text') do |a,first_char,text,length| if (text == '#') first_char.offset -= 1 last_char = buffer.get_iter_at_offset(first_char.offset) last_char.forward_to_line_end buffer.apply_tag(buffer.tag_table.lookup("blue"), first_char, last_char) update_window end end def update_window while Gtk.events_pending? do Gtk.main_iteration end end Gtk.main Michael C. Libby wrote: > On Sat, Jan 15, 2005 at 10:21:10PM +0900, oxman wrote: > >>It don't work. >>The text is colored after one or two second :( > > > Do you have a short working example that demonstrates > the issue? Hard to debug without code. :) > > -Michael