Skip to content

Commit

Permalink
bug
Browse files Browse the repository at this point in the history
  • Loading branch information
min0911Y committed Dec 14, 2024
1 parent 0e3f405 commit ce024eb
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/plreadln.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,13 @@ static bool pl_readline_handle_history(_self, int n) {
}

void pl_readline_insert_char_and_view(_self, char ch) {
if (self->length >= self->maxlen) {
self->maxlen *= 2;
self->buffer = realloc(self->buffer, self->maxlen);
self->input_buf = realloc(self->input_buf, self->maxlen);
if (!self->buffer)
abort(); // 炸了算了
}
pl_readline_insert_char(self->buffer, ch, self->ptr++);
self->length++;
int n = self->length - self->ptr;
Expand Down

0 comments on commit ce024eb

Please sign in to comment.