Modernize the tty/line prompt.

This commit is contained in:
2022-06-05 15:03:03 -04:00
parent 78a3b59499
commit 2a3af31e7a
3 changed files with 12 additions and 4 deletions

View File

@ -11,7 +11,7 @@ set host_color="ansi:12"
set user_color="ansi:14"
set at_color="${dim_cyan}"
set path_color="ansi:10"
set line_color="${dim_red}"
set line_color="ansi:1"
set prompt_color="reset"
set depth_color="${dim_yellow}"
@ -19,7 +19,6 @@ set color_start="%{"
set color_end="%}"
set at_color_seq="${color_start}${at_color}${color_end}"
set line_color_seq="${color_start}${line_color}${color_end}"
set depth_color_seq="${color_start}${depth_color}${color_end}"
###########################

View File

@ -125,7 +125,8 @@ endif
set depth_prompt="${depth_color_seq}(${shlvl})"
#we "convert" pts/$number entries to ttypK entries?
set line_prompt="${line_color_seq}`tty | sed -e 's;/dev/tty;;' -e 's;/dev/pts/;p/;' -e 's;/dev/;;' -e 's/not a tty/${unknown_tty}/'`"
set line_prompt="`tty | sed -e 's;/dev/tty;;' -e 's;/dev/pts/;p/;' -e 's;/dev/;;' -e 's/not a tty/${unknown_tty}/'`"
#set line_prompt="line"
set user_prompt="%n"
set host_prompt="${CSHENV_HOSTNAME}"
set path_prompt="%c02"

View File

@ -7,6 +7,14 @@ if( $?CSHENV_DEBUG ) then
endif
# Recompute cached sgr codes from any configuration updates
if( ! $?curr_line_color ) then
set curr_line_color=impossible
endif
if( "${curr_line_color}" != "${line_color}" ) then
set curr_line_color="${line_color}"
set line_color_seq="%{[`__build_sgr_code no-csi reset ${curr_line_color}`m%}"
endif
if( ! $?curr_path_color ) then
set curr_path_color=impossible
endif
@ -232,7 +240,7 @@ if( ! $?CSHENV_DISABLE_PROMPT_SIGIL ) then
set prompt_reference_view="${prompt_reference}"
endif
if( ! $?CSHENV_DISABLE_PROMPT_TTY ) then
set line_prompt_view="${line_prompt}"
set line_prompt_view="${line_color_seq}${line_prompt}"
set line_spacer_view="%{${text_color_seq}%}\- "
endif
if( ! $?CSHENV_DISABLE_PROMPT_NESTING ) then