class Unicode::DisplayWidth
def self.width_custom(string, overwrite)
def self.width_custom(string, overwrite) width = 0 string = string.each_codepoint.select{ |codepoint| if overwrite[codepoint] width += overwrite[codepoint] nil else codepoint end }.pack("U*") [width, string] end