Method: Textbringer::EchoArea#redisplay

Defined in:
lib/textbringer/window.rb

#redisplayObject



910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
# File 'lib/textbringer/window.rb', line 910

def redisplay
  return if @buffer.nil?
  @buffer.save_point do |point|
    @window.erase
    if @buffer.input_method_status != "--"
      @window.setpos(@window.cury, editable_columns + 1)
      @window.addstr(@buffer.input_method_status)
    end
    @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)
      @cursor.y = @cursor.x = 0
      while !@buffer.end_of_buffer?
        cury = @window.cury
        curx = @window.curx
        update_cursor_and_attr(point, cury, curx)
        c = @buffer.char_after
        if c == "\n"
          break
        end
        c = compose_character(point, cury, curx, c)
        s = escape(c)
        newx = curx + Buffer.display_width(s)
        if newx > editable_columns
          break
        end
        @window.addstr(s)
        @buffer.forward_char
        break if newx >= editable_columns
      end
      if @buffer.point_at_mark?(point)
        @cursor.y = @window.cury
        @cursor.x = @window.curx
      end
      @window.setpos(@cursor.y, @cursor.x)
    end
    @window.noutrefresh
  end
end