Skip to content

Commit

Permalink
fix(repl): use spaces for tab handler on windows (#14931)
Browse files Browse the repository at this point in the history
There is a bug in rustyline with tabs on Windows, so we insert spaces for now.
  • Loading branch information
sigmaSd committed Jun 22, 2022
1 parent 3455f16 commit efaa149
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cli/tools/repl/editor.rs
Expand Up @@ -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
}
Expand Down

0 comments on commit efaa149

Please sign in to comment.