Rename Scan codes -> Key codes. What we print in debug mode using the option (now) called --keycodes are not the scan codes, but the key codes returned by the terminal (a more higher level representation of the keys pressed). This commit fixes the word used.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
diff --git a/example.c b/example.c
index 90030ad..a2f0936 100644
--- a/example.c
+++ b/example.c
@@ -22,11 +22,11 @@ int main(int argc, char **argv) {
if (!strcmp(*argv,"--multiline")) {
linenoiseSetMultiLine(1);
printf("Multi-line mode enabled.\n");
- } else if (!strcmp(*argv,"--scancodes")) {
- linenoisePrintScanCodes();
+ } else if (!strcmp(*argv,"--keycodes")) {
+ linenoisePrintKeyCodes();
exit(0);
} else {
- fprintf(stderr, "Usage: %s [--multiline] [--scancodes]\n", prgname);
+ fprintf(stderr, "Usage: %s [--multiline] [--keycodes]\n", prgname);
exit(1);
}
}
diff --git a/linenoise.c b/linenoise.c
index 1dc2303..c9a91bd 100644
--- a/linenoise.c
+++ b/linenoise.c
@@ -796,11 +796,11 @@ static int linenoiseEdit(int stdin_fd, int stdout_fd, char *buf, size_t buflen,
/* This special mode is used by linenoise in order to print scan codes
* on screen for debugging / development purposes. It is implemented
- * by the linenoise_example program using the --scancodes option. */
-void linenoisePrintScanCodes(void) {
+ * by the linenoise_example program using the --keycodes option. */
+void linenoisePrintKeyCodes(void) {
char quit[4];
- printf("Linenoise scan codes debugging mode.\n"
+ printf("Linenoise key codes debugging mode.\n"
"Press keys to see scan codes. Type 'quit' at any time to exit.\n");
if (enableRawMode(STDIN_FILENO) == -1) return;
memset(quit,' ',4);
diff --git a/linenoise.h b/linenoise.h
index b767774..e22ebd3 100644
--- a/linenoise.h
+++ b/linenoise.h
@@ -57,7 +57,7 @@ int linenoiseHistorySave(const char *filename);
int linenoiseHistoryLoad(const char *filename);
void linenoiseClearScreen(void);
void linenoiseSetMultiLine(int ml);
-void linenoisePrintScanCodes(void);
+void linenoisePrintKeyCodes(void);
#ifdef __cplusplus
}