       editor.insertText(selectedText, select: true, undo: 'skip')
       event.target.value = ''
 
-  listenForMiddleMousePaste: ->
-    clipboard = require 'clipboard'
-
-    @refs.scrollView.getDOMNode().addEventListener 'mouseup', ({which}) =>
-      return unless which is 2
-
-      if selection = clipboard.readText('selection')
-        @props.editor.insertText(selection)
-
+  # Listen for selection changes and store the currently selected text
+  # in the selection clipboard. This is only applicable on Linux.
+  trackSelectionClipboard: ->
     @subscribe @props.editor.onDidChangeSelectionRange =>
       if selectedText = @props.editor.getSelectedText()
         # This uses ipc.send instead of clipboard.writeText because

      # Stop dragging when cursor enters dev tools because we can't detect mouseup
      onMouseUp() if event.which is 0

    onMouseUp = ->
      stopDragging()
      editor.finalizeSelections()

    stopDragging = ->
      dragging = false
      window.removeEventListener('mousemove', onMouseMove)
      window.removeEventListener('mouseup', onMouseUp)

    window.addEventListener('mousemove', onMouseMove)
    window.addEventListener('mouseup', onMouseUp)

    window.addEventListener 'resize', @requestHeightAndWidthMeasurement

    @listenForIMEEvents()
    @trackSelectionClipboard() if process.platform is 'linux'

  listenForIMEEvents: ->
    node = @getDOMNode()
