Fix log search

- Don't blur on enter by default on <SearchInput>

- Use SHIFT+ENTER for reverse search jumping

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton committed 2022-01-31 09:10:23 -05:00
1 parent 5e1cdf9774
commit 9e1261b7f6
2 files changed
+7 -6

No files matched your search

@@ -52,8 +52,12 @@ export const LogSearch = observer(({ onSearch, scrollToOverlay, model: { logTabD
const onKeyDown = (evt: React.KeyboardEvent<any>) => {
if (evt.key === "Enter") {
if (evt.shiftKey) {
onPrevOverlay();
} else {
onNextOverlay();
}
}
};
useEffect(() => {
@@ -50,13 +50,9 @@ export class SearchInput extends React.Component<Props> {
@boundMethod
onKeyDown(evt: React.KeyboardEvent<any>) {
if (this.props.onKeyDown) {
this.props.onKeyDown(evt);
}
// clear on escape-key
const escapeKey = evt.nativeEvent.code === "Escape";
this.props.onKeyDown?.(evt);
if (escapeKey) {
if (evt.nativeEvent.code === "Escape") {
this.clear();
evt.stopPropagation();
}
@@ -87,6 +83,7 @@ export class SearchInput extends React.Component<Props> {
onKeyDown={this.onKeyDown}
iconRight={rightIcon}
ref={this.inputRef}
blurOnEnter={false}
/>
);
}