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.
This commit is contained in:
ShikiSuen 2022-04-21 17:23:25 +08:00
parent a240da5297
commit 716cea7403
1 changed files with 4 additions and 17 deletions

View File

@ -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<Span> 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<NodeAnchor> Grid::nodesEndingAt(size_t location)
{
std::vector<NodeAnchor> result;
@ -234,6 +221,8 @@ inline std::vector<NodeAnchor> Grid::nodesEndingAt(size_t location)
return result;
}
// Windows 版奇摩注音輸入法的游標後置的選字風格。
// 與微軟新注音相異的是,這個風格允許在詞的中間叫出候選字窗。
inline std::vector<NodeAnchor> Grid::nodesCrossingOrEndingAt(size_t location)
{
std::vector<NodeAnchor> result;
@ -248,9 +237,7 @@ inline std::vector<NodeAnchor> 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;
}