TextView: Fix regression for Home and End
... while Shift is held down in a selection. Before this commit, if you had some text selected and you pressed Home or End with a Shift held down the selection would not change. This was annoying and most likely unintentional. Thank you Axel for informing me of this problem. After this commit if you have some text selected and you press Home with a Shift key held down it will move the end of the selection to the first character of the same line that the end of selection is on and if you press End with a Shift key held down it will move the end of the selection to the last character of the same line that the end of the selection is on. I looked at how a bunch of different OS's and applications handled this and found that there are a bunch of different behaviors we could use here, and there doesn't appear to be any consensus as to what the "right" or "wrong" way to do this is so please forgive me if this doesn't work exactly as you expect it to. Note that the implementation used here is very different from how BeOS R5 worked. In BeOS R5 pressing Home or End with Shift held down always extended the selection, it never subtracted from it. In BeOS pressing Home with Shift held down extended the selection from the left-most part of the selection to the first charcter of the same line. Pressing End with Shift held down extended the selection from the right-most part of the selection to the end of the same line.
This commit is contained in:
parent
1d1e61bb39
commit
dc4ae0e9c0
@ -3364,9 +3364,7 @@ BTextView::_HandlePageKey(uint32 pageKey, int32 modifiers)
|
||||
fCaretOffset = 0;
|
||||
_ScrollTo(0, 0);
|
||||
break;
|
||||
} else if (fSelStart != fSelEnd && !shiftKeyDown)
|
||||
fCaretOffset = fSelEnd;
|
||||
else {
|
||||
} else {
|
||||
if (commandKeyDown && !optionKeyDown && !controlKeyDown) {
|
||||
_ScrollTo(0, 0);
|
||||
fCaretOffset = 0;
|
||||
@ -3399,9 +3397,7 @@ BTextView::_HandlePageKey(uint32 pageKey, int32 modifiers)
|
||||
fCaretOffset = fText->Length();
|
||||
_ScrollTo(0, fTextRect.bottom + fLayoutData->bottomInset);
|
||||
break;
|
||||
} else if (fSelStart != fSelEnd && !shiftKeyDown)
|
||||
fCaretOffset = fSelEnd;
|
||||
else {
|
||||
} else {
|
||||
if (commandKeyDown && !optionKeyDown && !controlKeyDown) {
|
||||
_ScrollTo(0, fTextRect.bottom + fLayoutData->bottomInset);
|
||||
fCaretOffset = fText->Length();
|
||||
|
Loading…
Reference in New Issue
Block a user