class Reline::Unicode
def self.em_forward_word_with_capitalization(line, byte_pointer)
def self.em_forward_word_with_capitalization(line, byte_pointer) width = 0 byte_size = 0 new_str = String.new while line.bytesize > (byte_pointer + byte_size) size = get_next_mbchar_size(line, byte_pointer + byte_size) mbchar = line.byteslice(byte_pointer + byte_size, size) break if mbchar.encode(Encoding::UTF_8) =~ /\p{Word}/ new_str += mbchar width += get_mbchar_width(mbchar) byte_size += size end first = true while line.bytesize > (byte_pointer + byte_size) size = get_next_mbchar_size(line, byte_pointer + byte_size) mbchar = line.byteslice(byte_pointer + byte_size, size) break if mbchar.encode(Encoding::UTF_8) =~ /\P{Word}/ if first new_str += mbchar.upcase first = false else new_str += mbchar.downcase end width += get_mbchar_width(mbchar) byte_size += size end [byte_size, width, new_str] end