commit 5f290476f809e75265e9a61a5bbcf16438ee8bd0
Author: Koji Yokota <[email protected]>
Date:   Tue Jul 22 19:44:02 2025 +0900

    Fix math-mode control of input method on Linux and Windows
    
    Since QInputMethod::locale() doesn't work on these systems, use language
    at the cursor point to infer the current input language as a second best
---
 src/frontends/qt/GuiInputMethod.cpp | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/frontends/qt/GuiInputMethod.cpp 
b/src/frontends/qt/GuiInputMethod.cpp
index 3573a8daef..60c612af08 100644
--- a/src/frontends/qt/GuiInputMethod.cpp
+++ b/src/frontends/qt/GuiInputMethod.cpp
@@ -24,6 +24,9 @@
 #include "GuiWorkArea.h"
 #include "InsetList.h"
 #include "KeyMap.h"
+#if defined(Q_OS_WIN) || defined (Q_CYGWIN_WIN) || defined (Q_OS_LINUX)
+#include "Language.h"
+#endif
 #include "LyX.h"
 #include "LyXRC.h"
 #include "Row.h"
@@ -117,6 +120,14 @@ GuiInputMethod::~GuiInputMethod()
 
 
 void GuiInputMethod::toggleInputMethodAcceptance(){
+#if defined(Q_OS_WIN) || defined (Q_CYGWIN_WIN) || defined (Q_OS_LINUX)
+       std::string lang = d->cur_->getFont().language()->lang();
+       if (lang == "chinese-simplified" || lang == "chinese-traditional" ||
+               lang == "korean" || lang == "japanese")
+               d->is_cjk_locale = true;
+       else
+               d->is_cjk_locale = false;
+#endif
        // note that d->cur_->inset() is a cache so it lags from actual key 
moves
        if ((d->is_cjk_locale &&
                d->cur_->inset().currentMode() == Inset::MATH_MODE) ||
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to