diff --git a/lib/main.rb b/lib/main.rb index a6de3f9..d885906 100644 --- a/lib/main.rb +++ b/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