Skip to content
Permalink
Browse files

libhangul-objc의 HGHanjaList 버그 수정

  • Loading branch information...
youknowone committed Dec 29, 2018
1 parent a0aa68d commit faa3209121f1e608f7bbe3ab2610534339980c39
Showing with 15 additions and 9 deletions.
  1. +1 −1 GureumTests/GureumTests.swift
  2. +1 −1 OSX/EmoticonComposer.swift
  3. +12 −6 OSX/HanjaComposer.swift
  4. +1 −1 libhangul-objc
@@ -66,7 +66,7 @@ class GureumTests: XCTestCase {
func testSearchEmoticonTable() {
let bundle: Bundle = Bundle.main
let path: String? = bundle.path(forResource: "emoji", ofType: "txt", inDirectory: "hanja")
let table: HGHanjaTable = HGHanjaTable.init(contentOfFile: path ?? "")
let table: HGHanjaTable = HGHanjaTable(contentOfFile: path!)!
let list: HGHanjaList = table.hanjas(byPrefixSearching: "hushed") ?? HGHanjaList() // 현재 5글자 이상만 가능
XCTAssert(list.count > 0)
}
@@ -11,7 +11,7 @@ import Hangul
let DEBUG_EMOTICON = false

public class EmoticonComposer: CIMComposer {
static let emoticonTable: HGHanjaTable = HGHanjaTable(contentOfFile: Bundle.main.path(forResource: "emoji", ofType: "txt", inDirectory: "hanja")!)
static let emoticonTable: HGHanjaTable = HGHanjaTable(contentOfFile: Bundle.main.path(forResource: "emoji", ofType: "txt", inDirectory: "hanja")!)!

var _candidates: [String]?
var _bufferedString: String = ""
@@ -10,12 +10,18 @@ import Hangul

let DEBUG_HANJACOMPOSER = false

extension HGHanjaList: Sequence {
public func makeIterator() -> NSFastEnumerationIterator {
return NSFastEnumerationIterator(self)
}
}

class HanjaComposer: CIMComposer {
static let characterTable: HGHanjaTable = HGHanjaTable(contentOfFile: Bundle.main.path(forResource: "hanjac", ofType: "txt", inDirectory: "hanja")!)
static let wordTable: HGHanjaTable = HGHanjaTable(contentOfFile: Bundle.main.path(forResource: "hanjaw", ofType: "txt", inDirectory: "hanja")!)
static let reversedTable: HGHanjaTable = HGHanjaTable(contentOfFile: Bundle.main.path(forResource: "hanjar", ofType: "txt", inDirectory: "hanja")!)
static let msSymbolTable: HGHanjaTable = HGHanjaTable(contentOfFile: Bundle.main.path(forResource: "mssymbol", ofType: "txt", inDirectory: "hanja")!)
static let emojiTable: HGHanjaTable = HGHanjaTable(contentOfFile: Bundle.main.path(forResource: "emoji_ko", ofType: "txt", inDirectory: "hanja")!)
static let characterTable: HGHanjaTable = HGHanjaTable(contentOfFile: Bundle.main.path(forResource: "hanjac", ofType: "txt", inDirectory: "hanja")!)!
static let wordTable: HGHanjaTable = HGHanjaTable(contentOfFile: Bundle.main.path(forResource: "hanjaw", ofType: "txt", inDirectory: "hanja")!)!
static let reversedTable: HGHanjaTable = HGHanjaTable(contentOfFile: Bundle.main.path(forResource: "hanjar", ofType: "txt", inDirectory: "hanja")!)!
static let msSymbolTable: HGHanjaTable = HGHanjaTable(contentOfFile: Bundle.main.path(forResource: "mssymbol", ofType: "txt", inDirectory: "hanja")!)!
static let emojiTable: HGHanjaTable = HGHanjaTable(contentOfFile: Bundle.main.path(forResource: "emoji_ko", ofType: "txt", inDirectory: "hanja")!)!

var _candidates: [String]?
var _bufferedString: String = ""
@@ -190,7 +196,7 @@ class HanjaComposer: CIMComposer {
guard let list: HGHanjaList = table.hanjas(byPrefixSearching: keyword) else {
return candidates
}
for _hanja in list.array {
for _hanja in list {
let hanja = _hanja as! HGHanja
dlog(DEBUG_HANJACOMPOSER, "HanjaComposer -searchCandidates hanja: %@", hanja)
if hanja.comment.isEmpty {
Submodule libhangul-objc updated 2 files
+3 −3 Hangul/HGHanja.h
+20 −40 Hangul/HGHanja.m

0 comments on commit faa3209

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