Gramambular // Fix an upstream bug preventing arrow behavior like Hanin.
- We also found another issue but plan to fix it in a later release.
This commit is contained in:
parent
3c86f16967
commit
6e2eb0ea96
|
@ -555,6 +555,8 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot";
|
||||||
|
|
||||||
- (void)dealWithOverrideModelSuggestions
|
- (void)dealWithOverrideModelSuggestions
|
||||||
{
|
{
|
||||||
|
// 讓 grid 知道目前的游標候選字判定是前置還是後置
|
||||||
|
_builder->grid().setHaninInputEnabled(!mgrPrefs.selectPhraseAfterCursorAsCandidate);
|
||||||
// 這一整段都太 C++ 且只出現一次,就整個端過來了。
|
// 這一整段都太 C++ 且只出現一次,就整個端過來了。
|
||||||
// 拆開封裝的話,只會把問題搞得更麻煩而已。
|
// 拆開封裝的話,只會把問題搞得更麻煩而已。
|
||||||
std::string overrideValue = (mgrPrefs.useSCPCTypingMode)
|
std::string overrideValue = (mgrPrefs.useSCPCTypingMode)
|
||||||
|
@ -599,6 +601,9 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot";
|
||||||
|
|
||||||
- (NSArray<NSString *> *)getCandidatesArray
|
- (NSArray<NSString *> *)getCandidatesArray
|
||||||
{
|
{
|
||||||
|
// 讓 grid 知道目前的游標候選字判定是前置還是後置
|
||||||
|
_builder->grid().setHaninInputEnabled(!mgrPrefs.selectPhraseAfterCursorAsCandidate);
|
||||||
|
|
||||||
NSMutableArray<NSString *> *candidatesArray = [[NSMutableArray alloc] init];
|
NSMutableArray<NSString *> *candidatesArray = [[NSMutableArray alloc] init];
|
||||||
|
|
||||||
NSInteger cursorIndex = [self getActualCandidateCursorIndex];
|
NSInteger cursorIndex = [self getActualCandidateCursorIndex];
|
||||||
|
|
|
@ -44,6 +44,9 @@ class Grid
|
||||||
void insertNode(const Node &node, size_t location, size_t spanningLength);
|
void insertNode(const Node &node, size_t location, size_t spanningLength);
|
||||||
bool hasNodeAtLocationSpanningLengthMatchingKey(size_t location, size_t spanningLength, const std::string &key);
|
bool hasNodeAtLocationSpanningLengthMatchingKey(size_t location, size_t spanningLength, const std::string &key);
|
||||||
|
|
||||||
|
void setHaninInputEnabled(bool enabled);
|
||||||
|
bool HaninInputEnabled();
|
||||||
|
|
||||||
void expandGridByOneAtLocation(size_t location);
|
void expandGridByOneAtLocation(size_t location);
|
||||||
void shrinkGridByOneAtLocation(size_t location);
|
void shrinkGridByOneAtLocation(size_t location);
|
||||||
|
|
||||||
|
@ -116,8 +119,19 @@ class Grid
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::vector<Span> m_spans;
|
std::vector<Span> m_spans;
|
||||||
|
bool m_bolHaninEnabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline void Grid::setHaninInputEnabled(bool enabled)
|
||||||
|
{
|
||||||
|
m_bolHaninEnabled = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool Grid::HaninInputEnabled()
|
||||||
|
{
|
||||||
|
return m_bolHaninEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
inline void Grid::clear()
|
inline void Grid::clear()
|
||||||
{
|
{
|
||||||
m_spans.clear();
|
m_spans.clear();
|
||||||
|
@ -234,7 +248,9 @@ inline std::vector<NodeAnchor> Grid::nodesCrossingOrEndingAt(size_t location)
|
||||||
{
|
{
|
||||||
for (size_t j = 1, m = span.maximumLength(); j <= m; j++)
|
for (size_t j = 1, m = span.maximumLength(); j <= m; j++)
|
||||||
{
|
{
|
||||||
if (i + j < location)
|
// 左半是漢音模式,已經自威注音 1.5.2 版開始解決了可以在詞中間叫出候選字的問題。
|
||||||
|
// TODO: 右半是微軟新注音模式,仍有可以在詞中間叫出候選字的問題。
|
||||||
|
if (((i + j != location) && m_bolHaninEnabled) || ((i + j < location) && !m_bolHaninEnabled))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue