Commit f698ec47d18c149cdf1293456f43fa49cb66f414

antirez 2014-03-13T10:08:39

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.

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
 }