-
Notifications
You must be signed in to change notification settings - Fork 336
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #145 from bdwyertech/bdwyertech
Use the same keycodes cross-platform
- Loading branch information
Showing
3 changed files
with
12 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// +build !windows | ||
|
||
package promptui | ||
|
||
import "github.com/chzyer/readline" | ||
|
||
var ( | ||
// KeyBackspace is the default key for deleting input text. | ||
KeyBackspace rune = readline.CharBackspace | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,10 @@ | ||
// +build windows | ||
|
||
package promptui | ||
|
||
// source: https://msdn.microsoft.com/en-us/library/aa243025(v=vs.60).aspx | ||
|
||
var ( | ||
// KeyEnter is the default key for submission/selection inside a command line prompt. | ||
KeyEnter rune = 13 | ||
|
||
// KeyBackspace is the default key for deleting input text inside a command line prompt. | ||
KeyBackspace rune = 8 | ||
|
||
// FIXME: keys below are not triggered by readline, not working on Windows | ||
|
||
// KeyPrev is the default key to go up during selection inside a command line prompt. | ||
KeyPrev rune = 38 | ||
KeyPrevDisplay = "k" | ||
|
||
// KeyNext is the default key to go down during selection inside a command line prompt. | ||
KeyNext rune = 40 | ||
KeyNextDisplay = "j" | ||
|
||
// KeyBackward is the default key to page up during selection inside a command line prompt. | ||
KeyBackward rune = 37 | ||
KeyBackwardDisplay = "h" | ||
|
||
// KeyForward is the default key to page down during selection inside a command line prompt. | ||
KeyForward rune = 39 | ||
KeyForwardDisplay = "l" | ||
) |