From f718af82030c7a5d295ebff54482b184ec0a7e39 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Tue, 19 Jun 2012 17:51:13 +0200 Subject: [Prompt] little display tweaks to speed up things. 'reset-prompt' zle rewritten. --- 01_Internal.zsh | 16 +++++++++++----- 12_Prompts.zsh | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/01_Internal.zsh b/01_Internal.zsh index 6ac5ec5..ee25c75 100644 --- a/01_Internal.zsh +++ b/01_Internal.zsh @@ -16,6 +16,10 @@ # go see the file Prompts.zsh # +_cuu1_=$(tput cuu1) +_cud1_=$(tput cud1) +_cub1_=$(tput cub 1) +_cuf1_=$(tput cuf 1) __cmd_exists () { @@ -383,14 +387,15 @@ __get_prompt_lines() # Rewrites current prompt. __redisplay_ps1 () { - tput sc - up_up - 1 __redefine_prompt + tput sc + up_up - 1 print -Pn "$PS1" tput rc } -zle -N __redisplay_ps1 +zle -D reset-prompt +zle -N reset-prompt __redisplay_ps1 __clear () { @@ -400,9 +405,10 @@ __clear () up_up () { + local _up="" for i in {1..$(($(__get_prompt_lines) $@ ))} - tput cuu1 - print -Pn '\r' + _up+=$_cuu1_ + print -Pn $_up'\r' } _rehash () diff --git a/12_Prompts.zsh b/12_Prompts.zsh index ba8b7be..2b2255a 100644 --- a/12_Prompts.zsh +++ b/12_Prompts.zsh @@ -291,7 +291,7 @@ __two_lines_prompt () for trigger in $PS1_TASKBAR do result=$($trigger) - [ -n "$result" ] && PS1_+=$(tput cuf 1)${result}$C_$_prompt_colors[bar]$_C + [ -n "$result" ] && PS1_+=$_cuf1_${result}$C_$_prompt_colors[bar]$_C done PS1_+=$(__show_date) -- cgit v1.2.3