Forum: Ruby-Gnome 2 How do I customize 'word ends' for TextView / add underscore to selection for double click?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
3e9615bffac212c1617213b71fcde2fd?d=identicon&s=25 Andrey Chaschev (chaschev)
on 2009-04-15 15:50
(Received via mailing list)

I tried doing it with the code below and for the example from the
distribution (pango/samples/break.rb) it worked: underscore
was then similar to an ordinary letter. I mean word_end for
underscore became true. But this doesn't work when I'm trying
to double-click a word with an underscore - it always selects a
part to the left or to the right of it. Any help is appreciated.

  module Pango
    alias :super_break :break
    module_function :super_break

    def self.break s, analysis
      #puts "intercepted"
      r = super_break s, analysis
      # TODO: fix for ruby 1.9
      #puts s
      chars = s.unpack("U*")
      for i in 0...chars.length
        c = chars[i]
        #print c.chr
        r[i].word_end = false if c == 95 # _

0158871402c1ecfa57952e8a379cfd10?d=identicon&s=25 Daniel Lucraft (lucraft)
on 2009-04-17 12:35
(Received via mailing list)
Your snippet works for Ruby code but won't affect other Gtk widgets
that depend on the C version of Pango, like GtkTextBuffer.

I too would love to know how to customize this kind of thing in Pango,
but I'm not sure if it's possible, based on my Google searchigns.
Perhaps there is a Pango mailing list or irc channel we could ask in?

Please post back here if you do find a solution.

Daniel Benjamin Lucraft

2009/4/15 Andrey Chaschev <>:
This topic is locked and can not be replied to.