From 098502eaef78d7e85ddeef7380f9e346086ce771 Mon Sep 17 00:00:00 2001 From: Maxime Jacquemin <maxime2.jacquemin@gmail.com> Date: Thu, 16 Sep 2021 16:43:22 +0200 Subject: [PATCH] [ivette] For the linter --- ivette/src/frama-c/kernel/SourceCode.tsx | 4 ++-- ivette/src/ivette/prefs.tsx | 8 +------- ivette/src/renderer/Preferences.tsx | 10 +++++----- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/ivette/src/frama-c/kernel/SourceCode.tsx b/ivette/src/frama-c/kernel/SourceCode.tsx index 440f51a1ab9..d219313e4cc 100644 --- a/ivette/src/frama-c/kernel/SourceCode.tsx +++ b/ivette/src/frama-c/kernel/SourceCode.tsx @@ -95,10 +95,10 @@ export default function SourceCode() { const [command] = Settings.useGlobalSettings(Preferences.EditorCommand); const launchEditor = () => { - const cmd = command.replace('\%s', file).replace('\%d', line.toString()); + const cmd = command.replace('%s', file).replace('%d', line.toString()); const args = cmd.split(' '); const prog = args.shift(); - if (prog) System.spawn(prog, args); + if (prog) System.spawn(prog, args).catch(/* TODO */); }; // Building the React component. diff --git a/ivette/src/ivette/prefs.tsx b/ivette/src/ivette/prefs.tsx index b4fd8e08190..ab9ece62a45 100644 --- a/ivette/src/ivette/prefs.tsx +++ b/ivette/src/ivette/prefs.tsx @@ -131,16 +131,10 @@ export function useThemeButtons(props: ThemeProps): ThemeControls { // -------------------------------------------------------------------------- export const EditorCommand = - new Settings.GString('Editor.Command', 'emacs +\%d \%s'); + new Settings.GString('Editor.Command', 'emacs +%d %s'); export interface EditorCommandProps { command: Settings.GlobalSettings<string>; } -// function produceCommand(command: string, file: string, line: number): string { -// command.replace('\%s', file); -// command.replace('\%d', line.toString()); -// return ""; -// } - // -------------------------------------------------------------------------- diff --git a/ivette/src/renderer/Preferences.tsx b/ivette/src/renderer/Preferences.tsx index b6696ab22ad..70731ab3b77 100644 --- a/ivette/src/renderer/Preferences.tsx +++ b/ivette/src/renderer/Preferences.tsx @@ -86,11 +86,11 @@ function ThemeFields(props: P.ThemeProps) { // -------------------------------------------------------------------------- // --- Editor Command Forms // -------------------------------------------------------------------------- -function EditorCommandFields(props : P.EditorCommandProps) { - const command = Forms.useDefined( - Forms.useValid(Settings.useGlobalSettings(props.command) +function EditorCommandFields(props: P.EditorCommandProps) { + const command = Forms.useDefined(Forms.useValid( + Settings.useGlobalSettings(props.command), )); - return (<Forms.TextCodeField state={command} label="Command"/>); + return (<Forms.TextCodeField state={command} label="Command" />); } // -------------------------------------------------------------------------- @@ -116,7 +116,7 @@ export default (() => ( /> </Forms.Section> <Forms.Section label="Editor Command" unfold> - <EditorCommandFields command={P.EditorCommand}/> + <EditorCommandFields command={P.EditorCommand} /> </Forms.Section> </Forms.Page> )); -- GitLab