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:
Ryan Leavengood
2009-03-12 02:37:18 +00:00
parent b44ee58331
commit b7c9f42b94
+9
View File
@@ -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()];
if (ctrlDown)
fClickOffset = 0;
else
fClickOffset = line->offset; fClickOffset = line->offset;
if (shiftDown) { if (shiftDown) {
if (fClickOffset <= fSelStart) { if (fClickOffset <= fSelStart) {
start = fClickOffset; start = fClickOffset;
@@ -3327,6 +3332,9 @@ BTextView::_HandlePageKey(uint32 inPageKey)
break; break;
case B_END: case B_END:
if (ctrlDown) {
fClickOffset = fText->Length();
} else {
// If we are on the last line, just go to the last // If we are on the last line, just go to the last
// character in the buffer, otherwise get the starting // character in the buffer, otherwise get the starting
// offset of the next line, and go to the previous character // offset of the next line, and go to the previous character
@@ -3343,6 +3351,7 @@ BTextView::_HandlePageKey(uint32 inPageKey)
fClickOffset--; fClickOffset--;
} }
} }
}
if (shiftDown) { if (shiftDown) {
if (fClickOffset >= fSelEnd) { if (fClickOffset >= fSelEnd) {