   @redrawMain(); @redrawTextInput()
 
 Editor::populateSocket = (socket, string) ->
-  lines = string.split '\n'
-
-  unless socket.start.next is socket.end
-    @spliceOut new model.List socket.start.next, socket.end.prev
-
-  first = last = new model.TextToken lines[0]
-  for line, i in lines when line > 0
-    last = helper.connect new model.NewlineToken(), last
-    last = helper.connect last, new model.TextToken line
-
-  @spliceIn (new model.List(first, last)), socket.start
+  unless socket.stringify() is string
+    lines = string.split '\n'
+
+    unless socket.start.next is socket.end
+      @spliceOut new model.List socket.start.next, socket.end.prev
+
+    first = last = new model.TextToken lines[0]
+    for line, i in lines when i > 0
+      last = helper.connect new model.NewlineToken(), last
+      last = helper.connect last, new model.TextToken line
+
+    @spliceIn (new model.List(first, last)), socket.start
 
 # Convenience hit-testing function
 Editor::hitTestTextInput = (point, block) ->

    next = head.prev
    head.remove()
    head = next

# Now we hook to ctrl-z to undo.
hook 'keydown', 0, (event, state) ->

  @dropletElement.focus()
  window.scrollTo(x, y)

Editor::removeBlankLines = ->
  # If we have blank lines at the end,
  # get rid of them
