mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
Fix rendering issues with bash shell integration (#301)
* shell-integration/bash: we need to wrap escape sequences in brackets * nix: install bashInteractive on Linux
This commit is contained in:

committed by
GitHub

parent
9d61212451
commit
0bdd73797e
@ -1,5 +1,6 @@
|
||||
{ mkShell, lib, stdenv
|
||||
|
||||
, bashInteractive
|
||||
, debugedit
|
||||
, flatpak-builder
|
||||
, gdb
|
||||
@ -85,6 +86,10 @@ in mkShell rec {
|
||||
wabt
|
||||
wasmtime
|
||||
] ++ lib.optionals stdenv.isLinux [
|
||||
# My nix shell environment installs the non-interactive version
|
||||
# by default so we have to include this.
|
||||
bashInteractive
|
||||
|
||||
# Flatpak builds
|
||||
debugedit
|
||||
flatpak-builder
|
||||
|
@ -32,23 +32,24 @@ function __ghostty_get_current_command() {
|
||||
function __ghostty_precmd() {
|
||||
local ret="$?"
|
||||
if test "$_ghostty_executing" != "0"; then
|
||||
_GHOSTTY_SAVE_PS0="$PS0"
|
||||
_GHOSTTY_SAVE_PS1="$PS1"
|
||||
_GHOSTTY_SAVE_PS2="$PS2"
|
||||
|
||||
# Marks
|
||||
PS1=$PS1'\e]133;B\a'
|
||||
PS2=$PS2'\e]133;B\a'
|
||||
PS1=$PS1'\[\e]133;B\a\]'
|
||||
PS2=$PS2'\[\e]133;B\a\]'
|
||||
|
||||
# Cursor
|
||||
PS1=$PS1'\e[5 q'
|
||||
PS0=$PS0'\e[0 q'
|
||||
PS1=$PS1'\[\e[5 q\]'
|
||||
PS0=$PS0'\[\e[0 q\]'
|
||||
|
||||
# Command
|
||||
PS0=$PS0'$(__ghostty_get_current_command)'
|
||||
PS1=$PS1'\e]2;$PWD\a'
|
||||
PS1=$PS1'\[\e]2;$PWD\a\]'
|
||||
fi
|
||||
|
||||
if test "$_ghostty_executing" != ""; then
|
||||
if test "$_ghostty_executing" != "0"; then
|
||||
builtin printf "\033]133;D;%s;aid=%s\007" "$ret" "$BASHPID"
|
||||
fi
|
||||
|
||||
@ -65,6 +66,7 @@ function __ghostty_precmd() {
|
||||
}
|
||||
|
||||
function __ghostty_preexec() {
|
||||
PS0="$_GHOSTTY_SAVE_PS0"
|
||||
PS1="$_GHOSTTY_SAVE_PS1"
|
||||
PS2="$_GHOSTTY_SAVE_PS2"
|
||||
builtin printf "\033]133;C;\007"
|
||||
|
Reference in New Issue
Block a user