           lastRight: @view.opts.textPadding
 
       else if @model.type is 'text' and parenttype is 'block'
+        if @model.prev?.type is 'newline' and @model.next?.type in ['newline', 'indentStart'] or @model.prev?.prev?.type is 'indentEnd'
+          textPadding = 0
+        else
+          textPadding = padding
         @margins =
-          top: padding
+          top: textPadding
           bottom: padding
 
           firstLeft: left

        if @lineChildren[line].length is 0
          # Socket should be shorter than other blocks
          if @model.type is 'socket'
            @minDistanceToBase[line].above = @view.opts.textHeight * @view.opts.textPadding
            @minDistanceToBase[line].above = @view.opts.textPadding

          # Other empty lines should be the height of a normal block.
          else
            @minDistanceToBase[line].above = @view.opts.textHeight + @view.opts.padding
            @minDistanceToBase[line].below = @view.opts.padding

  )

  path = path.filter((x, i) ->
    not draw._collinear(path[(i - 1) %% path.length], x, path[(i + 1) %% path.length])
  )

  return path
