mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-04 17:19:47 -04:00
Merge pull request #523 from dkundel/master
Avoid flickering of editor when executing the script.
This commit is contained in:
commit
40ea643f67
1 changed files with 13 additions and 5 deletions
|
@ -430,6 +430,7 @@ module.exports = class SpellView extends View
|
|||
flow ?= @spellThang?.castAether?.flow
|
||||
return unless flow
|
||||
executed = []
|
||||
executedRows = {}
|
||||
matched = false
|
||||
states = flow.states ? []
|
||||
currentCallIndex = null
|
||||
|
@ -445,20 +446,24 @@ module.exports = class SpellView extends View
|
|||
matched = true
|
||||
break
|
||||
_.last(executed).push state
|
||||
executedRows[state.range[0].row] = true
|
||||
#state.executing = true if state.userInfo?.time is @thang.world.age # no work
|
||||
currentCallIndex ?= callNumber - 1
|
||||
#console.log "got call index", currentCallIndex, "for time", @thang.world.age, "out of", states.length
|
||||
|
||||
@decoratedGutter = @decoratedGutter || {}
|
||||
|
||||
# TODO: don't redo the markers if they haven't actually changed
|
||||
for markerRange in (@markerRanges ?= [])
|
||||
markerRange.start.detach()
|
||||
markerRange.end.detach()
|
||||
@aceSession.removeMarker markerRange.id
|
||||
@markerRanges = []
|
||||
@aceSession.removeGutterDecoration row, 'executing' for row in [0 ... @aceSession.getLength()]
|
||||
@aceSession.removeGutterDecoration row, 'executed' for row in [0 ... @aceSession.getLength()]
|
||||
$(@ace.container).find('.ace_gutter-cell.executing').removeClass('executing')
|
||||
$(@ace.container).find('.ace_gutter-cell.executed').removeClass('executed')
|
||||
for row in [0 ... @aceSession.getLength()]
|
||||
unless executedRows[row]
|
||||
@aceSession.removeGutterDecoration row, 'executing'
|
||||
@aceSession.removeGutterDecoration row, 'executed'
|
||||
@decoratedGutter[row] = ''
|
||||
if not executed.length or (@spell.name is "plan" and @spellThang.castAether.metrics.statementsExecuted < 20)
|
||||
@toolbarView?.toggleFlow false
|
||||
@debugView.setVariableStates {}
|
||||
|
@ -486,7 +491,10 @@ module.exports = class SpellView extends View
|
|||
markerRange.end = @aceDoc.createAnchor markerRange.end
|
||||
markerRange.id = @aceSession.addMarker markerRange, clazz, markerType
|
||||
@markerRanges.push markerRange
|
||||
@aceSession.addGutterDecoration start.row, clazz
|
||||
if executedRows[start.row] and @decoratedGutter[start.row] isnt clazz
|
||||
@aceSession.removeGutterDecoration start.row, @decoratedGutter[start.row] if @decoratedGutter[start.row] isnt ''
|
||||
@aceSession.addGutterDecoration start.row, clazz
|
||||
@decoratedGutter[start.row] = clazz
|
||||
@debugView.setVariableStates {} unless gotVariableStates
|
||||
null
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue