Skip to content

Commit

Permalink
Menu select add arrow button support (#963)
Browse files Browse the repository at this point in the history
* menu select add arrows

* Update src/nimblepkg/cli.nim

* Update src/nimblepkg/cli.nim

Co-authored-by: Jaremy J. Creechley <jaremy.creechley@panthalassa.com>
Co-authored-by: Dominik Picheta <dominikpicheta@googlemail.com>
  • Loading branch information
3 people authored Dec 4, 2021
1 parent 0777f33 commit 1339046
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/nimblepkg/cli.nim
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,16 @@ proc promptListInteractive(question: string, args: openarray[string]): string =
of '\3':
showCursor(stdout)
raise nimbleError("Keyboard interrupt")
of '\27':
if getch() != '\91': continue
case getch():
of char(65): # Up arrow
current = (args.len + current - 1) mod args.len
break
of char(66): # Down arrow
current = (current + 1) mod args.len
break
else: discard
else: discard

# Erase all lines of the selection
Expand Down

0 comments on commit 1339046

Please sign in to comment.