Skip to content
Permalink
Browse files

Fix deactivation crash

  • Loading branch information...
youknowone committed May 27, 2019
1 parent ad18c8d commit 28d4d1e1f0aee6788b36ea8423e027d5d32f3a42
Showing with 6 additions and 6 deletions.
  1. +5 −5 OSXCore/InputController.swift
  2. +1 −1 OSXTestApp/TestViewController.swift
@@ -186,15 +186,15 @@ public extension InputController { // IMKStateSetting

override func activateServer(_ sender: Any!) {
dlog(true, "server activated")
let client = asClient(sender)
super.activateServer(client)
super.activateServer(sender)
}

override func deactivateServer(_ sender: Any!) {
dlog(true, "server deactivating")
commitComposition(sender)
let client = asClient(sender)
super.deactivateServer(client)
if responds(to: #selector(commitComposition(_:))) {
self.commitComposition(sender)
}
super.deactivateServer(sender)
}
}

@@ -42,7 +42,7 @@ class TestViewController: NSViewController {
}
let selected = self.inputClient.selectedRange()
let marked = self.inputClient.markedRange()
if event.keyCode == kVK_Delete, (selected.length > 0 && selected != marked) {
if event.keyCode == kVK_Delete, selected.length > 0, selected != marked {
self.inputController.cancelComposition()
self.inputClient.insertText("", replacementRange: selected)
self.inputClient.setMarkedText("", selectionRange: NSRange(location: 0, length: 0), replacementRange: NSRange(location: selected.location, length: 0))

0 comments on commit 28d4d1e

Please sign in to comment.
You can’t perform that action at this time.