xC: fix newer Readline, allow stdin streaming
Also update NEWS.
This commit is contained in:
parent
b3684c4d9f
commit
509cb9f4dd
8
NEWS
8
NEWS
@ -1,7 +1,15 @@
|
|||||||
Unreleased
|
Unreleased
|
||||||
|
|
||||||
|
* xC: fixed keyboard EOF behaviour with Readline >= 8.0
|
||||||
|
|
||||||
|
* xC: made it possible to stream commands into the binary
|
||||||
|
|
||||||
|
* xM/xW: various bugfixes
|
||||||
|
|
||||||
* Added a Fyne frontend for xC called xA
|
* Added a Fyne frontend for xC called xA
|
||||||
|
|
||||||
|
* Added a Qt Widgets frontend for xC called xT
|
||||||
|
|
||||||
|
|
||||||
2.0.0 (2024-07-28) "Perfect Is the Enemy of Good"
|
2.0.0 (2024-07-28) "Perfect Is the Enemy of Good"
|
||||||
|
|
||||||
|
12
xC.c
12
xC.c
@ -474,6 +474,10 @@ input_rl_start (void *input, const char *program_name)
|
|||||||
// autofilter, and we don't generally want alphabetic ordering at all
|
// autofilter, and we don't generally want alphabetic ordering at all
|
||||||
rl_sort_completion_matches = false;
|
rl_sort_completion_matches = false;
|
||||||
|
|
||||||
|
// Readline >= 8.0 otherwise prints spurious newlines on EOF.
|
||||||
|
if (RL_VERSION_MAJOR >= 8)
|
||||||
|
rl_variable_bind ("enable-bracketed-paste", "off");
|
||||||
|
|
||||||
hard_assert (self->prompt != NULL);
|
hard_assert (self->prompt != NULL);
|
||||||
// The inputrc is read before any callbacks are called, so we need to
|
// The inputrc is read before any callbacks are called, so we need to
|
||||||
// register all functions that our user may want to map up front
|
// register all functions that our user may want to map up front
|
||||||
@ -14603,21 +14607,23 @@ on_readline_input (char *line)
|
|||||||
if (*line)
|
if (*line)
|
||||||
add_history (line);
|
add_history (line);
|
||||||
|
|
||||||
// readline always erases the input line after returning from here,
|
// Readline always erases the input line after returning from here,
|
||||||
// but we don't want that to happen if the command to be executed
|
// but we don't want that to happen if the command to be executed
|
||||||
// would switch the buffer (we'd keep the already executed command in
|
// would switch the buffer (we'd keep the already executed command in
|
||||||
// the old buffer and delete any input restored from the new buffer)
|
// the old buffer and delete any input restored from the new buffer)
|
||||||
strv_append_owned (&ctx->pending_input, line);
|
strv_append_owned (&ctx->pending_input, line);
|
||||||
poller_idle_set (&ctx->input_event);
|
poller_idle_set (&ctx->input_event);
|
||||||
}
|
}
|
||||||
else
|
else if (isatty (STDIN_FILENO))
|
||||||
{
|
{
|
||||||
// Prevent readline from showing the prompt twice for w/e reason
|
// Prevent Readline from showing the prompt twice for w/e reason
|
||||||
CALL (ctx->input, hide);
|
CALL (ctx->input, hide);
|
||||||
input_rl__restore (self);
|
input_rl__restore (self);
|
||||||
|
|
||||||
CALL (ctx->input, ding);
|
CALL (ctx->input, ding);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
request_quit (ctx, NULL);
|
||||||
|
|
||||||
if (self->active)
|
if (self->active)
|
||||||
// Readline automatically redisplays it
|
// Readline automatically redisplays it
|
||||||
|
Loading…
Reference in New Issue
Block a user