Skip to content
Permalink
Browse files

Preserve original string for system keyboard

  • Loading branch information
yous committed Nov 23, 2019
1 parent 4347978 commit 6d2bcd344dc0e972bd73fa674bba734165a5ede9
Showing with 10 additions and 13 deletions.
  1. +4 −4 OSXCore/HangulComposer.swift
  2. +0 −8 OSXCore/InputReceiver.swift
  3. +6 −1 OSXCore/RomanComposer.swift
@@ -201,10 +201,10 @@ final class HangulComposer: NSObject, Composer {

var string = string!
// 한글 입력에서 캡스락 무시
if flags.contains(.capsLock) {
if !flags.contains(.shift) {
string = string.lowercased()
}
if flags.contains(.shift) {
string = KeyMapUpper[keyCode.rawValue] ?? string
} else {
string = KeyMapLower[keyCode.rawValue] ?? string
}
let handled = inputContext.process(string.unicodeScalars.first!.value)
let ucsString = inputContext.commitUCSString
@@ -49,14 +49,6 @@ public class InputReceiver: InputTextDelegate {
default:
assert(false)
}
} else {
if keyCode.isKeyMappable {
if flags.contains(.shift) {
string = KeyMapUpper[keyCode.rawValue] ?? string
} else {
string = KeyMapLower[keyCode.rawValue] ?? string
}
}
}

// 특정 애플리케이션에서 커맨드/옵션/컨트롤 키 입력을 선점하지 못하는 문제를 회피한다
@@ -101,7 +101,12 @@ final class RomanComposer: Composer {
return .notProcessed
}

let character = string.first!
let character: Character
if flags.contains(.shift) {
character = KeyMapUpper[keyCode.rawValue]?.first ?? string.first!
} else {
character = KeyMapLower[keyCode.rawValue]?.first ?? string.first!
}
let newCharacter: Character = {
if flags.contains(.capsLock), character.isLowercaseCharacter {
return Character(UnicodeScalar(String(character).unicodeScalars.first!.value - 0x20)!)

0 comments on commit 6d2bcd3

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