wmaillard / shellinabox

Automatically exported from code.google.com/p/shellinabox
Other
0 stars 0 forks source link

erroneous cursor position #45

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Use the following PS1 for zsh: "%{^[[33;36;1m%}%T%{^[[0m%}
%{^[[33;31;1m%}%n%{^[[0m^[[33;33;1m%}@%{^[[33;37;1m%}%m
%{^[[33;32;1m%}%~%{^[[0m^[[33;33;1m%}%#%{^[[0m%} " (you'll need to retype
the ^[ chars)
2. The cursor will appear inside the PS1 output if no character is typed on
the line. The cursor is correctly aligned for lines containing 1 or more
characters.

Note that using a similar line on bash doesn't cause the same problem
("\[\e[1;36m\]\A \[\e[1;31m\]\u\[\e[1;33m\]@\[\e[1;37m\]\h
\[\e[1;32m\]\w\[\e[1;33m\]% \[\e[0m\]").

Original issue reported on code.google.com by dion...@gmail.com on 9 Jan 2010 at 4:59

GoogleCodeExporter commented 8 years ago
I forgot to mention that this is using svn r200. (It is also reproducible with 
2.10)

Original comment by dion...@gmail.com on 9 Jan 2010 at 5:01

GoogleCodeExporter commented 8 years ago
I guess this is the same problem we have stumpled upon here.
Are you using Firefox?

In contrast to Opera which sets a font-family and a font-size for pre-tags by 
default
the Firefox sets only a font-family by default.

Since shellinabox overrides the font-family for the #console pre-tags, but 
forgets
about the pre-tag, which includes the span-element with id #space, which is
temporarily build to calculate the cursor position in some cases (e.g. ^U to 
clear
the line), the font-sizes differ.

Solution:
Change the line in file shellinabox/styles.css:47 from

#vt100 #console, #vt100 #alt_console, #vt100 #cursor, #vt100 #lineheight {

to

#vt100 #console, #vt100 #alt_console, #vt100 #cursor, #vt100 #lineheight, #vt100
.hidden pre {

I hope this helps. It took me some while to figure it out :-)

Jan

Original comment by siev...@zedat.fu-berlin.de on 23 Apr 2010 at 2:02

GoogleCodeExporter commented 8 years ago
Yup, that fixed it. Thanks!

Original comment by dion...@gmail.com on 3 Sep 2010 at 5:01

GoogleCodeExporter commented 8 years ago
Thank you! This fixes a bunch of other bugs, too, I think.

Jan, I owe you a beer :-)

Original comment by zod...@gmail.com on 3 Sep 2010 at 5:26