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
|
||||
when /[a-zA-Z0-9 _-]/
|
||||
@search.putc event
|
||||
when Curses::Key::LEFT
|
||||
@search.left
|
||||
when Curses::Key::RIGHT
|
||||
@search.right
|
||||
when Curses::Key::HOME
|
||||
@search.home
|
||||
when Curses::Key.const_get(:END)
|
||||
|
@ -139,6 +143,16 @@ class Search
|
|||
update
|
||||
end
|
||||
|
||||
def left
|
||||
@cursor_pos -= 1
|
||||
update
|
||||
end
|
||||
|
||||
def right
|
||||
@cursor_pos += 1
|
||||
update
|
||||
end
|
||||
|
||||
def home
|
||||
@cursor_pos = 0
|
||||
end
|
||||
|
|
Reference in a new issue