def toggle_breakpoint(self, filename, lineno, toggle=True):
    global coronaBreakpointsSettings
    global coronaBreakpoints
    result = True

    if coronaBreakpointsSettings is None:
      coronaBreakpointsSettings = sublime.load_settings(_corona_utils.PACKAGE_NAME + ".breakpoints")

    bpId = self.new_breakpoint_id(filename, lineno)
    debug("bpId: " + bpId)
    if filename not in coronaBreakpoints:
      coronaBreakpoints[filename] = []
    if lineno in coronaBreakpoints[filename] and toggle:
      # we're unsetting the breakpoint
      debug("toggle_breakpoint: unsetting breakpoint")
      coronaBreakpoints[filename].remove(lineno)
      view = self.view_for_file(filename)
      if view is not None:
        view.erase_regions(bpId)
      result = False
    else:
      debug("toggle_breakpoint: setting breakpoint in '"+filename+"' at "+str(lineno) )
      if lineno not in coronaBreakpoints[filename]:
        coronaBreakpoints[filename].append(int(lineno))
      view = self.view_for_file(filename)
      if view is not None:
        mark = [view.line(view.text_point(lineno - 1, 0))]
        if _corona_utils.SUBLIME_VERSION < 3000:
          # Path for icons is "Packages/Theme - Default/"
          view.add_regions(bpId, mark, "breakpoint", "../"+_corona_utils.PACKAGE_NAME+"/CoronaBP", sublime.HIDDEN)
        else:
          view.add_regions(bpId, mark, "breakpoint", "Packages/"+_corona_utils.PACKAGE_NAME+"/CoronaBP.png", sublime.HIDDEN)
      result = True

    # Save the breakpoints for posterity
    debug("coronaBreakpoints: " + str(coronaBreakpoints))
    coronaBreakpointsSettings.set("breakpoints", coronaBreakpoints)
    sublime.save_settings(_corona_utils.PACKAGE_NAME + ".breakpoints")

    return result
dataset/ETHPy150Open coronalabs/CoronaSDK-SublimeText/debugger.py/CoronaDebuggerCommand.toggle_breakpoint/original