1
0
mirror of https://github.com/janet-lang/janet synced 2025-12-11 19:18:07 +00:00

Merge pull request #1678 from tw4452852/push-swmvxuxkrvsx

shell: Prevent buggy moving zero column behavior
This commit is contained in:
Calvin Rose
2025-12-07 08:02:32 -06:00
committed by GitHub

View File

@@ -379,10 +379,12 @@ static void refresh(void) {
janet_buffer_push_cstring(&b, gbl_prompt);
janet_buffer_push_bytes(&b, (uint8_t *) _buf, _len);
/* Erase to right */
janet_buffer_push_cstring(&b, "\x1b[0K");
janet_buffer_push_cstring(&b, "\x1b[0K\r");
/* Move cursor to original position. */
snprintf(seq, 64, "\r\x1b[%dC", (int)(_pos + gbl_plen));
janet_buffer_push_cstring(&b, seq);
if (_pos + gbl_plen) {
snprintf(seq, 64, "\x1b[%dC", (int)(_pos + gbl_plen));
janet_buffer_push_cstring(&b, seq);
}
if (write_console((char *) b.data, b.count) == -1) {
exit(1);
}