@@ -8,6 +8,8 @@ static void completion(const char *buf, linenoiseCompletions *lc) {
8
8
if (buf[0 ] == ' h' ) {
9
9
linenoiseAddCompletion (lc," hello" );
10
10
linenoiseAddCompletion (lc," hello there" );
11
+ linenoiseAddCompletion (lc," hello 😀" );
12
+ linenoiseAddCompletion (lc," こんにちは" );
11
13
}
12
14
}
13
15
@@ -17,6 +19,11 @@ static const char *hints(const char *buf, int *color, int *bold) {
17
19
*bold = 0 ;
18
20
return " World" ;
19
21
}
22
+ if (!strcasecmp (buf," こんにちは" )) {
23
+ *color = 35 ;
24
+ *bold = 0 ;
25
+ return " 世界" ;
26
+ }
20
27
return NULL ;
21
28
}
22
29
@@ -61,7 +68,7 @@ int main(int argc, char **argv) {
61
68
62
69
while (1 ) {
63
70
if (!async) {
64
- line = linenoise (" hello > " );
71
+ line = linenoise (" 😀 \033 [32mhello \x1b [0m > " );
65
72
if (line == NULL ) break ;
66
73
} else {
67
74
/* Asynchronous mode using the multiplexing API: wait for
@@ -116,7 +123,7 @@ int main(int argc, char **argv) {
116
123
} else if (!strncmp (line, " /unmask" , 7 )) {
117
124
linenoiseMaskModeDisable ();
118
125
} else if (line[0 ] == ' /' ) {
119
- printf (" Unreconized command: %s\n " , line);
126
+ printf (" Unrecognized command: %s\n " , line);
120
127
}
121
128
free ((void *) line);
122
129
}
0 commit comments