Dubbele prompt in midnight commander

Pagina: 1
Acties:

  • lvh
  • Registratie: Juli 2001
  • Laatst online: 02-11-2022
Sinds kort is me opgevallen dat ik in mc een dubbele prompt (en iets wat lijkt op een escape code) zie.

Afbeeldingslocatie: http://i190.photobucket.com/albums/z318/laurensvh/dubbeleprompt.gif

Ik dacht eerst dat het ging over MC die stikte in een control code (de prompt is in zwartwit, mijn eigen prompt is in groen/blauw, standaard Debian kleurtjes op een color term), maar mc -c lost het probleem ook niet op. Manueel met PS1="..." mijn terminal op iets standaards zetten helpt ook niet. rm -r ~/.mc/ ook niet.

  • A_L
  • Registratie: Juni 2001
  • Niet online

A_L

Ik denk toch dat het in een aangepaste PS1-prompt zit. Ik heb heb zelf namelijk ook met mijn aangepaste 'shortstatus' prompt, maar andere gebruikers op het systeem (die deze prompt niet gebruiken) hebben dit niet.

Ik zal mijn prompt eens posten (de website waar ik 'm vandaan had is 'verschwunden'):
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# shortstatus - terse bash prompt uses text characteristics to show
# ssh-agent status, writability of current directory and exit code of
# last command, if nonzero. The prompt format is common; I got the idea
# for showing the exit code from "Dan's Prompt"
# http://www.dreaming.org/~giles/bashprompt/prompts/dan.html
#
# jeremy-bash@batray.net
#

export T_normal=0
export T_bold=1
export T_underline=4
export C_owner='0;32'
export C_write='0;36'
export C_nowrite='0;31'
export C_error='1;31'

export DIRCOLOR=$T_normal
export EXIT_CODE=0
export CODE_COLOR=$T_normal
export CODE_STRING=
export USER_STYLE=$T_normal

prompt_command()
{
   EXIT_CODE=$?
   DIRCOLOR=$T_normal
   if [ -O "$PWD" ]
   then
      DIRCOLOR=$C_owner
   elif [ -w "$PWD" ]
   then
      DIRCOLOR=$C_write
   else
      DIRCOLOR=$C_nowrite
   fi
   if [ $EXIT_CODE -ne 0 ]
   then
      CODE_COLOR=$C_error
      CODE_STRING=\ $EXIT_CODE
   else
      CODE_COLOR=$T_normal
      CODE_STRING=
   fi

   if [ -S "$SSH_AUTH_SOCK" ]
   then
      USER_STYLE=$T_underline
   else
      USER_STYLE=$T_normal
   fi
}
export PROMPT_COMMAND=prompt_command
if [ ${TERM:0:5} = xterm ]
then
   PS1='\[\e]0;\u@\h:\w\007\]'
else
   PS1=''
fi

PS1=$PS1'[\[\e[${USER_STYLE}m\]\u\[\e[${T_normal}m\]@\h:\[\e[${DIRCOLOR}m\]\w\[\e[${CODE_COLOR}m\]$CODE_STRING\[\e[${T_normal}m\]]\$ '
export PS1
(Hij is overigens best handig, geeft exit-codes weer in de prompt enzo.)


Als ik het stukje er uit haal waar PS1 wordt toegevoegd aan PS1 + nogmeer, dan werkt het wel. Dus enalaatste regel wordt dan:
code:
1
PS1='[\[\e[${USER_STYLE}m\]\u\[\e[${T_normal}m\]@\h:\[\e[${DIRCOLOR}m\]\w\[\e[${CODE_COLOR}m\]$CODE_STRING\[\e[${T_normal}m\]]\$ '


Dan werkt het wel. Het lijkt dus dat mc struikelt over het stukje dat de venstertitel voor een xterm-compatible terminal zet? Hoe het kan dat het probleem zelfs optreedt als je PS1 unset, weet ik ook niet. Wellicht leest mc .bashrc bij het opstarten?

[ Voor 0% gewijzigd door A_L op 27-01-2009 22:36 . Reden: spellingscontrole ]