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;
