impr: Better home shortcut for pattern editor (#2105)

The old home shortcut moved the cursor to column zero of the current
line.
Most editors move cursor to the first non-space character instead.
This commit is contained in:
paxcut
2025-02-16 04:53:07 -07:00
committed by GitHub
parent aad38beaf5
commit caff49504e

View File

@@ -1858,8 +1858,11 @@ void TextEditor::TextEditor::MoveBottom(bool aSelect) {
void TextEditor::MoveHome(bool aSelect) {
ResetCursorBlinkTime();
auto oldPos = mState.mCursorPosition;
SetCursorPosition(Coordinates(mState.mCursorPosition.mLine, 0));
auto &line = mLines[mState.mCursorPosition.mLine];
auto home=0;
while (isspace(line[home].mChar))
home++;
SetCursorPosition(Coordinates(mState.mCursorPosition.mLine, home));
if (mState.mCursorPosition != oldPos) {
if (aSelect) {
if (oldPos == mInteractiveStart)