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
e4ee3276
Commit
e4ee3276
authored
4 years ago
by
Loïc Correnson
Committed by
Michele Alberti
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[ivette] fix delete last history item
parent
785e2f14
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/renderer/Controller.tsx
+13
-12
13 additions, 12 deletions
ivette/src/renderer/Controller.tsx
with
13 additions
and
12 deletions
ivette/src/renderer/Controller.tsx
+
13
−
12
View file @
e4ee3276
...
@@ -155,9 +155,7 @@ const RenderConsole = () => {
...
@@ -155,9 +155,7 @@ const RenderConsole = () => {
const
[
cursor
,
setCursor
]
=
React
.
useState
(
-
1
);
const
[
cursor
,
setCursor
]
=
React
.
useState
(
-
1
);
const
[
H0
,
setH0
]
=
Dome
.
useState
(
'
Controller.history
'
,
[]);
const
[
H0
,
setH0
]
=
Dome
.
useState
(
'
Controller.history
'
,
[]);
const
[
isEmpty
,
setEmpty
]
=
React
.
useState
(
true
);
const
[
isEmpty
,
setEmpty
]
=
React
.
useState
(
true
);
Dome
.
useEmitter
(
editor
,
'
change
'
,
()
=>
{
const
[
noTrash
,
setNoTrash
]
=
React
.
useState
(
true
);
setEmpty
(
editor
.
getValue
().
trim
()
===
''
);
});
// Cope with merge settings that keeps previous array entries (BUG in DOME)
// Cope with merge settings that keeps previous array entries (BUG in DOME)
const
history
=
Array
.
isArray
(
H0
)
?
H0
.
filter
((
h
)
=>
h
!==
''
)
:
[];
const
history
=
Array
.
isArray
(
H0
)
?
H0
.
filter
((
h
)
=>
h
!==
''
)
:
[];
...
@@ -166,6 +164,12 @@ const RenderConsole = () => {
...
@@ -166,6 +164,12 @@ const RenderConsole = () => {
setH0
(
n
<
50
?
hs
.
concat
(
Array
(
50
-
n
).
fill
(
''
))
:
hs
);
setH0
(
n
<
50
?
hs
.
concat
(
Array
(
50
-
n
).
fill
(
''
))
:
hs
);
};
};
Dome
.
useEmitter
(
editor
,
'
change
'
,
()
=>
{
const
cmd
=
editor
.
getValue
().
trim
();
setEmpty
(
cmd
===
''
);
setNoTrash
(
cursor
===
0
&&
history
.
length
===
1
&&
cmd
===
history
[
0
]);
});
const
doReload
=
()
=>
{
const
doReload
=
()
=>
{
const
cfg
=
Server
.
getConfig
();
const
cfg
=
Server
.
getConfig
();
const
hst
=
insertConfig
(
history
,
cfg
);
const
hst
=
insertConfig
(
history
,
cfg
);
...
@@ -210,7 +214,8 @@ const RenderConsole = () => {
...
@@ -210,7 +214,8 @@ const RenderConsole = () => {
const
doRemove
=
()
=>
{
const
doRemove
=
()
=>
{
const
n
=
history
.
length
;
const
n
=
history
.
length
;
if
(
n
>
1
)
{
if
(
n
<=
1
)
doReload
();
else
{
const
hst
=
history
.
slice
();
const
hst
=
history
.
slice
();
const
pad
=
scratch
.
current
;
const
pad
=
scratch
.
current
;
hst
.
splice
(
cursor
,
1
);
hst
.
splice
(
cursor
,
1
);
...
@@ -219,11 +224,6 @@ const RenderConsole = () => {
...
@@ -219,11 +224,6 @@ const RenderConsole = () => {
const
next
=
cursor
>
0
?
cursor
-
1
:
0
;
const
next
=
cursor
>
0
?
cursor
-
1
:
0
;
editor
.
setValue
(
pad
[
next
]);
editor
.
setValue
(
pad
[
next
]);
setCursor
(
next
);
setCursor
(
next
);
}
else
{
// Do not share the two arrays!
setHistory
([
''
]);
scratch
.
current
=
[
''
];
editor
.
clear
();
}
}
};
};
...
@@ -235,7 +235,7 @@ const RenderConsole = () => {
...
@@ -235,7 +235,7 @@ const RenderConsole = () => {
let
LABEL
:
string
|
JSX
.
Element
=
'
Console
'
;
let
LABEL
:
string
|
JSX
.
Element
=
'
Console
'
;
if
(
edited
)
{
if
(
edited
)
{
LABEL
=
(
LABEL
=
(
<
Label
title
=
"
Rank in history
"
>
<
Label
title
=
"
History (last command comes first)
"
>
Command
Command
<
span
className
=
"controller-rank"
>
<
span
className
=
"controller-rank"
>
{
1
+
cursor
}
/
{
n
}
{
1
+
cursor
}
/
{
n
}
...
@@ -249,15 +249,16 @@ const RenderConsole = () => {
...
@@ -249,15 +249,16 @@ const RenderConsole = () => {
<
IconButton
<
IconButton
icon
=
"TRASH"
icon
=
"TRASH"
display
=
{
edited
}
display
=
{
edited
}
disabled
=
{
noTrash
}
onClick
=
{
doRemove
}
onClick
=
{
doRemove
}
title
=
"Discard command from
H
istory"
title
=
"Discard command from
h
istory
(irreversible)
"
/>
/>
<
Space
/>
<
Space
/>
<
IconButton
<
IconButton
icon
=
"RELOAD"
icon
=
"RELOAD"
display
=
{
edited
}
display
=
{
edited
}
onClick
=
{
doReload
}
onClick
=
{
doReload
}
title
=
"Discard
edited command
s"
title
=
"Discard
change
s"
/>
/>
<
IconButton
<
IconButton
icon
=
"MEDIA.PREV"
icon
=
"MEDIA.PREV"
...
...
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