summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugues Hiegel <hugues@hiegel.fr>2012-06-07 10:35:01 +0200
committerHugues Hiegel <hugues@hiegel.fr>2012-06-07 10:35:01 +0200
commita015d10c67c9cbc6448d25156b1b7841c0337153 (patch)
tree6545f79de8d27fac648545396ec25e3760c19a37
parent791d76d44324badcd53a886b4ad291b38ae1544f (diff)
[Keys/Prompt] up up and awayyy
-rw-r--r--12_Prompts.zsh11
-rw-r--r--user:hugues/KeyBindings.zsh2
2 files changed, 9 insertions, 4 deletions
diff --git a/12_Prompts.zsh b/12_Prompts.zsh
index 4e70f66..20a4f94 100644
--- a/12_Prompts.zsh
+++ b/12_Prompts.zsh
@@ -91,6 +91,13 @@ __get_prompt_lines()
echo $lines
}
+# Rewrites current prompt.
+__up_up ()
+{
+ for i in {1..$(__get_prompt_lines)}
+ tput cuu1
+}
+
preexec ()
{
__term_title "$2"
@@ -101,10 +108,8 @@ preexec ()
__hbar
__redefine_prompt
- local lines=$(__get_prompt_lines "$1")
-
tput sc
- for i in {1..$lines} ; tput cuu1
+ __up_up
# Only redraws the date, not the full prompt, since we got glitches with BANG_HIST and AUTOCORRECT...
print -Pn $(tput cub $COLUMNS ; tput cuf $(($COLUMNS - $DATESIZE)))$C_$_prompt_colors[bar]$_C$DATE
tput rc
diff --git a/user:hugues/KeyBindings.zsh b/user:hugues/KeyBindings.zsh
index 2863542..af31b88 100644
--- a/user:hugues/KeyBindings.zsh
+++ b/user:hugues/KeyBindings.zsh
@@ -237,7 +237,7 @@ do
bindkey -M $keymap 'q' push-line
bindkey -M $keymap 'Q' push-line
- bindkey -M $keymap -s 'K' 'Q for i in {1..$(__get_prompt_lines)} ; tput cuu1\n'
+ bindkey -M $keymap -s 'K' 'Q __up_up\n'
bindkey -M $keymap -s 'B' 'Q tput clear ; tput cup $(tput lines) 0\n'
done