Class: Textbringer::EchoArea
Constant Summary
Constants inherited
from Window
Window::ALT_ALPHA_BASE, Window::ALT_NUMBER_BASE, Window::FALLBACK_CHARACTERS, 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.
925
926
927
928
929
930
|
# File 'lib/textbringer/window.rb', line 925
def initialize(*args)
super
@message = nil
@prompt = ""
@active = false
end
|
Instance Attribute Details
#active=(value) ⇒ Object
Sets the attribute active
923
924
925
|
# File 'lib/textbringer/window.rb', line 923
def active=(value)
@active = value
end
|
#message ⇒ Object
Returns the value of attribute message.
921
922
923
|
# File 'lib/textbringer/window.rb', line 921
def message
@message
end
|
#prompt ⇒ Object
Returns the value of attribute prompt.
922
923
924
|
# File 'lib/textbringer/window.rb', line 922
def prompt
@prompt
end
|
Instance Method Details
#active? ⇒ Boolean
936
937
938
|
# File 'lib/textbringer/window.rb', line 936
def active?
@active
end
|
#clear ⇒ Object
940
941
942
943
944
945
|
# File 'lib/textbringer/window.rb', line 940
def clear
@buffer.clear
@top_of_window.location = @buffer.point_min
@message = nil
@prompt = ""
end
|
#clear_message ⇒ Object
947
948
949
|
# File 'lib/textbringer/window.rb', line 947
def clear_message
@message = nil
end
|
#echo_area? ⇒ Boolean
932
933
934
|
# File 'lib/textbringer/window.rb', line 932
def echo_area?
true
end
|
#editable_columns ⇒ Object
1019
1020
1021
1022
1023
1024
1025
|
# File 'lib/textbringer/window.rb', line 1019
def editable_columns
if @buffer.input_method_status == "--"
@columns
else
@columns - Buffer.display_width(@buffer.input_method_status) - 1
end
end
|
#move(y, x) ⇒ Object
1007
1008
1009
1010
1011
|
# File 'lib/textbringer/window.rb', line 1007
def move(y, x)
@y = y
@x = x
@window.move(y, x)
end
|
#redisplay ⇒ Object
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
|
# File 'lib/textbringer/window.rb', line 955
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)
@window.attrset(0)
@in_region = false
@current_highlight_attrs = 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
|
#redraw ⇒ Object
1003
1004
1005
|
# File 'lib/textbringer/window.rb', line 1003
def redraw
@window.redraw
end
|
#resize(lines, columns) ⇒ Object
1013
1014
1015
1016
1017
|
# File 'lib/textbringer/window.rb', line 1013
def resize(lines, columns)
@lines = lines
@columns = columns
@window.resize(lines, columns)
end
|
#show(message) ⇒ Object
951
952
953
|
# File 'lib/textbringer/window.rb', line 951
def show(message)
@message = message
end
|