Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
frama-c
Commits
0d55d220
Commit
0d55d220
authored
3 years ago
by
David Bühler
Browse files
Options
Downloads
Patches
Plain Diff
[ivette] Source code: adds a contextual menu to open the file in an editor.
parent
2ade528b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ivette/src/frama-c/kernel/SourceCode.tsx
+18
-3
18 additions, 3 deletions
ivette/src/frama-c/kernel/SourceCode.tsx
with
18 additions
and
3 deletions
ivette/src/frama-c/kernel/SourceCode.tsx
+
18
−
3
View file @
0d55d220
...
@@ -97,7 +97,7 @@ export default function SourceCode() {
...
@@ -97,7 +97,7 @@ export default function SourceCode() {
React
.
useEffect
(()
=>
buffer
.
setCursorOnTop
(
line
),
[
buffer
,
line
,
result
]);
React
.
useEffect
(()
=>
buffer
.
setCursorOnTop
(
line
),
[
buffer
,
line
,
result
]);
const
[
command
]
=
Settings
.
useGlobalSettings
(
Preferences
.
EditorCommand
);
const
[
command
]
=
Settings
.
useGlobalSettings
(
Preferences
.
EditorCommand
);
const
launchEditor
=
(
_
:
CodeMirror
.
Editor
,
pos
?:
CodeMirror
.
Position
)
=>
{
async
function
launchEditor
(
_
:
CodeMirror
.
Editor
,
pos
?:
CodeMirror
.
Position
)
{
const
selectedLine
=
pos
?
(
pos
.
line
+
1
).
toString
()
:
'
1
'
;
const
selectedLine
=
pos
?
(
pos
.
line
+
1
).
toString
()
:
'
1
'
;
const
selectedChar
=
pos
?
(
pos
.
ch
+
1
).
toString
()
:
'
1
'
;
const
selectedChar
=
pos
?
(
pos
.
ch
+
1
).
toString
()
:
'
1
'
;
const
cmd
=
command
const
cmd
=
command
...
@@ -112,7 +112,21 @@ export default function SourceCode() {
...
@@ -112,7 +112,21 @@ export default function SourceCode() {
kind
:
'
error
'
,
kind
:
'
error
'
,
});
});
});
});
};
}
async
function
contextMenu
(
editor
:
CodeMirror
.
Editor
,
pos
?:
CodeMirror
.
Position
,
)
{
const
items
=
[
{
label
:
'
Open file in an external editor
'
,
onClick
:
()
=>
launchEditor
(
editor
,
pos
),
},
];
Dome
.
popupMenu
(
items
);
}
// Building the React component.
// Building the React component.
return
(
return
(
...
@@ -133,7 +147,8 @@ export default function SourceCode() {
...
@@ -133,7 +147,8 @@ export default function SourceCode() {
styleActiveLine
=
{
!!
theFunction
}
styleActiveLine
=
{
!!
theFunction
}
extraKeys
=
{
{
extraKeys
=
{
{
'
Alt-F
'
:
'
findPersistent
'
,
'
Alt-F
'
:
'
findPersistent
'
,
'
Ctrl-LeftClick
'
:
launchEditor
,
'
Ctrl-LeftClick
'
:
launchEditor
as
(
_
:
CodeMirror
.
Editor
)
=>
void
,
RightClick
:
contextMenu
as
(
_
:
CodeMirror
.
Editor
)
=>
void
,
}
}
}
}
readOnly
readOnly
/>
/>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment