>From d783e435aed016674b806d9a12eb8329a5fdb19c Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 2 Feb 2022 11:06:37 +0100 Subject: [PATCH 1/2] make .editor use pk_prompt() from pk-repl in order to show correct prompt after using .editor --- poke/pk-cmd-editor.c | 5 ++++- poke/pk-repl.c | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/poke/pk-cmd-editor.c b/poke/pk-cmd-editor.c index d477e256..f98a7071 100644 --- a/poke/pk-cmd-editor.c +++ b/poke/pk-cmd-editor.c @@ -29,6 +29,7 @@ #include "poke.h" #include "pk-cmd.h" #include "pk-utils.h" +#include "pk-repl.h" #ifndef PATH_MAX /* GNU/Hurd */ # define PATH_MAX (64 * 1024) @@ -122,7 +123,9 @@ pk_cmd_editor (int argc, struct pk_cmd_arg argv[], uint64_t uflags) if (*newline != '\0') { - pk_puts ("(poke) "); + char *prompt = pk_prompt(); + pk_puts (prompt); + free(prompt); pk_puts (newline); pk_puts ("\n"); pk_cmd_exec (newline); diff --git a/poke/pk-repl.c b/poke/pk-repl.c index 50c06095..4830d18b 100644 --- a/poke/pk-repl.c +++ b/poke/pk-repl.c @@ -274,7 +274,7 @@ escape_metacharacters (char *text, int match_type, char *qp) return s; } -static char * +char * pk_prompt (void) { char *prompt = ""; -- 2.30.2