Skip to content

Commit 1339046

Browse files
elcritchJaremy J. Creechleydom96
authored
Menu select add arrow button support (#963)
* menu select add arrows * Update src/nimblepkg/cli.nim * Update src/nimblepkg/cli.nim Co-authored-by: Jaremy J. Creechley <[email protected]> Co-authored-by: Dominik Picheta <[email protected]>
1 parent 0777f33 commit 1339046

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/nimblepkg/cli.nim

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,16 @@ proc promptListInteractive(question: string, args: openarray[string]): string =
257257
of '\3':
258258
showCursor(stdout)
259259
raise nimbleError("Keyboard interrupt")
260+
of '\27':
261+
if getch() != '\91': continue
262+
case getch():
263+
of char(65): # Up arrow
264+
current = (args.len + current - 1) mod args.len
265+
break
266+
of char(66): # Down arrow
267+
current = (current + 1) mod args.len
268+
break
269+
else: discard
260270
else: discard
261271

262272
# Erase all lines of the selection

0 commit comments

Comments
 (0)