Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ static void completion(const char *buf, linenoiseCompletions *lc) {
if (buf[0] == 'h') {
linenoiseAddCompletion(lc,"hello");
linenoiseAddCompletion(lc,"hello there");
linenoiseAddCompletion(lc,"hello 😀");
linenoiseAddCompletion(lc,"こんにちは");
}
}

Expand All @@ -17,6 +19,11 @@ static const char *hints(const char *buf, int *color, int *bold) {
*bold = 0;
return " World";
}
if (!strcasecmp(buf,"こんにちは")) {
*color = 35;
*bold = 0;
return " 世界";
}
return NULL;
}

Expand Down Expand Up @@ -61,7 +68,7 @@ int main(int argc, char **argv) {

while(1) {
if (!async) {
line = linenoise("hello> ");
line = linenoise("😀 \033[32mhello\x1b[0m> ");
if (line == NULL) break;
} else {
/* Asynchronous mode using the multiplexing API: wait for
Expand Down Expand Up @@ -116,7 +123,7 @@ int main(int argc, char **argv) {
} else if (!strncmp(line, "/unmask", 7)) {
linenoiseMaskModeDisable();
} else if (line[0] == '/') {
printf("Unreconized command: %s\n", line);
printf("Unrecognized command: %s\n", line);
}
free((void*) line);
}
Expand Down
Loading
Loading