From 50938f3797c822c515ff9454184b8ed7a6ce0124 Mon Sep 17 00:00:00 2001 From: Liumeo Date: Sun, 23 Jan 2022 20:50:08 -0500 Subject: [PATCH] FIX REPL tab at beginning of line should indent not complete (#2125) --- docs/project/changelog.md | 3 +++ src/templates/console.html | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/docs/project/changelog.md b/docs/project/changelog.md index 3956dddf2..225779756 100644 --- a/docs/project/changelog.md +++ b/docs/project/changelog.md @@ -36,6 +36,9 @@ substitutions: improved with some context information. {pr}`2121` +- {{Enhancement}} Pressing TAB in REPL no longer triggers completion when input + is whitespace. {pr}`2125` + ## Version 0.19.0 _January 10, 2021_ diff --git a/src/templates/console.html b/src/templates/console.html index c5c3ef029..3fc16ee38 100644 --- a/src/templates/console.html +++ b/src/templates/console.html @@ -133,6 +133,15 @@ term.set_command(""); term.set_prompt(ps1); }, + "TAB": (event, original) => { + const command = term.before_cursor(); + // Disable completion for whitespaces. + if (command.trim() === "") { + term.insert("\t"); + return false; + } + return original(event); + } }, }); window.term = term;