Skip to content

Commit

Permalink
Github Issue #91: Only disconnecting the internal signal for cursorPo…
Browse files Browse the repository at this point in the history
…sitionChanged for undo instead of calling disconnectSignals() which does more. Removed unused parameter from SelectRange
  • Loading branch information
AngryFender committed Mar 10, 2024
1 parent 94dd6eb commit 6c08b63
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
8 changes: 3 additions & 5 deletions mkedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ void MkEdit::initialialCursorPosition()
this->verticalScrollBar()->setSliderPosition(0);

int savedBlockNumber = cursor.blockNumber();
selectRange.start = this->textCursor().selectionStart();
selectRange.end = this->textCursor().selectionEnd();

emit cursorPosChanged( textCursor().hasSelection(), savedBlockNumber , getVisibleRect(), &selectRange);
connectSignals();
Expand Down Expand Up @@ -208,7 +206,7 @@ void MkEdit::showSelectionAfterUndo(){
selectRange.hasSelection = false;
}

disconnectSignals();
QObject::disconnect(this,&MkEdit::cursorPositionChanged,this,&MkEdit::cursorPositionChangedHandle);
{
//first show all the Markdown symbols in the editor
emit cursorPosChanged( range.hasSelection, currentBlockNo, getVisibleRect(), &selectRange);
Expand All @@ -226,8 +224,8 @@ void MkEdit::showSelectionAfterUndo(){

//highlight the selection
this->setTextCursor(textCursor);
}
connectSignals();
}
QObject::connect(this,&MkEdit::cursorPositionChanged,this,&MkEdit::cursorPositionChangedHandle);
}

void MkEdit::quoteLeftKey()
Expand Down
2 changes: 0 additions & 2 deletions mktextdocument.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ class FormatCollection{

#define NO_SELECTION_POS -1
struct SelectRange{
int start = NO_SELECTION_POS;
int end = NO_SELECTION_POS;
int startBlock = NO_SELECTION_POS;
int endBlock = NO_SELECTION_POS;
bool hasSelection = false;
Expand Down

0 comments on commit 6c08b63

Please sign in to comment.