       textarea.setOption 'vimMode', $("#vimmode").is(":checked")
 
 possiblyUpdate = ->
-  return if code == textarea.getValue()
+  if code != textarea.getValue()
+    diskOutdated = true
+    renderOutdated = true
+  code = textarea.getValue()
 
-  code = textarea.getValue()
-  dirty = true
+  return if !renderOutdated
 
   md = markdown(code)
   outputarea.find('.output').html(md)

))()

load = ->
  if dirty
    if !window.confirm('Are you sure you want to load a new file without' +
                       'saving this one first?')
      return

    if reader.result == undefined
      console.log('file contents are undefined')
      return

    # Populate the text field with the new source code
    code = reader.result
    textarea.setValue(reader.result)
    diskOutdated = false
    renderOutdated = true

  reader.readAsText(file)

save = ->
