|
|
|
@ -84,7 +84,6 @@ export class InputHint extends React.Component<InputHintProps, InputHitState>
|
|
|
|
|
this.m_InputEl.value += e.key;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.handleOnChangeIntelliSense(this.m_InputEl.value);
|
|
|
|
|
this.handleKeyboardEvent(e);
|
|
|
|
|
|
|
|
|
|
if (e.keyCode === KeyBoard.Space)
|
|
|
|
@ -125,6 +124,7 @@ export class InputHint extends React.Component<InputHintProps, InputHitState>
|
|
|
|
|
if (cmdName.indexOf(inputCmd) !== -1)
|
|
|
|
|
{
|
|
|
|
|
intelliSenseCmdList.push(cmdName);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (searchReg.test(cmdName))
|
|
|
|
|
{
|
|
|
|
@ -134,7 +134,13 @@ export class InputHint extends React.Component<InputHintProps, InputHitState>
|
|
|
|
|
|
|
|
|
|
intelliSenseCmdList.sort((c1, c2) =>
|
|
|
|
|
{
|
|
|
|
|
return c1.length < c2.length ? -1 : 1;
|
|
|
|
|
let i = 1;
|
|
|
|
|
if (c1.indexOf(inputCmd) < c2.indexOf(inputCmd))
|
|
|
|
|
i = -1;
|
|
|
|
|
else if (c1.indexOf(inputCmd) === c2.indexOf(inputCmd))
|
|
|
|
|
i = c1.length < c2.length ? -1 : 1
|
|
|
|
|
|
|
|
|
|
return i;
|
|
|
|
|
});
|
|
|
|
|
this.setState({
|
|
|
|
|
intelliSenseCommand: intelliSenseCmdList,
|
|
|
|
@ -205,6 +211,7 @@ export class InputHint extends React.Component<InputHintProps, InputHitState>
|
|
|
|
|
if (intellCout > 0)
|
|
|
|
|
{
|
|
|
|
|
let index = this.state.intelliSenseIndex;
|
|
|
|
|
|
|
|
|
|
if (e.keyCode == KeyBoard.ArrowUp)
|
|
|
|
|
{
|
|
|
|
|
index--;
|
|
|
|
@ -212,6 +219,7 @@ export class InputHint extends React.Component<InputHintProps, InputHitState>
|
|
|
|
|
else if (e.keyCode == KeyBoard.ArrowDown)
|
|
|
|
|
{
|
|
|
|
|
index++;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
index = FixIndex(index, intellCout);
|
|
|
|
|
this.setState({ intelliSenseIndex: index });
|
|
|
|
@ -297,7 +305,10 @@ export class InputHint extends React.Component<InputHintProps, InputHitState>
|
|
|
|
|
onChange={(e) => { this.handleOnChangeIntelliSense(e.target.value) }}
|
|
|
|
|
value={this.state.command}
|
|
|
|
|
ref={el => { this.m_InputEl = el; }}
|
|
|
|
|
onKeyDown={(e) => { if (e.ctrlKey || e.altKey) e.preventDefault(); }}
|
|
|
|
|
onKeyDown={(e) =>
|
|
|
|
|
{
|
|
|
|
|
if (e.ctrlKey || e.altKey) e.preventDefault();
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
<ul
|
|
|
|
|
className="history-command"
|
|
|
|
|