More cursor control
This commit is contained in:
parent
2056e88be5
commit
00f48f9a58
1 changed files with 12 additions and 0 deletions
12
lib/main.rb
12
lib/main.rb
|
@ -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
|
||||
|
|
Reference in a new issue