Hide insertion point in shortcut key field

This commit is contained in:
1024jp 2018-02-17 19:22:46 +09:00
parent addd5be598
commit a5f7ded0da
2 changed files with 8 additions and 1 deletions

View File

@ -8,8 +8,9 @@ unreleased
### Improvements
- Display an open dialog on launch if so set even when iCloud storage is disabled.
- Improve stability on text encoding change
- Improve stability on text encoding change.
- Refine dialog messages on text encoding change.
- [trivial] Hide insertion point in shortcut input fields in Key Binding pane.
### Fixes

View File

@ -44,6 +44,9 @@ final class ShortcutKeyField: NSTextField {
guard super.becomeFirstResponder() else { return false }
// hide insertion point
(self.currentEditor() as? NSTextView)?.insertionPointColor = .textBackgroundColor
self.keyDownMonitor = NSEvent.addLocalMonitorForEvents(matching: .keyDown, handler: { [weak self] (event: NSEvent) -> NSEvent? in
guard
@ -90,6 +93,9 @@ final class ShortcutKeyField: NSTextField {
/// end editing
override func textDidEndEditing(_ notification: Notification) {
// restore insertion point
(self.currentEditor() as? NSTextView)?.insertionPointColor = .controlTextColor
// end monitoring key down event
if let monitor = self.keyDownMonitor {
NSEvent.removeMonitor(monitor)