851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
|
# File 'lib/textbringer/window.rb', line 851
def redisplay
return if @buffer.nil?
@buffer.save_point do |saved|
@window.erase
@window.setpos(0, 0)
if @message
@window.addstr(escape(@message))
else
prompt = escape(@prompt)
@window.addstr(prompt)
framer
@buffer.point_to_mark(@top_of_window)
y = x = 0
while !@buffer.end_of_buffer?
cury, curx = @window.cury, @window.curx
if @buffer.point_at_mark?(saved)
y, x = cury, curx
end
c = @buffer.char_after
if c == "\n"
break
end
s = escape(c)
newx = curx + Buffer.display_width(s)
if newx > @columns
break
end
@window.addstr(s)
break if newx >= @columns
@buffer.forward_char
end
if @buffer.point_at_mark?(saved)
y, x = @window.cury, @window.curx
end
@window.setpos(y, x)
end
@window.noutrefresh
end
end
|