Error handling issues (CHECKED_RETURN)
Calling "translateString" without checking return value
(as is done elsewhere 15 out of 18 times).
AFAICS we do not need the boolean return value in these two cases.
It might happen that the selection goes away without recomputing
metrics (for example with char-forward). The added test is a bit of a
band-aid for this situation. A better solution would be to understand
better when metrics computation is triggered in mathed.
Fixes three similar warnings. One of them is the following:
src/insets/InsetInfo.cpp:1583:20: error: comparison of integers of different signs: 'int' and 'std::basic_string<wchar_t>::size_type' (aka 'unsigned long') [-Werror,-Wsign-compare]
for (int i = 0; i < sequence.length(); ++i) {
~ ^ ~~~~~~~~~~~~~~~~~
When having the code preview pane open with examples/Language_Support/Mixing_Japanese_with_other_Languages_(with_CJKutf8), clicking at random on paragraphs sometimes yielded a crash: *par when par is the end of the iterator. LyX could output the whole document as DocBook without this patch and still generates the same output with it (i.e. no text is missing).
Previously, when closing font tags, only the previous character's font was used. However, if that character is deleted, it had no change of having the right font tags opened/closed. Hence, look further to compare the font of the current character to output with the font of the previously output character.
A similar patch would be required for LyXHTML, but it will come later. The main impact is that some text isn't output in XHTML (like DocBook before this patch).
The code isn't as clean as it could be. I avoided touching anything not related to DocBook, as the release of 2.4 is nearing, while leaving comments for parts to improve for the next release cycle. Given that the code compiles, there are no risks for TeX or XHTML outputs; for DocBook, less content is skipped, which is a net improvement for users.
To have a distinctive color for selected math which works in both modes
Also, link color_selectionmath with QPalette::HighlightedText, so we
won't need to special-case on lyxrc.use_system_colors any longer
Currently, selected math hull insets use Color_selectiontext when
system colors are in use. This commit implements the same behavior
for partial selection.
This is done by introducing two element types (BEGIN_SEL and END_SEL)
to MathRow.