Skip to content

Commit

Permalink
Github Issue #175: Added check to avoid adding duplicate checkbox and…
Browse files Browse the repository at this point in the history
… link position to the main collection of the document
  • Loading branch information
AngryFender committed Jun 12, 2024
1 parent 715e659 commit e1a7414
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions mktextdocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,14 +552,20 @@ void MkTextDocument::applyMkFormat(QTextBlock &block, int start, int end, Fragme
case FragmentData::HEADING3:{format = formatCollection.getHeading3(); end = block.length()-1; break;}
case FragmentData::CHECKED_END:
case FragmentData::UNCHECKED_END:{
const int blockPos = block.position();
checkMarkPositions.append(blockPos + start);
const int position = block.position() + start;
if(!checkMarkPositions.contains(position)){
checkMarkPositions.append(position);
}
break;
}
case FragmentData::LINK_TITLE:{
format = formatCollection.getLink();
const int blockPos = block.position();
linkPositions.append(QPair<int,int>(blockPos + start, blockPos + end));
const int startingPosition = block.position() + start;
const int endingPosition = block.position() + end;
QPair<int,int> linePosition(startingPosition, endingPosition);
if(!linkPositions.contains(linePosition)){
linkPositions.append(linePosition);
}
break;}

default:break;
Expand Down

0 comments on commit e1a7414

Please sign in to comment.