Skip to content

Commit

Permalink
fix: After column editing,lines are not withdrawn together
Browse files Browse the repository at this point in the history
After column editing,the withdrawal
lines withdrawn line by line.

Log: the withdrawal lines withdrawn together
Bug: https://pms.uniontech.com/bug-view-241475.html
  • Loading branch information
lJxDabab committed Jan 26, 2024
1 parent 7e0910f commit c93c0ec
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/editor/dtextedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2545,12 +2545,8 @@ void TextEdit::cut(bool ignoreCheck)
data += "\n";
}
//删除有选择
for (int i = 0; i < m_altModSelections.size(); i++) {
if (m_altModSelections[i].cursor.hasSelection()) {
QUndoCommand *pDeleteStack = new DeleteTextUndoCommand(m_altModSelections[i].cursor, this);
QUndoCommand *pDeleteStack = new DeleteTextUndoCommand(m_altModSelections, this);
m_pUndoStack->push(pDeleteStack);
}
}

//设置到剪切板
QClipboard *clipboard = QApplication::clipboard(); //获取系统剪贴板指针
Expand Down Expand Up @@ -6723,9 +6719,17 @@ void TextEdit::mouseMoveEvent(QMouseEvent *e)
judgeEndLength = m_altEndTextCursor.positionInBlock() - endLine.textStart();
endLineIdx = endLine.lineNumber();
}
downOrUp = row > startRow ? true : startRow > row ? false
: endLineIdx > startLineIdx ? true
: false;
if (row > startRow)
{
downOrUp = true;
}else
{
if (row==startRow&&endLineIdx >= startLineIdx){
downOrUp=true;
}else{
downOrUp = false;
}
}
for (int iRow = minRow; iRow <= maxRow; iRow++)
{
QTextBlock block = document()->findBlockByNumber(iRow);
Expand Down Expand Up @@ -7385,7 +7389,6 @@ void TextEdit::paintEvent(QPaintEvent *e)

QTextCursor textCursor = this->textCursor();
int cursorWidth = this->cursorWidth();
//int cursoColumn = textCursor.positionInBlock();
QPainter painter(viewport());
QPen pen;
pen.setColor(lineColor);
Expand All @@ -7394,10 +7397,8 @@ void TextEdit::paintEvent(QPaintEvent *e)

for (int i = 0; i < m_altModSelections.size(); i++)
{
// if(m_altModSelections[i].cursor.positionInBlock() == cursoColumn){
QRect textCursorRect = this->cursorRect(m_altModSelections[i].cursor);
painter.drawRect(textCursorRect);
// }
}
}
}
Expand Down

0 comments on commit c93c0ec

Please sign in to comment.