Fix input history
This commit is contained in:
parent
4c70d11a86
commit
c428842db7
File diff suppressed because one or more lines are too long
@ -9,7 +9,7 @@ export default class MessageInput extends PureComponent {
|
|||||||
const { tab, runCommand, sendMessage, addInputHistory, incrementInputHistory,
|
const { tab, runCommand, sendMessage, addInputHistory, incrementInputHistory,
|
||||||
decrementInputHistory, resetInputHistory } = this.props;
|
decrementInputHistory, resetInputHistory } = this.props;
|
||||||
|
|
||||||
if (e.which === 13 && e.target.value) {
|
if (e.key === 'Enter' && e.target.value) {
|
||||||
if (e.target.value[0] === '/') {
|
if (e.target.value[0] === '/') {
|
||||||
runCommand(e.target.value, tab.name, tab.server);
|
runCommand(e.target.value, tab.name, tab.server);
|
||||||
} else if (tab.name) {
|
} else if (tab.name) {
|
||||||
@ -19,14 +19,12 @@ export default class MessageInput extends PureComponent {
|
|||||||
addInputHistory(e.target.value);
|
addInputHistory(e.target.value);
|
||||||
resetInputHistory();
|
resetInputHistory();
|
||||||
this.setState({ value: '' });
|
this.setState({ value: '' });
|
||||||
} else if (e.which === 38) {
|
} else if (e.key === 'ArrowUp') {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
incrementInputHistory();
|
incrementInputHistory();
|
||||||
} else if (e.which === 40) {
|
} else if (e.key === 'ArrowDown') {
|
||||||
decrementInputHistory();
|
decrementInputHistory();
|
||||||
} else if (e.key === 'Backspace' || e.key === 'Delete') {
|
} else {
|
||||||
resetInputHistory();
|
|
||||||
} else if (e.key === 'Unidentified') {
|
|
||||||
this.setState({ value: e.target.value });
|
this.setState({ value: e.target.value });
|
||||||
resetInputHistory();
|
resetInputHistory();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user