pureline
pureline copied to clipboard
let the user choose background color for newline module
Let the user too chose the background color for newline module. Useful if you have a module who fill the wall line like mine (see bellow)
I don't experience the issues with the background color as shown in your first screenshot. Is this caused by the changes made in PR https://github.com/chris-marsh/pureline/pull/11 ?
I think it is not related.
But before provide you a test case, see this bug not related with the test i will provide you just to be sure that is not my module who include it
env -i bash --noprofile --norc --login
bash-4.3$ cd /tmp/pureline/
bash-4.3$ git rev-parse HEAD
1e44b57a67e9a5ab1c81cfffd8e0d2c359eda807
bash-4.3$ git diff
WARNING: terminal is not fully functional
diff --git a/pureline b/pureline
index be03be1..70d2833 100644
--- a/pureline
+++ b/pureline
@@ -387,6 +387,7 @@ else
# define default modules to load
declare -a pureline_modules=(
'host_module Yellow Black false'
+ 'newline_module'
'path_module Blue Black 0'
'read_only_module Red White'
)
bash-4.3$ source pureline
Darknet
/tmp/pureline
-------------------------------- press ctrl+r -------------------------------------
bash-4.3$ source pureline
Darknet
(reverse-i-search)`clo': git clone https://github.com/chris-marsh/pureline /tmp/pureline
-------------------------------- press escape, then move cursor to the left then to the right-----------------------
Darknet
/tmp/pureline git clone https://githubgit clone https://github.com/chris-marsh/pureline /tmp/pureline
Don't know why , but the line is clutter
Now, concerning adding the possibility to the user to define the background. Add a module to fill the line :
function fillps1 {
local bg_color=$1 # Set the background color
local fg_color=$2 # Set the foregropund color
PS1="${colors[${fg_color}]}${colors[On_${bg_color}]}$(printf "%$((${COLUMNS:=$(tput cols)} - 1))s")${colors[${bg_color}]}${colors['On_Default']}${symbols[hard_separator]}\e[0m\033[0G${PS1}"
unset __last_color
}
$ env -i bash --noprofile --norc --login
bash-4.3$ cd /tmp/pureline/
bash-4.3$ git rev-parse HEAD
1e44b57a67e9a5ab1c81cfffd8e0d2c359eda807
bash-4.3$ git diff
WARNING: terminal is not fully functional
diff --git a/pureline b/pureline
index be03be1..04ce70b 100644
--- a/pureline
+++ b/pureline
@@ -380,13 +380,22 @@ declare -A symbols=(
[behind]="-"
)
+function fillps1 {
+ local bg_color=$1 # Set the background color
+ local fg_color=$2 # Set the foregropund color
+ PS1="${colors[${fg_color}]}${colors[On_${bg_color}]}$(printf "%$((${COLUMNS:=$(tput cols)} - 1))s")${colors[${bg_color}]}${colors['On_Default']}${symbols[hard_separator]}\e[0m\033[0G${PS1}"
+ unset __last_color
+}
+
# check if an argument has been given for a config file
if [ -f "$1" ]; then
source $1
else
# define default modules to load
declare -a pureline_modules=(
+ 'fillps1 Green Yellow'
'host_module Yellow Black false'
+ 'newline_module'
'path_module Blue Black 0'
'read_only_module Red White'
)
bash-4.3$ source pureline
You will get the same as my previous screenshot
