From 43c1657a2037040de565b4ca388f6fcb71576c2b Mon Sep 17 00:00:00 2001 From: Miro <200482516+Mirochill@users.noreply.github.com> Date: Mon, 25 May 2026 20:42:01 +0200 Subject: [PATCH] Fix invalid escape sequences --- bash_kernel/display.py | 2 +- bash_kernel/kernel.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bash_kernel/display.py b/bash_kernel/display.py index 24f357b..44baa42 100644 --- a/bash_kernel/display.py +++ b/bash_kernel/display.py @@ -8,7 +8,7 @@ $ cat dog.png | display $ echo "Dog, not a cat." | displayHTML -$ echo "alert('It is known khaleesi\!');" | displayJS +$ echo "alert('It is known khaleesi\\!');" | displayJS ### Updating rich content cells diff --git a/bash_kernel/kernel.py b/bash_kernel/kernel.py index 3b9cf44..d0ed69d 100644 --- a/bash_kernel/kernel.py +++ b/bash_kernel/kernel.py @@ -127,11 +127,11 @@ def _start_bash(self): # replwrap seeing that as the next prompt, we'll embed the marker characters # for invisible characters in the prompt; these show up when inspecting the # environment variable, but not when bash displays the prompt. - ps1 = self.unique_prompt + u'\[\]' + ">" - ps2 = self.unique_prompt + u'\[\]' + "+" + ps1 = self.unique_prompt + u'\\[\\]' + ">" + ps2 = self.unique_prompt + u'\\[\\]' + "+" prompt_change = u"PS1='{0}' PS2='{1}' PROMPT_COMMAND=''".format(ps1, ps2) # Using IREPLWrapper to get incremental output - self.bashwrapper = IREPLWrapper(child, u'\$', prompt_change, self.unique_prompt, + self.bashwrapper = IREPLWrapper(child, u'\\$', prompt_change, self.unique_prompt, extra_init_cmd="export PAGER=cat", line_output_callback=self.process_output) finally: