As Qt explains in https://doc.qt.io/qt-6/qfont.html#StyleStrategy-enum, "if the font selected for a certain writing system does not contain a character requested to draw, then Qt automatically chooses a similar looking font that contains the character."
This caused a problem for us because the width of the replacing character might be smaller than the monospace width, while the code expected the same width.
The patch fixes the issue by checking the width and adding simple conditions if it's smaller than expected.
To test it, you could use a string like aabb⧸aabb⧸aabb⧸aabb⧸aabb ('⧸' is not an ordinary slash). Previously, the characters were moved on making selections or moving the text cursor.
As Qt explains in https://doc.qt.io/qt-6/qfont.html#StyleStrategy-enum, "if the font selected for a certain writing system does not contain a character requested to draw, then Qt automatically chooses a similar looking font that contains the character."
This caused a problem for us because the width of the replacing character might be smaller than the monospace width, while the code expected the same width.
The patch fixes the issue by checking the width and adding simple conditions if it's smaller than expected.
To test it, you could use a string like
aabb⧸aabb⧸aabb⧸aabb⧸aabb
('⧸' is not an ordinary slash). Previously, the characters were moved on making selections or moving the text cursor.Fixes https://github.com/lxqt/qterminal/issues/1186
NOTE: There is still a rare issue with another kind of character that isn't related to this PR. I might investigate it later.