summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-05-05 22:35:51 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2015-05-05 22:35:51 +0200
commit99526126e48459d44402b4028ee8ac9513ee0ebb (patch)
treec4208cc268350ae7ae47f921586ae395bf96dbcc
parente542aa5accdc6559b7b8ae6005f5322492676e08 (diff)
downloadxK-99526126e48459d44402b4028ee8ac9513ee0ebb.tar.gz
xK-99526126e48459d44402b4028ee8ac9513ee0ebb.tar.xz
xK-99526126e48459d44402b4028ee8ac9513ee0ebb.zip
degesch: fix libedit initialization
-rw-r--r--degesch.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/degesch.c b/degesch.c
index d689a0c..3742baa 100644
--- a/degesch.c
+++ b/degesch.c
@@ -453,6 +453,8 @@ input_make_prompt (EditLine *editline)
{
struct input *self;
el_get (editline, EL_CLIENTDATA, &self);
+ if (!self->prompt)
+ return "";
return self->prompt;
}
@@ -565,13 +567,15 @@ input_destroy_buffer (struct input *self, struct input_buffer *buffer)
static void
input_save (struct input *self)
{
- input_save_buffer (self, self->current);
+ if (self->current)
+ input_save_buffer (self, self->current);
}
static void
input_restore (struct input *self)
{
- input_restore_buffer (self, self->current);
+ if (self->current)
+ input_restore_buffer (self, self->current);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -2789,7 +2793,7 @@ static void
make_prompt (struct app_context *ctx, struct str *output)
{
struct buffer *buffer = ctx->current_buffer;
- if (!soft_assert (buffer))
+ if (!buffer)
return;
str_append_c (output, '[');
@@ -5492,10 +5496,9 @@ main (int argc, char *argv[])
init_colors (&ctx);
init_poller_events (&ctx);
init_buffers (&ctx);
- buffer_activate (&ctx, ctx.server.buffer);
- refresh_prompt (&ctx);
input_start (&ctx.input, argv[0]);
+ buffer_activate (&ctx, ctx.server.buffer);
// Connect to the server ASAP
poller_timer_set (&ctx.server.reconnect_tmr, 0);