     #{TOC_END}
     """
 
-  toc += "\n\n" if create
+  toc += "\n\n" if range.isEmpty()
   editor.setTextInBufferRange(range, toc)
 
 # Public

getDefaultTocOptions = ->
  settings.getTocOptions()

insertToc = ({editor, range, create, tocOptions}) ->
  return unless create or tocOptions.update
  headers = scanHeaders(editor)
  toc = """
    <!-- TOC START #{serializeTocOptions(tocOptions)} -->

  insertToc(
    editor: editor
    range: [point, point]
    tocOptions: getDefaultTocOptions()
  )

