mirror of
https://github.com/janet-lang/janet
synced 2024-11-28 11:09:54 +00:00
Add support for delete key in repl
This commit is contained in:
parent
bcd2089f71
commit
40e6616df0
3
.gitignore
vendored
3
.gitignore
vendored
@ -13,6 +13,9 @@ janet
|
|||||||
janet-*.tar.gz
|
janet-*.tar.gz
|
||||||
dist
|
dist
|
||||||
|
|
||||||
|
# Kakoune (fzf via fd)
|
||||||
|
.fdignore
|
||||||
|
|
||||||
# VSCode
|
# VSCode
|
||||||
.vscode
|
.vscode
|
||||||
|
|
||||||
|
@ -314,6 +314,14 @@ static void kbackspace() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void kdelete() {
|
||||||
|
if (gbl_pos != gbl_len) {
|
||||||
|
memmove(gbl_buf + gbl_pos, gbl_buf + gbl_pos + 1, gbl_len - gbl_pos);
|
||||||
|
gbl_buf[--gbl_len] = '\0';
|
||||||
|
refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int line() {
|
static int line() {
|
||||||
gbl_cols = getcols();
|
gbl_cols = getcols();
|
||||||
gbl_plen = 0;
|
gbl_plen = 0;
|
||||||
@ -386,6 +394,9 @@ static int line() {
|
|||||||
if (read(STDIN_FILENO, seq + 2, 1) == -1) break;
|
if (read(STDIN_FILENO, seq + 2, 1) == -1) break;
|
||||||
if (seq[2] == '~') {
|
if (seq[2] == '~') {
|
||||||
switch (seq[1]) {
|
switch (seq[1]) {
|
||||||
|
case '3': /* delete */
|
||||||
|
kdelete();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user