Skip to content

Commit

Permalink
Ignore special chars on color prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
albfan committed Nov 20, 2022
1 parent 31f7fbb commit 439dac0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/ctl/ctl-cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -692,12 +692,11 @@ int cli_init(sd_bus *bus, const struct cli_cmd *cmds)

rl_erase_empty_line = 1;
rl_attempted_completion_function = completion_fn;
rl_callback_handler_install(NULL, cli_handler_fn);
rl_callback_handler_install(get_cli_prompt(), cli_handler_fn);
using_history();
read_history(get_history_filename());
rl_end_of_history(0, 0);

rl_set_prompt(get_cli_prompt());
printf("\r");
rl_on_new_line();
rl_redisplay();
Expand Down
2 changes: 1 addition & 1 deletion src/ctl/sinkctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

#define HISTORY_FILENAME ".miracle-sink.history"

#define CLI_PROMPT CLI_BLUE "[sinkctl] # " CLI_DEFAULT
#define CLI_PROMPT "\001" CLI_BLUE "\002" "[sinkctl] # " "\001" CLI_DEFAULT "\002"

static sd_bus *bus;
static struct ctl_wifi *wifi;
Expand Down
2 changes: 1 addition & 1 deletion src/ctl/wifictl.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

#define HISTORY_FILENAME ".miracle-wifi.history"

#define CLI_PROMPT CLI_BLUE "[wifictl] # " CLI_DEFAULT
#define CLI_PROMPT "\001" CLI_BLUE "\002" "[wifictl] # " "\001" CLI_DEFAULT "\002"

static sd_bus *bus;
static struct ctl_wifi *wifi;
Expand Down

0 comments on commit 439dac0

Please sign in to comment.