Class: Textbringer::EchoArea
Constant Summary
Constants inherited
from Window
Window::ALT_ALPHA_BASE, Window::ALT_NUMBER_BASE, Window::HAVE_GET_KEY_MODIFIERS, Window::KEY_NAMES
Instance Attribute Summary collapse
Attributes inherited from Window
#bottom_of_window, #buffer, #columns, #lines, #mode_line, #top_of_window, #window, #x, #y
Instance Method Summary
collapse
Methods inherited from Window
beep, #close, colors, columns, current, current=, #current?, #delete, delete_other_windows, delete_window, #deleted?, echo_area, #enlarge, has_colors=, has_colors?, #has_input?, #highlight, lines, list, load_faces, other_window, #read_event, #read_event_nonblock, #recenter, #recenter_if_needed, redisplay, redraw, resize, #restore_point, #save_point, #scroll_down, #scroll_up, set_default_colors, #shrink, #shrink_if_larger_than_buffer, #split, start, update, #wait_input
Constructor Details
#initialize(*args) ⇒ EchoArea
Returns a new instance of EchoArea.
806
807
808
809
810
811
|
# File 'lib/textbringer/window.rb', line 806
def initialize(*args)
super
@message = nil
@prompt = ""
@active = false
end
|
Instance Attribute Details
#active=(value) ⇒ Object
Sets the attribute active
804
805
806
|
# File 'lib/textbringer/window.rb', line 804
def active=(value)
@active = value
end
|
#message ⇒ Object
Returns the value of attribute message.
802
803
804
|
# File 'lib/textbringer/window.rb', line 802
def message
@message
end
|
#prompt ⇒ Object
Returns the value of attribute prompt.
803
804
805
|
# File 'lib/textbringer/window.rb', line 803
def prompt
@prompt
end
|
Instance Method Details
#active? ⇒ Boolean
817
818
819
|
# File 'lib/textbringer/window.rb', line 817
def active?
@active
end
|
#clear ⇒ Object
821
822
823
824
825
826
|
# File 'lib/textbringer/window.rb', line 821
def clear
@buffer.clear
@top_of_window.location = @buffer.point_min
@message = nil
@prompt = ""
end
|
#clear_message ⇒ Object
828
829
830
|
# File 'lib/textbringer/window.rb', line 828
def clear_message
@message = nil
end
|
#echo_area? ⇒ Boolean
813
814
815
|
# File 'lib/textbringer/window.rb', line 813
def echo_area?
true
end
|
#move(y, x) ⇒ Object
880
881
882
883
884
|
# File 'lib/textbringer/window.rb', line 880
def move(y, x)
@y = y
@x = x
@window.move(y, x)
end
|
#redisplay ⇒ Object
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
|
# File 'lib/textbringer/window.rb', line 836
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
|
#redraw ⇒ Object
876
877
878
|
# File 'lib/textbringer/window.rb', line 876
def redraw
@window.redraw
end
|
#resize(lines, columns) ⇒ Object
886
887
888
889
890
|
# File 'lib/textbringer/window.rb', line 886
def resize(lines, columns)
@lines = lines
@columns = columns
@window.resize(lines, columns)
end
|
#show(message) ⇒ Object
832
833
834
|
# File 'lib/textbringer/window.rb', line 832
def show(message)
@message = message
end
|