Revert "Merge pull request #5884 from SKefalidis/cursor-height"
This reverts commit 72cf832819
.
This commit is contained in:
parent
abb13db6d8
commit
3c2bf50785
3 changed files with 13 additions and 21 deletions
|
@ -826,14 +826,10 @@ void TextBlock::insert(TextCursor* cursor, const QString& s)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
//
|
||||
// insertEmptyFragmentIfNeeded
|
||||
// used to insert an empty TextFragment in TextBlocks that have none
|
||||
// that way, the formatting information (most importantly the font size) of the line is preserved
|
||||
//
|
||||
// insertEmptyFragment
|
||||
//---------------------------------------------------------
|
||||
|
||||
void TextBlock::insertEmptyFragmentIfNeeded(TextCursor* cursor)
|
||||
void TextBlock::insertEmptyFragment(TextCursor* cursor)
|
||||
{
|
||||
if (_fragments.size() == 0 || _fragments.at(0).text != "")
|
||||
_fragments.insert(0, TextFragment(cursor, ""));
|
||||
|
@ -872,7 +868,7 @@ QList<TextFragment>::iterator TextBlock::fragment(int column, int* rcol, int* ri
|
|||
// remove
|
||||
//---------------------------------------------------------
|
||||
|
||||
QString TextBlock::remove(int column, TextCursor* cursor)
|
||||
QString TextBlock::remove(int column)
|
||||
{
|
||||
int col = 0;
|
||||
QString s;
|
||||
|
@ -892,7 +888,6 @@ QString TextBlock::remove(int column, TextCursor* cursor)
|
|||
if (i->text.isEmpty())
|
||||
_fragments.erase(i);
|
||||
simplify();
|
||||
insertEmptyFragmentIfNeeded(cursor); // without this, cursorRect can't calculate the y position of the cursor correctly
|
||||
return s;
|
||||
}
|
||||
++idx;
|
||||
|
@ -902,7 +897,6 @@ QString TextBlock::remove(int column, TextCursor* cursor)
|
|||
++rcol;
|
||||
}
|
||||
}
|
||||
insertEmptyFragmentIfNeeded(cursor); // without this, cursorRect can't calculate the y position of the cursor correctly
|
||||
return s;
|
||||
// qDebug("TextBlock::remove: column %d not found", column);
|
||||
}
|
||||
|
@ -933,7 +927,7 @@ void TextBlock::simplify()
|
|||
// remove
|
||||
//---------------------------------------------------------
|
||||
|
||||
QString TextBlock::remove(int start, int n, TextCursor* cursor)
|
||||
QString TextBlock::remove(int start, int n)
|
||||
{
|
||||
if (n == 0)
|
||||
return QString();
|
||||
|
@ -957,10 +951,8 @@ QString TextBlock::remove(int start, int n, TextCursor* cursor)
|
|||
inc = false;
|
||||
}
|
||||
--n;
|
||||
if (n == 0) {
|
||||
insertEmptyFragmentIfNeeded(cursor); // without this, cursorRect can't calculate the y position of the cursor correctly
|
||||
if (n == 0)
|
||||
return s;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
++idx;
|
||||
|
@ -972,7 +964,6 @@ QString TextBlock::remove(int start, int n, TextCursor* cursor)
|
|||
if (inc)
|
||||
++i;
|
||||
}
|
||||
insertEmptyFragmentIfNeeded(cursor); // without this, cursorRect can't calculate the y position of the cursor correctly
|
||||
return s;
|
||||
}
|
||||
|
||||
|
@ -1275,7 +1266,8 @@ void TextBase::createLayout()
|
|||
else if (c == '\n') {
|
||||
if (rows() <= cursor.row())
|
||||
_layout.append(TextBlock());
|
||||
_layout[cursor.row()].insertEmptyFragmentIfNeeded(&cursor); // used to preserve the Font size of the line (font info is held in TextFragments, see PR #5881)
|
||||
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,9 +193,9 @@ class TextBlock {
|
|||
QRectF boundingRect(int col1, int col2, const TextBase*) const;
|
||||
int columns() const;
|
||||
void insert(TextCursor*, const QString&);
|
||||
void insertEmptyFragmentIfNeeded(TextCursor*);
|
||||
QString remove(int column, TextCursor*);
|
||||
QString remove(int start, int n, TextCursor*);
|
||||
void insertEmptyFragment(TextCursor*);
|
||||
QString remove(int column);
|
||||
QString remove(int start, int n);
|
||||
int column(qreal x, TextBase*) const;
|
||||
TextBlock split(int column);
|
||||
qreal xpos(int col, const TextBase*) const;
|
||||
|
|
|
@ -497,7 +497,7 @@ void ChangeText::removeText(EditData* ed)
|
|||
int column = c.column();
|
||||
|
||||
for (int n = 0; n < s.size(); ++n)
|
||||
l.remove(column, &c);
|
||||
l.remove(column);
|
||||
c.text()->triggerLayout();
|
||||
if (ed)
|
||||
*c.text()->cursor(*ed) = tc;
|
||||
|
@ -699,7 +699,7 @@ void TextBase::inputTransition(EditData& ed, QInputMethodEvent* ie)
|
|||
while (n--) {
|
||||
if (_cursor->movePosition(QTextCursor::Left)) {
|
||||
TextBlock& l = _cursor->curLine();
|
||||
l.remove(_cursor->column(), _cursor);
|
||||
l.remove(_cursor->column());
|
||||
_cursor->text()->triggerLayout();
|
||||
_cursor->text()->setTextInvalid();
|
||||
}
|
||||
|
@ -763,7 +763,7 @@ void TextBase::endHexState(EditData& ed)
|
|||
int c1 = c2 - (hexState + 1);
|
||||
|
||||
TextBlock& t = _layout[_cursor->row()];
|
||||
QString ss = t.remove(c1, hexState + 1, _cursor);
|
||||
QString ss = t.remove(c1, hexState + 1);
|
||||
bool ok;
|
||||
int code = ss.mid(1).toInt(&ok, 16);
|
||||
_cursor->setColumn(c1);
|
||||
|
|
Loading…
Reference in a new issue