Implement delete
This commit is contained in:
parent
638fe037d2
commit
c211b59660
1 changed files with 7 additions and 0 deletions
|
@ -91,6 +91,8 @@ private
|
||||||
@search.end
|
@search.end
|
||||||
when Curses::Key::BACKSPACE
|
when Curses::Key::BACKSPACE
|
||||||
@search.backspace
|
@search.backspace
|
||||||
|
when Curses::Key::DC
|
||||||
|
@search.delete
|
||||||
when Curses::Key::UP
|
when Curses::Key::UP
|
||||||
@list.up
|
@list.up
|
||||||
when Curses::Key::DOWN
|
when Curses::Key::DOWN
|
||||||
|
@ -173,6 +175,11 @@ class Search
|
||||||
update
|
update
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def delete
|
||||||
|
return if cursor_pos > text.length
|
||||||
|
@text = "#{text[0...cursor_pos]}#{text[(cursor_pos + 1)..-1]}"
|
||||||
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
if @cursor_pos.negative?
|
if @cursor_pos.negative?
|
||||||
@cursor_pos = 0
|
@cursor_pos = 0
|
||||||
|
|
Reference in a new issue