Fix the bug on the mailing list where TextView does not go to the beginning of
the buffer when Ctrl-Home is pressed and to the end when Ctrl-End is pressed. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29476 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -3306,13 +3306,18 @@ BTextView::_HandlePageKey(uint32 inPageKey)
|
|||||||
currentMessage->FindInt32("modifiers", &mods);
|
currentMessage->FindInt32("modifiers", &mods);
|
||||||
|
|
||||||
bool shiftDown = mods & B_SHIFT_KEY;
|
bool shiftDown = mods & B_SHIFT_KEY;
|
||||||
|
bool ctrlDown = mods & B_CONTROL_KEY;
|
||||||
STELine* line = NULL;
|
STELine* line = NULL;
|
||||||
int32 start = fSelStart, end = fSelEnd;
|
int32 start = fSelStart, end = fSelEnd;
|
||||||
|
|
||||||
switch (inPageKey) {
|
switch (inPageKey) {
|
||||||
case B_HOME:
|
case B_HOME:
|
||||||
line = (*fLines)[CurrentLine()];
|
line = (*fLines)[CurrentLine()];
|
||||||
fClickOffset = line->offset;
|
if (ctrlDown)
|
||||||
|
fClickOffset = 0;
|
||||||
|
else
|
||||||
|
fClickOffset = line->offset;
|
||||||
|
|
||||||
if (shiftDown) {
|
if (shiftDown) {
|
||||||
if (fClickOffset <= fSelStart) {
|
if (fClickOffset <= fSelStart) {
|
||||||
start = fClickOffset;
|
start = fClickOffset;
|
||||||
@@ -3327,20 +3332,24 @@ BTextView::_HandlePageKey(uint32 inPageKey)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case B_END:
|
case B_END:
|
||||||
// If we are on the last line, just go to the last
|
if (ctrlDown) {
|
||||||
// character in the buffer, otherwise get the starting
|
fClickOffset = fText->Length();
|
||||||
// offset of the next line, and go to the previous character
|
|
||||||
if (CurrentLine() + 1 < fLines->NumLines()) {
|
|
||||||
line = (*fLines)[CurrentLine() + 1];
|
|
||||||
fClickOffset = _PreviousInitialByte(line->offset);
|
|
||||||
} else {
|
} else {
|
||||||
// This check if needed to avoid moving the cursor
|
// If we are on the last line, just go to the last
|
||||||
// when the cursor is on the last line, and that line
|
// character in the buffer, otherwise get the starting
|
||||||
// is empty
|
// offset of the next line, and go to the previous character
|
||||||
if (fClickOffset != fText->Length()) {
|
if (CurrentLine() + 1 < fLines->NumLines()) {
|
||||||
fClickOffset = fText->Length();
|
line = (*fLines)[CurrentLine() + 1];
|
||||||
if (ByteAt(fClickOffset - 1) == B_ENTER)
|
fClickOffset = _PreviousInitialByte(line->offset);
|
||||||
fClickOffset--;
|
} else {
|
||||||
|
// This check if needed to avoid moving the cursor
|
||||||
|
// when the cursor is on the last line, and that line
|
||||||
|
// is empty
|
||||||
|
if (fClickOffset != fText->Length()) {
|
||||||
|
fClickOffset = fText->Length();
|
||||||
|
if (ByteAt(fClickOffset - 1) == B_ENTER)
|
||||||
|
fClickOffset--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user