Skip to content

Commit

Permalink
Github Issue #29: In future the "removeAllMkData" will simply copy st…
Browse files Browse the repository at this point in the history
…ored raw text over instead of calculating the raw texts from the Format data. Therefore storing the text cursor information before copying the texts and setting the textcursor to the saved state
  • Loading branch information
AngryFender committed Mar 29, 2024
1 parent e0dac58 commit 684b319
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions mkedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,23 @@ void MkEdit::clearMkEffects()
{
disconnectSignals();
undoData.scrollValue = this->verticalScrollBar()->sliderPosition(); //this is importantp

QTextCursor cursor = this->textCursor();
int blockNumber = cursor.blockNumber();
int posInBlock = cursor.positionInBlock();
bool hasSeleclion = cursor.hasSelection();

emit removeAllMkData(this->textCursor().blockNumber());

if(hasSeleclion){
cursor.setPosition(this->document()->findBlockByNumber(selectRange.selectionFirstStartBlock).position() + selectRange.selectionFirstStartPosInBlock);
cursor.setPosition(this->document()->findBlockByNumber(blockNumber).position() + posInBlock, QTextCursor::KeepAnchor);
}else{
cursor.setPosition(this->document()->findBlockByNumber(blockNumber).position() + posInBlock);
}

this->setTextCursor(cursor);

if(!fileSaveTimer.isActive()){
preUndoSetup();
}
Expand Down

0 comments on commit 684b319

Please sign in to comment.