summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsigmaSd <bedisnbiba@gmail.com>2022-06-22 15:28:28 +0100
committerGitHub <noreply@github.com>2022-06-22 10:28:28 -0400
commitefaa1498197b1f63ad41f47f8ee4730724fc67a5 (patch)
treef5507e5da6453ebbab2c1042ac2680d1e5764e8c
parent3455f16079c2ca676e092d2123b8895e68e1a3ee (diff)
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.
-rw-r--r--cli/tools/repl/editor.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/cli/tools/repl/editor.rs b/cli/tools/repl/editor.rs
index e518a8735..1024ef201 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
}