From b15a51d3f2be594f648baf62aeda0c442cdd1784 Mon Sep 17 00:00:00 2001 From: Kévin Le Gouguec Date: Sat, 4 Oct 2025 17:52:34 +0200 Subject: "Namespace" PS1 functions for less-than-dumb terminals --- .bash_prompt | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.bash_prompt b/.bash_prompt index 2ac3151..0d7f46b 100644 --- a/.bash_prompt +++ b/.bash_prompt @@ -118,15 +118,6 @@ __fontify () __end-nonprinting } -__set-prompt () -{ - BUILDING_PS=t - - PS1="$(__write-context)\n$(__fontify '\$' dim) " - - unset BUILDING_PS -} - __current-column () { # Cf. console_codes(4) § ECMA-48 Status Report Commands @@ -185,7 +176,16 @@ __write-context () fi } -__refresh-terminal () +__smart-term/set-ps1 () +{ + BUILDING_PS=t + + PS1="$(__write-context)\n$(__fontify '\$' dim) " + + unset BUILDING_PS +} + +__smart-term/refresh () { local last_status=$? @@ -204,10 +204,10 @@ __refresh-terminal () __draw-rule dim fi - __set-prompt + __smart-term/set-ps1 } -__init-smart () +__smart-term/init () { ### Prompts. @@ -220,7 +220,7 @@ __init-smart () PS1_SHOWGITSTATUS=t fi - PROMPT_COMMAND=__refresh-terminal + PROMPT_COMMAND=__smart-term/refresh PS2=$( BUILDING_PS=t @@ -244,5 +244,5 @@ then PS1='$? \u:\w\$ ' PS2='> ' else - __init-smart + __smart-term/init fi -- cgit v1.2.3