+TexString::TexString(docstring s)
+ : str(move(s)), texrow(TexRow())
+{
+ texrow.setRows(1 + count(str.begin(), str.end(), '\n'));
+}
+
+
+TexString::TexString(docstring s, TexRow t)
+ : str(move(s)), texrow(move(t))
+{
+ validate();
+}
+
+
+void TexString::validate()
+{
+ size_t lines = 1 + count(str.begin(), str.end(), '\n');
+ size_t rows = texrow.rows();
+ bool valid = lines == rows;
+ if (!valid)
+ LYXERR0("TexString has " << lines << " lines but " << rows << " rows." );
+ // Assert in devel mode. This is important to catch bugs early, otherwise
+ // they might be hard to notice and find. Recover gracefully in release
+ // mode.
+ LASSERT(valid, texrow.setRows(lines));
+}
+
+