Thanks. But i don't think it's a good way. Because i don't want color just #. I want a full syntax color for ruby language. (and other language in futur...) So full color each x ms i don't think it's a good way. I can't believe I'm the first man with this problem. Joao Pedrosa wrote: > Hi, > > On Sat, 15 Jan 2005 23:21:13 +0900, oxman <no / in-your-dream.net> wrote: > >>The code : > > > Do you get any improvement or idea with this code: > > require 'gtk2' > Gtk.init > window = Gtk::Window.new > window.signal_connect("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('insert-text') do |a,iter,text,length| > Gtk.timeout_add(10){ > iter = buffer.start_iter > while a = iter.forward_search('#', Gtk::TextIter::SEARCH_TEXT_ONLY) do > iter, = a > iter2 = buffer.get_iter_at_offset(iter.offset) > iter2.forward_to_line_end > buffer.apply_tag(buffer.tag_table.lookup("blue"), iter, iter2) > iter.forward_line > p a > end > false > } > end > Gtk.main > > It seems that after the first # is colored I get some improvement, but > I haven't come up with a best approach yet, though I'm interested in > this as well. :-) > > Cheers, > Joao > >