Pref // Bind Options to User Data LMs.

This commit is contained in:
ShikiSuen 2022-01-29 18:43:23 +08:00
parent 47031715b0
commit e68d02833d
3 changed files with 15 additions and 4 deletions

View File

@ -15,6 +15,7 @@
#include "KeyValueBlobReader.h"
#include "PhraseReplacementMap.h"
#include "LMConsolidator.h"
#include "vChewing-Swift.h"
namespace vChewing {
@ -39,9 +40,14 @@ bool PhraseReplacementMap::open(const char *path)
if (data) {
return false;
}
LMConsolidator::FixEOF(path);
LMConsolidator::ConsolidateContent(path, false);
if (Preferences.shouldAutoSortPhraseReplacementMapOnLoad) {
LMConsolidator::ConsolidateContent(path, true);
} else {
LMConsolidator::ConsolidateContent(path, false);
}
fd = ::open(path, O_RDONLY);
if (fd == -1) {

View File

@ -15,6 +15,7 @@
#include <syslog.h>
#include "LMConsolidator.h"
#include "KeyValueBlobReader.h"
#include "vChewing-Swift.h"
namespace vChewing {
@ -39,7 +40,12 @@ bool UserPhrasesLM::open(const char *path)
}
LMConsolidator::FixEOF(path);
LMConsolidator::ConsolidateContent(path, false);
if (Preferences.ShouldAutoSortUserPhrasesAndExclListOnLoad) {
LMConsolidator::ConsolidateContent(path, true);
} else {
LMConsolidator::ConsolidateContent(path, false);
}
fd = ::open(path, O_RDONLY);
if (fd == -1) {

View File

@ -7,7 +7,6 @@
*/
#import "InputMethodController.h"
#include <objc/objc.h>
#import <fstream>
#import <iostream>
#import <set>