fix(hist): zsh string trim
This commit is contained in:
parent
ea0689b6f1
commit
0d53d15143
1 changed files with 5 additions and 1 deletions
|
|
@ -530,7 +530,11 @@ _lp_dotmatrix_theme_prompt() {
|
||||||
local hist_max=$((DOTMATRIX_HISTORY_LAST_LEN-${#DOTMATRIX_HISTORY_LAST_LEN_MARK}))
|
local hist_max=$((DOTMATRIX_HISTORY_LAST_LEN-${#DOTMATRIX_HISTORY_LAST_LEN_MARK}))
|
||||||
local hist_last=$(history | tail -n 1 | cut -d" " -f5-)
|
local hist_last=$(history | tail -n 1 | cut -d" " -f5-)
|
||||||
if [[ ${#hist_last} -gt $hist_max ]] ; then
|
if [[ ${#hist_last} -gt $hist_max ]] ; then
|
||||||
hist_last="${hist_last:0:$hist_max}${DOTMATRIX_HISTORY_LAST_LEN_MARK}"
|
if (( _LP_SHELL_zsh )) ; then
|
||||||
|
hist_last="${hist_last[1,$hist_max]}${DOTMATRIX_HISTORY_LAST_LEN_MARK}"
|
||||||
|
else # bash
|
||||||
|
hist_last="${hist_last:0:$hist_max}${DOTMATRIX_HISTORY_LAST_LEN_MARK}"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
local hist_most=$(history | tail -n ${DOTMATRIX_HISTORY_MOST_BACK} | awk '{print $4}' | sort | uniq --count | sort --numeric-sort --reverse | head -n 1 | awk '{print $2}')
|
local hist_most=$(history | tail -n ${DOTMATRIX_HISTORY_MOST_BACK} | awk '{print $4}' | sort | uniq --count | sort --numeric-sort --reverse | head -n 1 | awk '{print $2}')
|
||||||
inline_right="$d${hist_last}$I${hist_most}$b"
|
inline_right="$d${hist_last}$I${hist_most}$b"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue