           cm.replaceRange s, {line: l, ch: 0}, {line: l, ch: cm.getLine(l).length}, 'D'
       return
     LN: -> # Toggle Line Numbers
-      v = !!if opts.debugger then prefs.lineNumbersInDebugger.toggle() else prefs.lineNumbersInEditor.toggle()
+      v = !!if isDebugger then prefs.lineNumbersInDebugger.toggle() else prefs.lineNumbersInEditor.toggle()
       cm.setOption 'lineNumbers', v; $tb.find('.tb-LN:visible').toggleClass 'pressed', v; return
     PV: -> search true; return # Previous
     NX: -> search(); return # Next

    return

  setDebugger = (x) ->
    opts.debugger = x; $('.debugger-toolbar', $e).toggle x; $('.editor-toolbar', $e).toggle !x
    cm.setOption 'readOnly', x; $('.CodeMirror', $e).toggleClass 'debugger', x; highlight null
    ln = !!if opts.debugger then prefs.lineNumbersInDebugger() else prefs.lineNumbersInEditor()
    cm.setOption 'lineNumbers', ln; $tb.find('.tb-LN:visible').toggleClass 'pressed', ln; return
  setDebugger !!opts.debugger

  scrollCursorIntoProminentView = -> # approximately to 1/3 of editor height; this might not work near the top or bottom
    h = $e.height(); {left, top} = cm.cursorCoords true, 'local'

        cm.setCursor line: l, ch: 0
      return
    WI: opts.weakInterrupt
    ER: -> (if isDebugger then emit 'RunCurrentLine', win: id else cm.execCommand 'newlineAndIndent'); return
    BH: -> emit 'ContinueTrace',  win: id; return # Run to exit (in tracer)
    RM: -> emit 'Continue',       win: id; return # Resume execution (in tracer)
    MA: -> emit 'RestartThreads', win: id; return # Resume all threads (in tracer)
