Skip to content

Commit

Permalink
fix issue with move home and move end
Browse files Browse the repository at this point in the history
  • Loading branch information
santiago committed Oct 9, 2022
1 parent ccf6cef commit e3d51f2
Showing 1 changed file with 22 additions and 28 deletions.
50 changes: 22 additions & 28 deletions TextEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2072,24 +2072,21 @@ void TextEditor::MoveHome(bool aSelect)
auto oldPos = mState.mCursors[c].mCursorPosition;
SetCursorPosition(Coordinates(mState.mCursors[c].mCursorPosition.mLine, 0), c);

if (mState.mCursors[c].mCursorPosition != oldPos)
if (aSelect)
{
if (aSelect)
if (oldPos == mState.mCursors[c].mInteractiveStart)
mState.mCursors[c].mInteractiveStart = mState.mCursors[c].mCursorPosition;
else if (oldPos == mState.mCursors[c].mInteractiveEnd)
mState.mCursors[c].mInteractiveEnd = mState.mCursors[c].mCursorPosition;
else
{
if (oldPos == mState.mCursors[c].mInteractiveStart)
mState.mCursors[c].mInteractiveStart = mState.mCursors[c].mCursorPosition;
else if (oldPos == mState.mCursors[c].mInteractiveEnd)
mState.mCursors[c].mInteractiveEnd = mState.mCursors[c].mCursorPosition;
else
{
mState.mCursors[c].mInteractiveStart = mState.mCursors[c].mCursorPosition;
mState.mCursors[c].mInteractiveEnd = oldPos;
}
mState.mCursors[c].mInteractiveStart = mState.mCursors[c].mCursorPosition;
mState.mCursors[c].mInteractiveEnd = oldPos;
}
else
mState.mCursors[c].mInteractiveStart = mState.mCursors[c].mInteractiveEnd = mState.mCursors[c].mCursorPosition;
SetSelection(mState.mCursors[c].mInteractiveStart, mState.mCursors[c].mInteractiveEnd, SelectionMode::Normal, c);
}
else
mState.mCursors[c].mInteractiveStart = mState.mCursors[c].mInteractiveEnd = mState.mCursors[c].mCursorPosition;
SetSelection(mState.mCursors[c].mInteractiveStart, mState.mCursors[c].mInteractiveEnd, SelectionMode::Normal, c);
}
}

Expand All @@ -2100,24 +2097,21 @@ void TextEditor::MoveEnd(bool aSelect)
auto oldPos = mState.mCursors[c].mCursorPosition;
SetCursorPosition(Coordinates(mState.mCursors[c].mCursorPosition.mLine, GetLineMaxColumn(oldPos.mLine)), c);

if (mState.mCursors[c].mCursorPosition != oldPos)
if (aSelect)
{
if (aSelect)
if (oldPos == mState.mCursors[c].mInteractiveEnd)
mState.mCursors[c].mInteractiveEnd = mState.mCursors[c].mCursorPosition;
else if (oldPos == mState.mCursors[c].mInteractiveStart)
mState.mCursors[c].mInteractiveStart = mState.mCursors[c].mCursorPosition;
else
{
if (oldPos == mState.mCursors[c].mInteractiveEnd)
mState.mCursors[c].mInteractiveEnd = mState.mCursors[c].mCursorPosition;
else if (oldPos == mState.mCursors[c].mInteractiveStart)
mState.mCursors[c].mInteractiveStart = mState.mCursors[c].mCursorPosition;
else
{
mState.mCursors[c].mInteractiveStart = oldPos;
mState.mCursors[c].mInteractiveEnd = mState.mCursors[c].mCursorPosition;
}
mState.mCursors[c].mInteractiveStart = oldPos;
mState.mCursors[c].mInteractiveEnd = mState.mCursors[c].mCursorPosition;
}
else
mState.mCursors[c].mInteractiveStart = mState.mCursors[c].mInteractiveEnd = mState.mCursors[c].mCursorPosition;
SetSelection(mState.mCursors[c].mInteractiveStart, mState.mCursors[c].mInteractiveEnd, SelectionMode::Normal, c);
}
else
mState.mCursors[c].mInteractiveStart = mState.mCursors[c].mInteractiveEnd = mState.mCursors[c].mCursorPosition;
SetSelection(mState.mCursors[c].mInteractiveStart, mState.mCursors[c].mInteractiveEnd, SelectionMode::Normal, c);
}
}

Expand Down

0 comments on commit e3d51f2

Please sign in to comment.