From efaa1498197b1f63ad41f47f8ee4730724fc67a5 Mon Sep 17 00:00:00 2001 From: sigmaSd Date: Wed, 22 Jun 2022 15:28:28 +0100 Subject: [PATCH] fix(repl): use spaces for tab handler on windows (#14931) There is a bug in rustyline with tabs on Windows, so we insert spaces for now. --- cli/tools/repl/editor.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cli/tools/repl/editor.rs b/cli/tools/repl/editor.rs index e518a8735a..1024ef2013 100644 --- a/cli/tools/repl/editor.rs +++ b/cli/tools/repl/editor.rs @@ -423,7 +423,13 @@ impl ConditionalEventHandler for TabEventHandler { .filter(|c| c.is_whitespace()) .is_some() { - Some(Cmd::Insert(n, "\t".into())) + if cfg!(target_os = "windows") { + // Inserting a tab is broken in windows with rustyline + // use 4 spaces as a workaround for now + Some(Cmd::Insert(n, " ".into())) + } else { + Some(Cmd::Insert(n, "\t".into())) + } } else { None // default complete }