def outputToPane(name, text, erase=True):
  debug("outputToPane: name: '" + name + "' text: " + str(text))
  global statusRegion
  queueing = False
  if text is None:
    if name == "Variables":
      subProcOutputQ = variablesOutputQ
    elif name == "Lua Stack":
      subProcOutputQ = luaStackOutputQ
    else:
      subProcOutputQ = consoleOutputQ
    text = subProcOutputQ.get()
    queueing = True
  debug("outputToPane: name: '" + name + "' text: " + text)
  window = sublime.active_window()
  for view in window.views():
    # only reload view if text has changed
    if view.name() == name and view.substr(sublime.Region(0, view.size())) != text:
      view.set_read_only(False)
      # Remove the last status we output
      if statusRegion and "@@@ " in text:
          view.sel().clear()
          view.sel().add(view.full_line(statusRegion))
          view.run_command("right_delete")
          statusRegion = None
      if _corona_utils.SUBLIME_VERSION < 3000:
        edit = view.begin_edit()
        # print("name: ", name, "size: ", view.size())
        if erase:
          view.erase(edit, sublime.Region(0, view.size()))
          view.insert(edit, 0, text)
        else:
          view.insert(edit, view.size(), text)
        view.end_edit(edit)
      else:  # It's ST3
        if erase:
          view.run_command("select_all")
          view.run_command("right_delete")
        view.run_command('append', {'characters': text})

      view.set_read_only(True)
      # view.set_viewport_position((0, view.size())) # scroll to the end
      view.show(view.size(), True)  # scroll to the end, works better on Windows

      # Highlight status line and remember where it is so it can be removed later
      if "@@@ " in text:
        line = view.rowcol(view.size())[0]
        pt = view.text_point(line-1, 0)
        statusRegion = view.line(sublime.Region(pt))
        view.sel().clear()
        view.sel().add(view.line(statusRegion))
        mark = [sublime.Region(view.size() - 1, view.size())]
        if _corona_utils.SUBLIME_VERSION < 3000:
          # Path for icons is "Packages/Theme - Default/"
          view.add_regions('dbg', mark, "debugger", "../"+_corona_utils.PACKAGE_NAME+"/CoronaBP", sublime.HIDDEN)
        else:
          view.add_regions('dbg', mark, "debugger", "Packages/"+_corona_utils.PACKAGE_NAME+"/CoronaBP.png", sublime.HIDDEN)
  if queueing:
    subProcOutputQ.task_done()
dataset/ETHPy150Open coronalabs/CoronaSDK-SublimeText/debugger.py/outputToPane/original