diff --git a/ivette/src/dome/renderer/frame/toolbars.tsx b/ivette/src/dome/renderer/frame/toolbars.tsx index 596a7ece181bfaeef49980544cf062a33958d779..edf993e9012febead6274f51bb9db0f685d1fe08 100644 --- a/ivette/src/dome/renderer/frame/toolbars.tsx +++ b/ivette/src/dome/renderer/frame/toolbars.tsx @@ -272,7 +272,7 @@ export function Select(props: SelectionProps<string>) { export interface Hint { id: string | number; icon?: string; - label: string | JSX.Element; + label: string; title?: string; value(): void; rank?: number; @@ -288,8 +288,10 @@ export type HintsEvaluator = (pattern: string) => Promise<Hint[]>; /** Description of an action mode. */ export interface ActionMode { - /** Mode tooltip text. */ - title: string; + /** Mode tooltip title. */ + title?: string; + /** Mode tooltip label. */ + label: string; /** Mode placeholder text. */ placeholder?: string; /** Icon displayed when the mode is selected. */ @@ -329,7 +331,8 @@ async function searchHints(pattern: string) { } const searchMode: ActionMode = { - title: "Search", + label: "Search", + title: 'Search through the global definitions', placeholder: "Search…", icon: "SEARCH", className: 'dome-xToolBar-searchMode', @@ -415,7 +418,7 @@ function Suggestions(props: SuggestionsProps) { // -------------------------------------------------------------------------- interface ActionInputProps { - title: string; + title?: string; placeholder?: string; hints: Hint[]; onHint: (hint: Hint) => void; @@ -529,16 +532,16 @@ export function ModalActionField() { // Auxiliary function that build a Hint from an ActionMode. const modeToHint = (mode: ActionMode) => { - const { title, icon } = mode; + const { label, title, icon } = mode; const id = 'ActionMode-' + title + '-' + icon; const value = () => { onModeChange(mode); }; - return { id, icon, label: title, title, value, rank: -1000 }; + return { id, icon, label, title, value, rank: -1000 }; }; // Hints provider for the mode of all modes. const modesHints = React.useCallback((input: string) => { const p = input.toLowerCase(); - const fit = (m: ActionMode) => m.title.toLowerCase().includes(p); + const fit = (m: ActionMode) => m.label.toLowerCase().includes(p); return Promise.resolve(Array.from(allModes).filter(fit).map(modeToHint)); }, [allModes]); @@ -546,18 +549,18 @@ export function ModalActionField() { // on the current mode icon and allows to change the current mode, displaying // a list of all available modes as hints. const modesMode = React.useMemo(() => { - const title = "Mode selection"; + const label = "Mode selection"; const placeholder = "Search mode"; const icon = "TUNINGS"; const className = 'dome-xToolBar-modeOfModes'; - return { title, placeholder, icon, className, hints: modesHints }; + return { label, placeholder, icon, className, hints: modesHints }; }, [modesHints]); // Build a new search engine for the search mode, adding available modes to // the possible search hints. const searchModeHints = React.useCallback(async (input: string) => { const hs = await modesMode.hints(input); - const notCurrent = (h: Hint) => !(h.title?.includes(current.title)); + const notCurrent = (h: Hint) => !(h.label.includes(current.label)); return hs.filter(notCurrent); }, [current.title, modesMode]); diff --git a/ivette/src/frama-c/plugins/eva/valuetable.tsx b/ivette/src/frama-c/plugins/eva/valuetable.tsx index 591e35266ae35a0de8c938bc069c5bb09ecebf4a..c60093ea90b1fcba3bb6e1b8493d68126f50c633 100644 --- a/ivette/src/frama-c/plugins/eva/valuetable.tsx +++ b/ivette/src/frama-c/plugins/eva/valuetable.tsx @@ -24,6 +24,7 @@ import React from 'react'; import _ from 'lodash'; import * as Ivette from 'ivette'; import * as Dome from 'dome/dome'; +import * as System from 'dome/system'; import * as States from 'frama-c/states'; import * as Server from 'frama-c/server'; import * as Ast from 'frama-c/kernel/api/ast'; @@ -922,13 +923,15 @@ function useEvaluationMode(props: EvaluationModeProps): void { }; React.useEffect(() => { if (computationState !== 'computed') return () => { return; }; + const shortcut = System.platform === 'macos' ? 'Cmd+E' : 'Ctrl+E'; const onEnter = (pattern: string): void => { const marker = selection?.current?.marker; const data = { atStmt: marker, term: pattern }; Server.send(Ast.markerFromTerm, data).then(addProbe).catch(handleError); }; const evalMode = { - title: 'Evaluation', + label: 'Evaluation', + title: `Evaluate an ACSL expression (shortcut: ${shortcut})`, icon: 'TERMINAL', className: 'eva-evaluation-mode', hints: () => { return Promise.resolve([]); },