-
Using lp_terminal_format obviously works when building up the prompt within a theme. Now, I would want to use it, but out in a function called by the user. However, when I do that and print the returned string, I get escape codes, e.g.: Is there a way to use Minimal working example_lp_escaped_theme_activate() {
_lp_default_theme_activate
}
_lp_escaped_theme_directory() {
_lp_default_theme_directory
}
_lp_escaped_theme_prompt() {
lp_terminal_format 0 196 1
PS1="${lp_terminal_format}>${NO_COL}"
}
user_function() {
local n=$'\n'
lp_terminal_format 0 196 1
printf '%s' "${lp_terminal_format} example ${NO_COL}${n}"
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You could manually remove the escape codes: user_function() {
local lp_terminal_format string
lp_terminal_format 0 196 1
string="${lp_terminal_format} example ${NO_COL}"
string="${string//"$_LP_OPEN_ESC"}"
string="${string//"$_LP_CLOSE_ESC"}"
printf '%s\n' "$string"
} It uses private Liquid Prompt variables, so it could break at some point. If this is something others might want to do, we could probably come up with a way to support this. |
Beta Was this translation helpful? Give feedback.
You could manually remove the escape codes:
It uses private Liquid Prompt variables, so it could break at some point. If this is something others might want to do, we could probably come up with a way to support this.