Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emacs fixes for garbled terminal output #196

Merged
merged 2 commits into from
Feb 16, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions pure.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ prompt_pure_check_git_arrows() {
}

prompt_pure_set_title() {
# emacs terminal does not support settings the title
(( ${+EMACS} )) && return

# tell the terminal we are setting the title
print -n '\e]0;'
# show hostname if connected through ssh
Expand Down Expand Up @@ -174,17 +177,17 @@ prompt_pure_preprompt_render() {
elif (( last_lines < lines )); then
# move cursor using newlines because ansi cursor movement can't push the cursor beyond the last line
printf $'\n'%.0s {1..$(( lines - last_lines ))}

# redraw the prompt since it has been moved by print
zle && zle .reset-prompt
fi

# disable clearing of line if last char of preprompt is last column of terminal
local clr='\e[K'
(( COLUMNS * lines == preprompt_length )) && clr=

# modify previous preprompt
print -Pn "\e7${clr_prev_preprompt}\e[${lines}A\e[1G${preprompt}${clr}\e8"
print -Pn "${clr_prev_preprompt}\e[${lines}A\e[${COLUMNS}D${preprompt}${clr}\n"

# redraw prompt (also resets cursor position)
zle && zle .reset-prompt
fi

# store previous preprompt for comparison
Expand Down