     return underscored;
 }
 
-class EditView: NSView {
+class EditView: NSView, NSTextInputClient {
     var tabName: String?
     var coreConnection: CoreConnection?
 

        // store current event so that it can be sent to the core
        // if the selector for the event is "noop:".
        currentEvent = theEvent;
        self.interpretKeyEvents([theEvent]);
        currentEvent = nil;
    }

    override func insertText(insertString: AnyObject) {
        sendRpcAsync("insert", params: insertedStringToJson(insertString as! NSString))
    }

    override func doCommandBySelector(aSelector: Selector) {
        if (self.respondsToSelector(aSelector)) {
            super.doCommandBySelector(aSelector);

    var pendingUpdate: [String: AnyObject]? = nil

    var currentEvent: NSEvent?
    
    var _selectedRange: NSRange
    var _markedRange: NSRange

    override init(frame frameRect: NSRect) {
        let font = CTFontCreateWithName("InconsolataGo", 14, nil)
