mirror of
https://github.com/janet-lang/janet
synced 2024-12-25 16:00:27 +00:00
Merge pull request #1471 from Darazaki/repl-ctrl-arrow
Add ctrl + left/right arrow support to the REPL
This commit is contained in:
commit
190056b863
@ -867,7 +867,7 @@ static int line() {
|
|||||||
if (write_console((char *) gbl_prompt, gbl_plen) == -1) return -1;
|
if (write_console((char *) gbl_prompt, gbl_plen) == -1) return -1;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
char c;
|
char c;
|
||||||
char seq[3];
|
char seq[5];
|
||||||
|
|
||||||
int rc;
|
int rc;
|
||||||
do {
|
do {
|
||||||
@ -991,6 +991,20 @@ static int line() {
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
} else if (seq[2] == ';') {
|
||||||
|
if (read_console(seq + 3, 2) == -1) break;
|
||||||
|
if (seq[3] == '5') {
|
||||||
|
switch (seq[4]) {
|
||||||
|
case 'C': /* ctrl-right */
|
||||||
|
krightw();
|
||||||
|
break;
|
||||||
|
case 'D': /* ctrl-left */
|
||||||
|
kleftw();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (seq[0] == 'O') {
|
} else if (seq[0] == 'O') {
|
||||||
if (read_console(seq + 1, 1) == -1) break;
|
if (read_console(seq + 1, 1) == -1) break;
|
||||||
|
Loading…
Reference in New Issue
Block a user