aboutsummaryrefslogtreecommitdiff
path: root/src/console
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2021-07-04 13:29:42 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2021-07-04 13:29:42 +0900
commit6b88c15d1a6193cd090c5a1ae9b6ea06a467e171 (patch)
treee1b78080d8e10477007c9379b57a6213e6f72c6a /src/console
parent5904eeff1a75dcf83bcef7d5666a7473cc5b77de (diff)
yarn lint:fix
Diffstat (limited to 'src/console')
-rw-r--r--src/console/completion/hooks.ts53
-rw-r--r--src/console/components/CommandPrompt.tsx8
-rw-r--r--src/console/hooks/useAutoResize.ts6
3 files changed, 22 insertions, 45 deletions
diff --git a/src/console/completion/hooks.ts b/src/console/completion/hooks.ts
index c3940c7..4402b70 100644
--- a/src/console/completion/hooks.ts
+++ b/src/console/completion/hooks.ts
@@ -246,49 +246,30 @@ export const useCompletions = () => {
return;
}
- getOpenCompletions(
- cmd.command,
- cmd.args,
- completionTypes
- ).then((completions) =>
- dispatch(actions.setCompletions(completions))
+ getOpenCompletions(cmd.command, cmd.args, completionTypes).then(
+ (completions) => dispatch(actions.setCompletions(completions))
);
break;
case Command.Buffer:
- getTabCompletions(
- cmd.command,
- cmd.args,
- false
- ).then((completions) =>
- dispatch(actions.setCompletions(completions))
+ getTabCompletions(cmd.command, cmd.args, false).then(
+ (completions) => dispatch(actions.setCompletions(completions))
);
break;
case Command.BufferDelete:
case Command.BuffersDelete:
- getTabCompletions(
- cmd.command,
- cmd.args,
- true
- ).then((completions) =>
- dispatch(actions.setCompletions(completions))
+ getTabCompletions(cmd.command, cmd.args, true).then(
+ (completions) => dispatch(actions.setCompletions(completions))
);
break;
case Command.BufferDeleteForce:
case Command.BuffersDeleteForce:
- getTabCompletions(
- cmd.command,
- cmd.args,
- false
- ).then((completions) =>
- dispatch(actions.setCompletions(completions))
+ getTabCompletions(cmd.command, cmd.args, false).then(
+ (completions) => dispatch(actions.setCompletions(completions))
);
break;
case Command.Set:
- getPropertyCompletions(
- cmd.command,
- cmd.args
- ).then((completions) =>
- dispatch(actions.setCompletions(completions))
+ getPropertyCompletions(cmd.command, cmd.args).then(
+ (completions) => dispatch(actions.setCompletions(completions))
);
break;
}
@@ -314,12 +295,14 @@ export const useCompletions = () => {
export const useSelectCompletion = () => {
const state = React.useContext(CompletionStateContext);
const dispatch = React.useContext(CompletionDispatchContext);
- const next = React.useCallback(() => dispatch(actions.selectNext()), [
- dispatch,
- ]);
- const prev = React.useCallback(() => dispatch(actions.selectPrev()), [
- dispatch,
- ]);
+ const next = React.useCallback(
+ () => dispatch(actions.selectNext()),
+ [dispatch]
+ );
+ const prev = React.useCallback(
+ () => dispatch(actions.selectPrev()),
+ [dispatch]
+ );
const currentValue = React.useMemo(() => {
if (state.select < 0) {
return state.completionSource;
diff --git a/src/console/components/CommandPrompt.tsx b/src/console/components/CommandPrompt.tsx
index 1b6281b..0e2506c 100644
--- a/src/console/components/CommandPrompt.tsx
+++ b/src/console/components/CommandPrompt.tsx
@@ -21,12 +21,8 @@ const CommandPromptInner: React.FC<Props> = ({ initialInputValue }) => {
const hide = useHide();
const [inputValue, setInputValue] = React.useState(initialInputValue);
const { completions, updateCompletions } = useCompletions();
- const {
- select,
- currentValue,
- selectNext,
- selectPrev,
- } = useSelectCompletion();
+ const { select, currentValue, selectNext, selectPrev } =
+ useSelectCompletion();
const execCommand = useExecCommand();
useAutoResize();
diff --git a/src/console/hooks/useAutoResize.ts b/src/console/hooks/useAutoResize.ts
index 4253606..26f1d76 100644
--- a/src/console/hooks/useAutoResize.ts
+++ b/src/console/hooks/useAutoResize.ts
@@ -10,10 +10,8 @@ const useAutoResize = () => {
}, []);
React.useLayoutEffect(() => {
- const {
- scrollWidth: width,
- scrollHeight: height,
- } = document.getElementById("vimvixen-console")!;
+ const { scrollWidth: width, scrollHeight: height } =
+ document.getElementById("vimvixen-console")!;
consoleFrameClient.resize(width, height);
if (width === prevWidth && height === prevHeight) {