commit 736ec521cbbce45f292bd735f370b8cedfee2c36
Author: Koji Yokota <[email protected]>
Date: Wed Jun 25 15:08:56 2025 +0900
Counter the case QInputMethodEvent::Attribute does not report preedit styles
---
src/frontends/qt/GuiInputMethod.cpp | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/frontends/qt/GuiInputMethod.cpp
b/src/frontends/qt/GuiInputMethod.cpp
index 0eff28c3be..896bc3bebc 100644
--- a/src/frontends/qt/GuiInputMethod.cpp
+++ b/src/frontends/qt/GuiInputMethod.cpp
@@ -507,7 +507,11 @@ std::array<int,2> GuiInputMethod::setCaretOffset(pos_type
caret_pos){
}
// when preedit cursor is available, string fonts are all common
// so pick up the last one
- QTextCharFormat & qtcf = d->style_.segments_.back().char_format_;
+ QTextCharFormat qtcf;
+ if (!d->style_.segments_.empty())
+ qtcf = d->style_.segments_.back().char_format_;
+ else
+ conformToSurroundingFont(qtcf);
QFontMetrics qfm(qtcf.font());
QString str_before_caret = "";
--
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs