Compare commits

...

5 Commits

Author SHA1 Message Date
e49ff84b74
Strip trailing newlines from editor output 2020-09-01 19:26:37 +02:00
b7c9bfd9f5
Fix libedit crash
Again, I have no idea why it started to happen, it just occured
to me to try to change the call, and it turns out out it works.
2020-09-01 19:02:41 +02:00
f6165164ee
Fix prompt attributes under libedit
I can only guess why this works, and I'm not sure I want to /know/.
2020-09-01 19:02:41 +02:00
3a445c2db2
Name change 2020-09-01 19:02:41 +02:00
45d023147a
Bump liberty 2020-09-01 19:02:40 +02:00
5 changed files with 19 additions and 11 deletions

View File

@ -112,8 +112,8 @@ endforeach (page)
# CPack
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Shell for running JSON-RPC 2.0 queries")
set (CPACK_PACKAGE_VENDOR "Premysl Janouch")
set (CPACK_PACKAGE_CONTACT "Přemysl Janouch <p@janouch.name>")
set (CPACK_PACKAGE_VENDOR "Premysl Eric Janouch")
set (CPACK_PACKAGE_CONTACT "Přemysl Eric Janouch <p@janouch.name>")
set (CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
set (CPACK_PACKAGE_VERSION_MAJOR ${project_VERSION_MAJOR})
set (CPACK_PACKAGE_VERSION_MINOR ${project_VERSION_MINOR})

View File

@ -1,4 +1,4 @@
Copyright (c) 2014 - 2018, Přemysl Janouch <p@janouch.name>
Copyright (c) 2014 - 2018, Přemysl Eric Janouch <p@janouch.name>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

View File

@ -1,7 +1,7 @@
/*
* json-rpc-shell.c: simple JSON-RPC 2.0 shell
*
* Copyright (c) 2014 - 2016, Přemysl Janouch <p@janouch.name>
* Copyright (c) 2014 - 2016, Přemysl Eric Janouch <p@janouch.name>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted.
@ -531,7 +531,8 @@ input_el_redisplay (struct input_el *self)
el_push (self->editline, x);
// We have to do this or it gets stuck and nothing is done
(void) el_gets (self->editline, NULL);
int count = 0;
(void) el_wgets (self->editline, &count);
}
static char *
@ -3176,9 +3177,16 @@ process_edited_input (struct app_context *ctx)
print_error ("%s: %s", "input editing failed", e->message);
error_free (e);
}
else if (!ctx->input->vtable->replace_line (ctx->input, input.str))
print_error ("%s: %s", "input editing failed",
"could not re-insert modified text");
else
{
// Strip trailing newlines, added automatically by editors
while (input.len && strchr ("\r\n", input.str[input.len - 1]))
input.str[--input.len] = 0;
if (!ctx->input->vtable->replace_line (ctx->input, input.str))
print_error ("%s: %s", "input editing failed",
"could not re-insert modified text");
}
if (unlink (ctx->editor_filename))
print_error ("could not unlink `%s': %s",
@ -3460,7 +3468,7 @@ main (int argc, char *argv[])
{
// XXX: to be completely correct, we should use tputs, but we cannot
g_ctx.input->vtable->set_prompt (g_ctx.input,
xstrdup_printf ("%c%s%cjson-rpc> %c%s%c",
xstrdup_printf ("%c%s%cjson-rpc>%c%s%c ",
INPUT_START_IGNORE, g_ctx.attrs[ATTR_PROMPT],
INPUT_END_IGNORE,
INPUT_START_IGNORE, g_ctx.attrs[ATTR_RESET],

View File

@ -1,7 +1,7 @@
/*
* json-rpc-test-server.c: JSON-RPC 2.0 demo server
*
* Copyright (c) 2015 - 2018, Přemysl Janouch <p@janouch.name>
* Copyright (c) 2015 - 2018, Přemysl Eric Janouch <p@janouch.name>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted.

@ -1 +1 @@
Subproject commit bca7167d037d857448cb18243425d7c61de3bdd5
Subproject commit 1a76b2032e6d18d9f95d9d0bb98edc26023c8618