commit 4abb72560b76ee4d3c1c59a8b1771dd67a0e5d18
Author: Koji Yokota <[email protected]>
Date:   Tue Jan 20 15:22:56 2026 +0900

    Let the input method instance recognise BufferView change
---
 src/frontends/qt/GuiInputMethod.cpp | 8 ++++++++
 src/frontends/qt/GuiInputMethod.h   | 1 +
 2 files changed, 9 insertions(+)

diff --git a/src/frontends/qt/GuiInputMethod.cpp 
b/src/frontends/qt/GuiInputMethod.cpp
index b9348328d9..f8eef39f39 100644
--- a/src/frontends/qt/GuiInputMethod.cpp
+++ b/src/frontends/qt/GuiInputMethod.cpp
@@ -111,6 +111,8 @@ GuiInputMethod::GuiInputMethod(GuiWorkArea *parent)
                this, &GuiInputMethod::onLocaleChanged);
        connect(this, &GuiInputMethod::cursorPositionChanged,
                this, &GuiInputMethod::onCursorPositionChanged);
+       connect(parent, &GuiWorkArea::bufferViewChanged,
+               this, &GuiInputMethod::onBufferViewChanged);
 
        // initialize locale status
        onLocaleChanged();
@@ -328,6 +330,12 @@ void GuiInputMethod::onCursorPositionChanged()
        setSurroundingText(*d->cur_);
 }
 
+void GuiInputMethod::onBufferViewChanged()
+{
+       d->buffer_view_ = &d->work_area_->bufferView();
+       d->cur_ = &d->buffer_view_->cursor();
+}
+
 
 void GuiInputMethod::setPreeditStyle(
                const QList<QInputMethodEvent::Attribute> & attr)
diff --git a/src/frontends/qt/GuiInputMethod.h 
b/src/frontends/qt/GuiInputMethod.h
index de107c92dc..d052e82ed3 100644
--- a/src/frontends/qt/GuiInputMethod.h
+++ b/src/frontends/qt/GuiInputMethod.h
@@ -134,6 +134,7 @@ public Q_SLOTS:
        /// Handles the localeChanged() signal the input method emits
        void onLocaleChanged();
        void onCursorPositionChanged();
+       void onBufferViewChanged();
 #ifdef Q_DEBUG
        ///
        void setHint(InputMethod::Hint hint) override;
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to