zsh-workers
 help / color / mirror / code / Atom feed
* Completion damaging prompt
@ 2008-05-09 12:51 Renato Botelho
  2008-05-09 13:06 ` Peter Stephenson
  2008-05-09 14:41 ` Bart Schaefer
  0 siblings, 2 replies; 4+ messages in thread
From: Renato Botelho @ 2008-05-09 12:51 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 746 bytes --]

Hello,

I'm using zsh 4.3.6 at FreeBSD 7.0, and I noted a problem with prompt
in some cases,
following is an example

garga@botelhor:~> sudo su

root@botelhor:/home/garga#

root@botelhor:/home/garga# pkg<TAB>

When I press TAB, prompt's changed

root@botelhor:/home/gapkg
external command
pkg-config     pkg_add        pkg_delete     pkg_info       pkg_updating   pkgdb
pkg-orphan     pkg_create     pkg_fetch      pkg_sort       pkg_version
pkg-stash      pkg_deinstall  pkg_glob       pkg_tree       pkg_which
local directory
pkgs/

And if I clear the screen using ^L prompt changes to ~garga

root@botelhor:~garga#

Is it sound like a problem of zsh or maybe a configuration problem?
Attached is my zshrc

Thanks in advance
-- 
Renato Botelho

[-- Attachment #2: zshrc --]
[-- Type: application/octet-stream, Size: 3496 bytes --]

#
# .zshrc ( Otávio Fernandes )
#

#
# Allow one error for every three characters typed in approximate completer
#

zstyle -e ':completion:*:approximate:*' max-errors \
	'reply=( $(( ($#PREFIX+$#SUFFIX)/3 )) numeric )'
        
#
# Insert all expansions for expand completer
#

zstyle ':completion:*:expand:*' tag-order all-expansions

#
# Formatting and messages
#

zstyle ':completion:*' verbose yes
zstyle ':completion:*:descriptions' format '%B%d%b'
zstyle ':completion:*:messages' format '%d'
zstyle ':completion:*:warnings' format 'No matches for: %d'
zstyle ':completion:*:corrections' format '%B%d (errors: %e)%b'
zstyle ':completion:*' group-name ''

# match uppercase from lowercase
zstyle ':completion:*' matcher-list 'm:{# a-z}={# A-Z}'

# offer indexes before parameters in subscripts
zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters

# 
# Command for process lists, the local web server details and host completion
#

# zstyle ':completion:*:processes' command 'ps -o pid,s,nice,stime,args'
# zstyle ':completion:*:urls' local 'www' '/var/www/htdocs' 'public_html'
zstyle '*' hosts $hosts

# Filename suffixes to ignore during completion (except after rm command)
zstyle ':completion:*:*:(^rm):*:*files' ignored-patterns '*?.o' '*?.c~' '*?.old' '*?.pro'
# the same for old style completion
#fignore=(.o .c~ .old .pro)

# ignore completion functions (until the _ignored completer
# zstyle ':completion:*:functions' *ignored-patterns* ' '
autoload -U compinit
compinit

HISTFILE=~/.histfile
HISTSIZE=5000
SAVEHIST=1000

export LISTMAX=1000
export EDITOR=vim
export NULLFS=1
export JAIL=/var/jail/data
export GPG_TTY=`tty`

#
# Vi Mode
#

bindkey -v
bindkey -M vicmd "j" history-search-forward
bindkey -M vicmd "k" history-search-backward
bindkey "^[[A" history-search-backward
bindkey "^[[B" history-search-forward
bindkey -M viins "^[[S" insert-last-word
bindkey -M viins "^[[18~" insert-last-word

#
# Aliasing
#

alias more='less'
alias ftp='ncftp'
alias j='jobs -l'
alias ff='find ./ -iname $*'
alias ps='ps auxww'
alias l='ls -lF'
alias ls='ls -F'
alias vi='vim' 
alias l.='ls -dF .*' 
alias gvim="/usr/local/bin/gvim -geom 145x60 -font \"Terminus 7\""
alias ...='cd ../..'
alias sbp='ssh -l bpuser $*'
alias sgn='ssh -l gnuser $*'

alias dcvs='env CVS_RSH=ssh cvs -d garga@dcvs.FreeBSD.org:/home/dcvs'
alias pcvs='env CVS_RSH=ssh cvs -d garga@pcvs.FreeBSD.org:/home/pcvs'
alias projcvs='env CVS_RSH=ssh cvs -d garga@projcvs.FreeBSD.org:/home/projcvs'
alias scvs='env CVS_RSH=ssh cvs -d garga@ncvs.FreeBSD.org:/home/ncvs'
alias bpcvs='CVS_RSH=ssh && cvs -d garga@cvs:/share/cvs/BluePex'

if [ "$LOGNAME" = "root" ]; then
	alias mutt='/usr/bin/env LC_ALL=en_US.ISO8859-1 mutt -y'
else
	alias mutt='/usr/bin/env LC_ALL=en_US.ISO8859-1 mutt'
fi

#
# Shell functions
#

setenv() { typeset -x "${1}${1:+=}${(@)argv[2,$#]}" }  # csh compatibility
freload() { while (( $# )); do; unfunction $1; autoload -U $1; shift; done }

#
# Command Prompt
#

PROMPT='%n@%B%m%b:%~%(#.#.>) '

#
# Completion options
#

setopt   notify globdots pushdtohome cdablevars autolist
setopt   autocd recexact longlistjobs NO_BEEP
setopt   autoresume histignoredups pushdsilent noclobber
setopt   autopushd pushdminus extendedglob rcquotes mailwarning
unsetopt bgnice autoparamslash listambiguous

#
# Changing XTerm Title
#

case $TERM in
	xterm*)
		precmd () { print -Pn "\e]0;%n@%m: %~\a"}
		;;
esac

#
# bsd games
#

[ -x /usr/games/fortune ] && \
	/usr/games/fortune -s && \
	echo ""

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Completion damaging prompt
  2008-05-09 12:51 Completion damaging prompt Renato Botelho
@ 2008-05-09 13:06 ` Peter Stephenson
  2008-05-09 14:41 ` Bart Schaefer
  1 sibling, 0 replies; 4+ messages in thread
From: Peter Stephenson @ 2008-05-09 13:06 UTC (permalink / raw)
  To: Renato Botelho; +Cc: zsh-workers

"Renato Botelho" wrote:
> I'm using zsh 4.3.6 at FreeBSD 7.0, and I noted a problem with prompt
> in some cases,
> following is an example
> 
> garga@botelhor:~> sudo su
> 
> root@botelhor:/home/garga#
> 
> root@botelhor:/home/garga# pkg<TAB>
>..
> And if I clear the screen using ^L prompt changes to ~garga
> 
> root@botelhor:~garga#

That means something, somewhere in shell code is referring to your home
directory as ~garga (which would expand to /home/garga).  After that's
happened once it's treated as a candidate for abbreviation wherever name
directories are valid.  You have various choices:

- If you want to track down what it is, you'll probably need to get
the completion system to output debug information with "^X?".  This
could be time-consuming to get completely to the bottom of.

- If you always want directories to be shown in full, you can replace
%~ in your path with %/.  That will show /home/garga instead of ~ when
you're not root, however.

- If you want the prompt to be abbreviated only when you're not root,
you can change it to

PROMPT='%n@%B%m%b:%(#.%/#.%~>) '

- If you're happy with your home directory always being abbreviated when
you're root, so that at least it doesn't change, you can put a reference
to it in the initialisation file:

: ~garga

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Completion damaging prompt
  2008-05-09 12:51 Completion damaging prompt Renato Botelho
  2008-05-09 13:06 ` Peter Stephenson
@ 2008-05-09 14:41 ` Bart Schaefer
  2008-05-09 16:40   ` Renato Botelho
  1 sibling, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2008-05-09 14:41 UTC (permalink / raw)
  To: zsh-workers

On May 9,  9:51am, Renato Botelho wrote:
}
} root@botelhor:/home/garga# pkg<TAB>
} 
} When I press TAB, prompt's changed
} 
} root@botelhor:/home/gapkg

So the cursor appears to have backed up five spaces and covered over
part of the prompt?  Is that what you're trying to point out?

} And if I clear the screen using ^L prompt changes to ~garga
} 
} root@botelhor:~garga#

Aside from what PWS wrote, this does look like a bug.  Even if you've
inadvertently created a named directory garga=/home/garga, the ZLE
refresh code shouldn't mis-calculate the width of a prompt it has
already printed, or should reprint the prompt when the width changes.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Completion damaging prompt
  2008-05-09 14:41 ` Bart Schaefer
@ 2008-05-09 16:40   ` Renato Botelho
  0 siblings, 0 replies; 4+ messages in thread
From: Renato Botelho @ 2008-05-09 16:40 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-workers

On Fri, May 9, 2008 at 11:41 AM, Bart Schaefer
<schaefer@brasslantern.com> wrote:
> On May 9,  9:51am, Renato Botelho wrote:
> }
> } root@botelhor:/home/garga# pkg<TAB>
> }
> } When I press TAB, prompt's changed
> }
> } root@botelhor:/home/gapkg
>
> So the cursor appears to have backed up five spaces and covered over
> part of the prompt?  Is that what you're trying to point out?

Exactly.

-- 
Renato Botelho


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-05-09 16:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-09 12:51 Completion damaging prompt Renato Botelho
2008-05-09 13:06 ` Peter Stephenson
2008-05-09 14:41 ` Bart Schaefer
2008-05-09 16:40   ` Renato Botelho

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).