Fixing some autocompletion stuff

This commit is contained in:
BlackLight 2010-12-23 18:10:50 +01:00
parent 3050d092e7
commit ed0d2b7f54
3 changed files with 15 additions and 1 deletions

View file

@ -4,6 +4,7 @@ body
color : #888; color : #888;
font-family : Terminus, courier, monospace, fixed; font-family : Terminus, courier, monospace, fixed;
font-size : 13px; font-size : 13px;
tabindex : -1;
} }
input.promptInput input.promptInput
@ -24,11 +25,13 @@ div#blashWindow
padding : 10px; padding : 10px;
border : 1px solid #888; border : 1px solid #888;
overflow : auto; overflow : auto;
tabindex : -1;
} }
a.bannerLink a.bannerLink
{ {
color : white; color : white;
tabindex : -1;
} }
span.directory span.directory
@ -39,11 +42,13 @@ span.directory
a a
{ {
color : green; color : green;
tabindex : -1;
} }
a:visited a:visited
{ {
color : green; color : green;
tabindex : -1;
} }
span.syntax span.syntax

View file

@ -160,6 +160,7 @@ function blash ()
this.prompt.setAttribute ( 'autocomplete', 'off' ); this.prompt.setAttribute ( 'autocomplete', 'off' );
this.prompt.setAttribute ( 'onkeydown', 'shell.getKey ( event )' ); this.prompt.setAttribute ( 'onkeydown', 'shell.getKey ( event )' );
this.prompt.setAttribute ( 'onkeyup', 'this.focus()' ); this.prompt.setAttribute ( 'onkeyup', 'this.focus()' );
this.prompt.setAttribute ( 'onblur', 'return false' );
this.cmdOut = document.createElement ( 'div' ); this.cmdOut = document.createElement ( 'div' );
this.cmdOut.setAttribute ( 'id', 'blashCmdOut' ); this.cmdOut.setAttribute ( 'id', 'blashCmdOut' );
@ -263,6 +264,14 @@ function blash ()
} }
this.prompt.focus(); this.prompt.focus();
setTimeout ( function() { shell.prompt.focus(); }, 1 );
if ( this.prompt.setSelectionRange )
{
this.prompt.setSelectionRange ( this.prompt.value.length, this.prompt.value.length );
}
return false;
} }
this.prompt.focus(); this.prompt.focus();

View file

@ -8,7 +8,7 @@
<body onload="shell = new blash()"> <body onload="shell = new blash()">
<div id="blashWindow" onmouseup="shell.prompt.focus()"> <div id="blashWindow" onmouseup="shell.prompt.focus()">
<span id="promptText" class="promptText"></span> <span id="promptText" class="promptText"></span>
<input type="text" class="promptInput" name="blashPrompt" autocomplete="off" onkeydown="shell.getKey ( event )" onkeyup="this.focus()"/> <input type="text" class="promptInput" name="blashPrompt" autocomplete="off" onkeydown="shell.getKey ( event )" onkeyup="this.focus()" onblur="return false"/>
<span id="blashCmdOut" class="blashCmdOut"/></span> <span id="blashCmdOut" class="blashCmdOut"/></span>
</div> </div>
</body> </body>