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.
793
794
795
796
797
798
|
# File 'lib/textbringer/window.rb', line 793
def initialize(*args)
super
@message = nil
@prompt = ""
@active = false
end
|
Instance Attribute Details
#active=(value) ⇒ Object
Sets the attribute active
791
792
793
|
# File 'lib/textbringer/window.rb', line 791
def active=(value)
@active = value
end
|
#message ⇒ Object
Returns the value of attribute message.
789
790
791
|
# File 'lib/textbringer/window.rb', line 789
def message
@message
end
|
#prompt ⇒ Object
Returns the value of attribute prompt.
790
791
792
|
# File 'lib/textbringer/window.rb', line 790
def prompt
@prompt
end
|
Instance Method Details
#active? ⇒ Boolean
804
805
806
|
# File 'lib/textbringer/window.rb', line 804
def active?
@active
end
|
#clear ⇒ Object
808
809
810
811
812
813
|
# File 'lib/textbringer/window.rb', line 808
def clear
@buffer.clear
@top_of_window.location = @buffer.point_min
@message = nil
@prompt = ""
end
|
#clear_message ⇒ Object
815
816
817
|
# File 'lib/textbringer/window.rb', line 815
def clear_message
@message = nil
end
|
#echo_area? ⇒ Boolean
800
801
802
|
# File 'lib/textbringer/window.rb', line 800
def echo_area?
true
end
|
#move(y, x) ⇒ Object
867
868
869
870
871
|
# File 'lib/textbringer/window.rb', line 867
def move(y, x)
@y = y
@x = x
@window.move(y, x)
end
|
#redisplay ⇒ Object
823
824
825
826
827
828
829
830
831
832
833
834
835
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
|
# File 'lib/textbringer/window.rb', line 823
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
863
864
865
|
# File 'lib/textbringer/window.rb', line 863
def redraw
@window.redraw
end
|
#resize(lines, columns) ⇒ Object
873
874
875
876
877
|
# File 'lib/textbringer/window.rb', line 873
def resize(lines, columns)
@lines = lines
@columns = columns
@window.resize(lines, columns)
end
|
#show(message) ⇒ Object
819
820
821
|
# File 'lib/textbringer/window.rb', line 819
def show(message)
@message = message
end
|