lib/ppcurses/actions/GetEnumeratedStringAction.rb in ppcurses-0.0.25 vs lib/ppcurses/actions/GetEnumeratedStringAction.rb in ppcurses-0.1.0

- old
+ new

@@ -35,23 +35,23 @@ def execute print_prompt # Enables reading arrow keys in getch @win.keypad(true) while 1 - noecho + Curses.noecho c = @win.getch - if c == KEY_LEFT then @current_option = @current_option-1 end - if c == KEY_RIGHT then @current_option = @current_option+1 end - if c == 10 then break end + if c == Curses::KEY_LEFT then @current_option = @current_option-1 end + if c == Curses::KEY_RIGHT then @current_option = @current_option+1 end + if c == ESCAPE then break end if @current_option < 0 then @current_option = @options.length-1 end if @current_option > @options.length-1 then @current_option = 0 end - echo + Curses.echo print_prompt end - echo + Curses.echo # Go to next line so that further actions to overwrite # the choice @win.setpos(@win.cury + 1, x_padding) end