Skip to content

Commit

Permalink
Merge branch 'development' into tmediaplaylist-2
Browse files Browse the repository at this point in the history
  • Loading branch information
mpconley committed Apr 25, 2024
2 parents 5c4a1fa + 77ba03c commit 1c565d7
Showing 1 changed file with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions src/TTextEdit.cpp
Expand Up @@ -1104,27 +1104,44 @@ void TTextEdit::expandSelectionToWords()
{
int yind = mPA.y();
int xind = mPA.x();
for (; xind >= 0; --xind) {
if (mpBuffer->lineBuffer.at(yind).at(xind) == QChar::Space
|| mpHost->mDoubleClickIgnore.contains(mpBuffer->lineBuffer.at(yind).at(xind))) {
break;

// Check if yind is within the valid range of lineBuffer
if (yind >= 0 && yind < static_cast<int>(mpBuffer->lineBuffer.size())) {
for (; xind >= 0; --xind) {
// Ensure xind is within the valid range for the current line
if (xind < static_cast<int>(mpBuffer->lineBuffer.at(yind).size())) {
const QChar currentChar = mpBuffer->lineBuffer.at(yind).at(xind);
if (currentChar == QChar::Space
|| mpHost->mDoubleClickIgnore.contains(currentChar)) {
break;
}
} else {
break; // xind is out of bounds, break the loop
}
}
}
mDragStart.setX(xind + 1);
mPA.setX(xind + 1);

yind = mPB.y();
xind = mPB.x();
for (; xind < static_cast<int>(mpBuffer->lineBuffer.at(yind).size()); ++xind) {
if (mpBuffer->lineBuffer.at(yind).at(xind) == QChar::Space
|| mpHost->mDoubleClickIgnore.contains(mpBuffer->lineBuffer.at(yind).at(xind))) {
break;

// Repeat the check for yind and xind for the second part
if (yind >= 0 && yind < static_cast<int>(mpBuffer->lineBuffer.size())) {
for (; xind < static_cast<int>(mpBuffer->lineBuffer.at(yind).size()); ++xind) {
const QChar currentChar = mpBuffer->lineBuffer.at(yind).at(xind);
if (currentChar == QChar::Space
|| mpHost->mDoubleClickIgnore.contains(currentChar)) {
break;
}
}
}
mDragSelectionEnd.setX(xind - 1);
mPB.setX(xind - 1);
}



void TTextEdit::expandSelectionToLine(int y)
{
if (!(y < mpBuffer->lineBuffer.size())) {
Expand Down

0 comments on commit 1c565d7

Please sign in to comment.