From 92595329e8299eb97150f6525a6dba861a4eb03b Mon Sep 17 00:00:00 2001 From: "Dr. K. D. Murray" <1560490+kdm9@users.noreply.github.com> Date: Wed, 25 May 2022 04:17:36 +1000 Subject: [PATCH] Fixes for modern readline Should address issues described in #117 et al. Additionally, I've added code to set the TERM_PROGRAM and TERM_PROGRAM_VERSION env vars so others can set variables accordingly. This *might* not be ideal, as perhaps bashrc has executed before these are set. Please advise if that's the case. --- bash_kernel/kernel.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bash_kernel/kernel.py b/bash_kernel/kernel.py index ad65c52..70f8654 100644 --- a/bash_kernel/kernel.py +++ b/bash_kernel/kernel.py @@ -107,6 +107,10 @@ def _start_bash(self): # Register Bash function to write image data to temporary file self.bashwrapper.run_command(image_setup_cmd) + # Set TERM_PROGRAM and TERM_PROGAM_VERSION. See https://github.com/takluyver/bash_kernel/issues/117#issuecomment-1032738154 + self.bashwrapper.run_command(f"export TERM_PROGRAM='jupyter_bash_kernel'; export TERM_PROGRAM_VERSION='{__version__}';") + # Disable bracketed paste (see https://github.com/takluyver/bash_kernel/issues/117) + self.bashwrapper.run_command("(bind 'set enable-bracketed-paste off' || true) >/dev/null 2>&1") def process_output(self, output): if not self.silent: