--- buffer-old.rb 2010-05-12 00:42:50.501278238 +0300 +++ buffer.rb 2010-05-12 00:42:37.711280439 +0300 @@ -1,5 +1,6 @@ require 'etc' require 'thread' +require 'console/string' begin require 'ncursesw' @@ -129,10 +130,8 @@ @w.attrset Colormap.color_for(opts[:color] || :none, opts[:highlight]) s ||= "" maxl = @width - x # maximum display width width - stringl = maxl # string "length" - ## the next horribleness is thanks to ruby's lack of widechar support - stringl += 1 while stringl < s.length && s[0 ... stringl].display_length < maxl - @w.mvaddstr y, x, s[0 ... stringl] + s = s.display_slice(0,maxl,"") + @w.mvaddstr y, x, s unless opts[:no_fill] l = s.display_length unless l >= maxl