         value.text += '\n'
     register.text += value.text
 
-  reset: ->
-    @name = null
-    @updateEditorElement()
-
   getName: ->
     @name ? settings.get('defaultRegister')
 


class RegisterManager
  constructor: (@vimState) ->
    @subscriptions = new CompositeDisposable
    {@editor, @editorElement} = @vimState
    @data = globalState.register
    @clipboardBySelection = new Map

  isValid: (name) ->
    REGISTERS.test(name)

  cleanup: (editor) ->
    # If selection length is different OR all all selection is identical
    # We clear perSelectionClipboard
    selections = editor.getSelections()
    if (@clipboardBySelection.size isnt selections.length) or
      selections.some((selection) => not @clipboardBySelection.has(selection))
        @clipboardBySelection.clear()

  getText: (name, selection) ->
    @get(name, selection).text ? ''

  readClipboard: (selection=null) ->
    if selection?
      text = @clipboardBySelection.get(selection)
    text ? atom.clipboard.read()

  writeClipboard: (selection=null, text) ->
    if not selection? or selection.isLastSelection()
      atom.clipboard.write(text)
    @clipboardBySelection.set(selection, text) if selection?

  get: (name, selection) ->
    @cleanup(selection.editor) if selection?
    name ?= @getName()
    name = settings.get('defaultRegister') if name is '"'


      when 2 then [name, value] = args

    name ?= @getName()
    return unless @isValidName(name)
    name = settings.get('defaultRegister') if name is '"'
    value.type ?= @getCopyType(value.text)

