More cursor control
This commit is contained in:
parent
e1c4342dd4
commit
253aeab321
1 changed files with 14 additions and 0 deletions
14
lib/main.rb
14
lib/main.rb
|
@ -81,6 +81,10 @@ private
|
||||||
case event
|
case event
|
||||||
when /[a-zA-Z0-9 _-]/
|
when /[a-zA-Z0-9 _-]/
|
||||||
@search.putc event
|
@search.putc event
|
||||||
|
when Curses::Key::LEFT
|
||||||
|
@search.left
|
||||||
|
when Curses::Key::RIGHT
|
||||||
|
@search.right
|
||||||
when Curses::Key::HOME
|
when Curses::Key::HOME
|
||||||
@search.home
|
@search.home
|
||||||
when Curses::Key.const_get(:END)
|
when Curses::Key.const_get(:END)
|
||||||
|
@ -139,6 +143,16 @@ class Search
|
||||||
update
|
update
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def left
|
||||||
|
@cursor_pos -= 1
|
||||||
|
update
|
||||||
|
end
|
||||||
|
|
||||||
|
def right
|
||||||
|
@cursor_pos += 1
|
||||||
|
update
|
||||||
|
end
|
||||||
|
|
||||||
def home
|
def home
|
||||||
@cursor_pos = 0
|
@cursor_pos = 0
|
||||||
end
|
end
|
||||||
|
|
Reference in a new issue