fix #292652: Empty lines become smaller
This commit is contained in:
parent
dcb744ca20
commit
0998fffc66
2 changed files with 13 additions and 0 deletions
|
@ -817,6 +817,16 @@ void TextBlock::insert(TextCursor* cursor, const QString& s)
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// insertEmptyFragment
|
||||
//---------------------------------------------------------
|
||||
|
||||
void TextBlock::insertEmptyFragment(TextCursor* cursor)
|
||||
{
|
||||
if (_fragments.size() == 0 || _fragments.at(0).text != "")
|
||||
_fragments.insert(0, TextFragment(cursor, ""));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// fragment
|
||||
// inputs:
|
||||
|
@ -1248,6 +1258,8 @@ void TextBase::createLayout()
|
|||
else if (c == '\n') {
|
||||
if (rows() <= cursor.row())
|
||||
_layout.append(TextBlock());
|
||||
if(_layout[cursor.row()].fragments().size() == 0)
|
||||
_layout[cursor.row()].insertEmptyFragment(&cursor); // used to preserve the Font size of the line (font info is held in TextFragments, see PR #5881)
|
||||
_layout[cursor.row()].setEol(true);
|
||||
cursor.setRow(cursor.row() + 1);
|
||||
cursor.setColumn(0);
|
||||
|
|
|
@ -193,6 +193,7 @@ class TextBlock {
|
|||
QRectF boundingRect(int col1, int col2, const TextBase*) const;
|
||||
int columns() const;
|
||||
void insert(TextCursor*, const QString&);
|
||||
void insertEmptyFragment(TextCursor*);
|
||||
QString remove(int column);
|
||||
QString remove(int start, int n);
|
||||
int column(qreal x, TextBase*) const;
|
||||
|
|
Loading…
Reference in a new issue