Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
appinventor-sources
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
appinventor-sources
Commits
9b4ae78e
Commit
9b4ae78e
authored
May 13, 2019
by
Evan W. Patton
Committed by
Jeffrey Schiller
May 20, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix warning counter going to -1
Change-Id: If0ed5ffc8c8fbb4cc4306f6de2949ca733e0f482
parent
d3f9111d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
9 deletions
+30
-9
appinventor/blocklyeditor/src/warningHandler.js
appinventor/blocklyeditor/src/warningHandler.js
+25
-7
appinventor/blocklyeditor/src/warningIndicator.js
appinventor/blocklyeditor/src/warningIndicator.js
+5
-2
No files found.
appinventor/blocklyeditor/src/warningHandler.js
View file @
9b4ae78e
...
...
@@ -32,8 +32,22 @@ Blockly.WarningHandler.WarningState = {
WARNING
:
1
,
ERROR
:
2
};
Blockly
.
WarningHandler
.
prototype
.
currentWarning
=
0
;
Blockly
.
WarningHandler
.
prototype
.
currentError
=
0
;
/**
* The currently selected index into the array of block IDs with warnings. If nothing has been
* selected (i.e., if we are not stepping through warnings), this should be -1 so that the next
* index will be 0.
* @type {number}
*/
Blockly
.
WarningHandler
.
prototype
.
currentWarning
=
-
1
;
/**
* The currently selected index into the array of block IDs with errors. If nothing has been
* selected (i.e., if we are not stepping through errors), this should be -1 so that the next
* index will be 0.
* @type {number}
*/
Blockly
.
WarningHandler
.
prototype
.
currentError
=
-
1
;
Blockly
.
WarningHandler
.
prototype
.
updateWarningErrorCount
=
function
()
{
//update the error and warning count in the UI
...
...
@@ -49,7 +63,7 @@ Blockly.WarningHandler.prototype.updateCurrentWarningAndError = function() {
var
indicator
=
this
.
workspace
.
getWarningIndicator
();
if
(
indicator
)
{
// indicator is only available after the workspace has been drawn.
indicator
.
updateCurrentWarningAndError
(
this
.
currentWarning
,
this
.
currentError
)
indicator
.
updateCurrentWarningAndError
(
this
.
currentWarning
,
this
.
currentError
)
;
}
};
...
...
@@ -122,7 +136,8 @@ Blockly.WarningHandler.prototype.checkAllBlocksForWarningsAndErrors = function()
Blockly
.
WarningHandler
.
prototype
.
previousWarning
=
function
()
{
var
k
=
Object
.
keys
(
this
.
warningIdHash
);
if
(
this
.
currentWarning
<
k
.
length
)
if
(
k
.
length
===
0
)
return
;
// nothing to see here.
if
(
0
<=
this
.
currentWarning
&&
this
.
currentWarning
<
k
.
length
)
this
.
workspace
.
getBlockById
(
k
[
this
.
currentWarning
]).
setHighlighted
(
false
);
if
(
this
.
currentWarning
>
0
)
{
this
.
currentWarning
--
;
...
...
@@ -134,7 +149,8 @@ Blockly.WarningHandler.prototype.previousWarning = function() {
Blockly
.
WarningHandler
.
prototype
.
nextWarning
=
function
()
{
var
k
=
Object
.
keys
(
this
.
warningIdHash
);
if
(
this
.
currentWarning
<
k
.
length
)
if
(
k
.
length
===
0
)
return
;
// nothing to see here.
if
(
0
<=
this
.
currentWarning
&&
this
.
currentWarning
<
k
.
length
)
this
.
workspace
.
getBlockById
(
k
[
this
.
currentWarning
]).
setHighlighted
(
false
);
if
(
this
.
currentWarning
<
k
.
length
-
1
)
{
this
.
currentWarning
++
;
...
...
@@ -147,7 +163,8 @@ Blockly.WarningHandler.prototype.nextWarning = function() {
Blockly
.
WarningHandler
.
prototype
.
previousError
=
function
()
{
var
k
=
Object
.
keys
(
this
.
errorIdHash
);
if
(
this
.
currentError
<
k
.
length
)
if
(
k
.
length
===
0
)
return
;
// nothing to see here.
if
(
0
<=
this
.
currentError
&&
this
.
currentError
<
k
.
length
)
this
.
workspace
.
getBlockById
(
k
[
this
.
currentError
]).
setHighlighted
(
false
);
if
(
k
.
length
>
0
)
{
if
(
this
.
currentError
>
0
)
{
...
...
@@ -161,7 +178,8 @@ Blockly.WarningHandler.prototype.previousError = function() {
Blockly
.
WarningHandler
.
prototype
.
nextError
=
function
()
{
var
k
=
Object
.
keys
(
this
.
errorIdHash
);
if
(
this
.
currentError
<
k
.
length
)
if
(
k
.
length
===
0
)
return
;
// nothing to see here.
if
(
0
<=
this
.
currentError
&&
this
.
currentError
<
k
.
length
)
this
.
workspace
.
getBlockById
(
k
[
this
.
currentError
]).
setHighlighted
(
false
);
if
(
k
.
length
>
0
)
{
if
(
this
.
currentError
<
k
.
length
-
1
)
{
...
...
appinventor/blocklyeditor/src/warningIndicator.js
View file @
9b4ae78e
...
...
@@ -233,8 +233,11 @@ Blockly.WarningIndicator.prototype.updateWarningAndErrorCount = function() {
}
Blockly
.
WarningIndicator
.
prototype
.
updateCurrentWarningAndError
=
function
(
currentWarning
,
currentError
)
{
this
.
errorCount_
.
textContent
=
currentError
+
"
/
"
+
this
.
workspace_
.
getWarningHandler
().
errorCount
;
this
.
warningCount_
.
textContent
=
currentWarning
+
"
/
"
+
this
.
workspace_
.
getWarningHandler
().
warningCount
;
var
handler
=
this
.
workspace_
.
getWarningHandler
();
currentError
++
;
// make it 1-based
currentWarning
++
;
// make it 1-based
this
.
errorCount_
.
textContent
=
currentError
+
"
/
"
+
handler
.
errorCount
;
this
.
warningCount_
.
textContent
=
currentWarning
+
"
/
"
+
handler
.
warningCount
;
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment