# wide.rb # by Kazuhiro Yoshida (moriq.kazuhiro@nifty.ne.jp) module Wide def wide_at(string, index) i = 0 string.scan(/(.)/) { |char,| break if i == index || i == index+1 i+= char.size } i - index end module_function :wide_at def space?(dst, src) tail = if dst then /.$/ =~ dst; $& else nil end head = if src then /^./ =~ src; $& else nil end if tail && head if tail.size == 2 && head.size == 2 false else true end else nil end end module_function :space? end