Skip to contentSkip to conversation

client: Rewrite workaround for readline

PATCH Applied Tim Kourt 2 participants 2 messages Apr 8, 2020 – Apr 9, 2020

lore
Share & tools
lore

Tim Kourt

author
#0 lore raw

PATCH 1/1 client: Rewrite workaround for readline

Instead of calling display(""), explicitly use the sequence of commands to force readline to properly update its internal state and re-display the prompt.

---
 client/display.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
client/display.c +8 -1
index 4bcf51a2..cf74326d 100644
@@ -534,7 +534,14 @@ void display_enable_cmd_prompt(void)
 
 	rl_set_prompt(IWD_PROMPT);
 
-	display("");
+	/*
+	 * The following sequence of rl_* commands forces readline to properly
+	 * update its internal state and re-display the new prompt.
+	 */
+	rl_save_prompt();
+	rl_redisplay();
+	rl_restore_prompt();
+	rl_forced_update_display();
 }
 
 void display_disable_cmd_prompt(void)
Signature · 1 line
2.13.6
#1 lore raw

Hi Tim,

Quoted 7 lines · Tim Kourt

Instead of calling display(""), explicitly use the sequence of commands to force readline to properly update its internal state and re-display the prompt.

---
  client/display.c | 9 ++++++++-
  1 file changed, 8 insertions(+), 1 deletion(-)

Applied, thanks.

Regards,
-Denis