From 716cea7403082d21da398f58b0f6efe880d1a2bb Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Thu, 21 Apr 2022 17:23:25 +0800 Subject: [PATCH] Gramambular // Revert the state of "Grid.h" to vanilla. - We found an existing function called "nodeEndingAt(location)", hence the lack of needs of edits introduced since vChewing 1.5.1. - The problem is that Gramambular has lack of a new function called "nodeBeginningAt(location)" which will be addressed later. --- .../LanguageParsers/Gramambular/Grid.h | 21 ++++--------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/Source/Modules/LanguageParsers/Gramambular/Grid.h b/Source/Modules/LanguageParsers/Gramambular/Grid.h index 6ec59211..5a39fe7a 100644 --- a/Source/Modules/LanguageParsers/Gramambular/Grid.h +++ b/Source/Modules/LanguageParsers/Gramambular/Grid.h @@ -44,9 +44,6 @@ class Grid void insertNode(const Node &node, size_t location, size_t spanningLength); bool hasNodeAtLocationSpanningLengthMatchingKey(size_t location, size_t spanningLength, const std::string &key); - void setRearCursorModeEnabled(bool enabled); - bool RearCursorModeEnabled(); - void expandGridByOneAtLocation(size_t location); void shrinkGridByOneAtLocation(size_t location); @@ -119,19 +116,8 @@ class Grid protected: std::vector m_spans; - bool m_rearCursorMode; }; -inline void Grid::setRearCursorModeEnabled(bool enabled) -{ - m_rearCursorMode = enabled; -} - -inline bool Grid::RearCursorModeEnabled() -{ - return m_rearCursorMode; -} - inline void Grid::clear() { m_spans.clear(); @@ -206,6 +192,7 @@ inline size_t Grid::width() const return m_spans.size(); } +// macOS 10.6 開始的內建注音的游標前置選字風格 inline std::vector Grid::nodesEndingAt(size_t location) { std::vector result; @@ -234,6 +221,8 @@ inline std::vector Grid::nodesEndingAt(size_t location) return result; } +// Windows 版奇摩注音輸入法的游標後置的選字風格。 +// 與微軟新注音相異的是,這個風格允許在詞的中間叫出候選字窗。 inline std::vector Grid::nodesCrossingOrEndingAt(size_t location) { std::vector result; @@ -248,9 +237,7 @@ inline std::vector Grid::nodesCrossingOrEndingAt(size_t location) { for (size_t j = 1, m = span.maximumLength(); j <= m; j++) { - // 左半是漢音模式,已經自威注音 1.5.2 版開始解決了可以在詞中間叫出候選字的問題。 - // TODO: 右半是微軟新注音模式,仍有可以在詞中間叫出候選字的問題。 - if (((i + j != location) && !m_rearCursorMode) || ((i + j < location) && m_rearCursorMode)) + if (i + j < location) { continue; }