On Fri, Nov 28, 2025 at 06:20:39PM +0100, Jean-Marc Lasgouttes wrote:
The following commit introduced (long ago) code that I do not
understand. Enrico, can you tell me what the intent is? This is
flagged by Coverity Scan, but I am not sure yet of what it means.
From what I understand, ModeSpecifier sets a mode on creation and
restores it on deletion. What is the point of using it like that?
Of course, I don't remember anymore after almost 18 years. However, I am
very aware of scoping and, if I did like that, it is for exploiting a
side effect. For example, looking at the code, I see that if we are in
an ensuremath inset, it is closed and textmode is enforced and persists
also when scope ends.
commit e224ef029b58de61fead592a6134775dbd9a97b8
Author: Enrico Forestieri <[email protected]>
Date: Tue Jun 17 11:10:43 2008 +0000
Implement the suggestion by Andre'
[...]
@@ -983,11 +981,8 @@ void InsetMathGrid::write(WriteStream & os) const
}
for (col_type col = 0; col < lastcol; ++col) {
os << cell(index(row, col));
- if (os.pendingBrace()) {
- os.pendingBrace(false);
- os.textMode(true);
- os << '}';
- }
+ if (os.pendingBrace())
+ ModeSpecifier specifier(os, TEXT_MODE);
os << eocString(col, lastcol);
}
eol = eolString(row, emptyline, os.fragile());
--
Enrico
--
lyx-devel mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-devel