   onbeforeunload: -> # called when the user presses [X] on the OS window
     if @ide.dead
       D.forceCloseNWWindow?(); return
-    else if @cm.getValue() == @otext && @bp.join() == @obp
+    else if @cm.getValue() == @otext && '' + @getBreakpoints() == '' + @obp
       @EP(); return
     else if !@dialog
       window.focus()

  createBreakpointElement: ->
    bp = @$e[0].ownerDocument.createElement 'div'; bp.setAttribute 'class', 'breakpoint'; bp.innerHTML = '●'; bp

  cursorActivity: ->
    if @xline != null
      n = @cm.lineCount(); l = @cm.getCursor().line

  CBP: -> @emit 'Cutback',       win: @id; return
  BP: -> # Toggle breakpoint
    for sel in @cm.listSelections()
      p0 = sel.anchor; p1 = sel.head; if p0.line > p1.line then [p0, p1] = [p1, p0]
      l0 = p0.line; l1 = p1.line; if l0 < l1 && !p1.ch then l1--
      for l in [l0..l1] by 1
        @cm.setGutterMarker l, 'breakpoints',
          if !@cm.getLineHandle(l).gutterMarkers?.breakpoints then @createBreakpointElement() else null
    @isTracer && @emit 'SetLineAttributes', win: @id, nLines: @cm.lineCount(), lineAttributes: stop: @getBreakpoints()
    return
  RD: (cm) ->
    if cm.somethingSelected()
