-{Range} = require 'atom'
+{CompositeDisposable, Range} = require 'atom'
 {log} = require './logger'
 Keymap = require './input-method/keymap'
 

            startPosition = @editor.getCursorBufferPosition()
            @textBufferMarker = @editor.markBufferRange(new Range startPosition, startPosition)
            @textBufferMarker.onDidChange @dispatchEvent

            # atom.commands.add 'atom-text-editor[data-grammar="source agda"]', 'core:move-up', (ev) ->
                # console.log 'up'
                # console.log ev.stopImmediatePropagation?()

            # decoration
            @decoration = @editor.decorateMarker @textBufferMarker,

    activated: false
    mute: false

    subscriptions: null
    # raw characters
    rawInput: ''
    # visual marker
    textBufferMarker: null

    constructor: (@core) ->

        # intercept newline `\n` as confirm
        commands =
            'editor:newline': (ev) =>
                if @activated
                    @deactivate()
                    ev.stopImmediatePropagation()

        @subscriptions = new CompositeDisposable
        @subscriptions.add atom.commands.add 'atom-text-editor.agda-mode-input-method-activated', commands

    destroy: ->
        @subscriptions.destroy()

    activate: ->
        if not @activated

