Archived
1
0
Fork 0

More cursor control

This commit is contained in:
Braiden Vasco 2017-07-21 13:16:53 +00:00
parent 2056e88be5
commit 00f48f9a58

View file

@ -81,6 +81,10 @@ private
case event
when /[a-zA-Z0-9 _-]/
@search.putc event
when Curses::Key::HOME
@search.home
when Curses::Key.const_get(:END)
@search.end
when Curses::Key::BACKSPACE
@search.backspace
when Curses::Key::UP
@ -135,6 +139,14 @@ class Search
update
end
def home
@cursor_pos = 0
end
def end
@cursor_pos = @text.length
end
def backspace
@text = text[0...-1]
@cursor_pos -= 1