fixed word by word selection

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18943 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2006-09-26 15:07:19 +00:00
parent 6343dc9855
commit 9205b41148
+12 -16
View File
@@ -14,7 +14,6 @@
// - Finish documenting this class // - Finish documenting this class
// - Consider using BObjectList instead of BList // - Consider using BObjectList instead of BList
// for disallowed characters (it would remove a lot of reinterpret_casts) // for disallowed characters (it would remove a lot of reinterpret_casts)
// - Asynchronous mouse tracking
// - Check for correctness and possible optimizations the calls to Refresh(), // - Check for correctness and possible optimizations the calls to Refresh(),
// to refresh only changed parts of text (currently we often redraw the whole text) // to refresh only changed parts of text (currently we often redraw the whole text)
@@ -3799,35 +3798,32 @@ BTextView::PerformMouseMoved(BPoint where, uint32 code)
int32 oldOffset = fTrackingMouse->anchor; int32 oldOffset = fTrackingMouse->anchor;
int32 currentOffset = OffsetAt(where); int32 currentOffset = OffsetAt(where);
if (oldOffset < currentOffset) {
fTrackingMouse->selStart = oldOffset;
fTrackingMouse->selEnd = currentOffset;
} else {
fTrackingMouse->selStart = currentOffset;
fTrackingMouse->selEnd = oldOffset;
}
int32 start = fTrackingMouse->selStart;
int32 end = fTrackingMouse->selEnd;
switch (fClickCount) { switch (fClickCount) {
case 0: case 0:
// triple click, select line by line // triple click, select line by line
start = (*fLines)[LineAt(start)]->offset; fTrackingMouse->selStart = (*fLines)[LineAt(fTrackingMouse->selStart)]->offset;
end = (*fLines)[LineAt(end) + 1]->offset; fTrackingMouse->selEnd = (*fLines)[LineAt(fTrackingMouse->selEnd) + 1]->offset;
break; break;
case 2: case 2:
// double click, select word by word // double click, select word by word
FindWord(oldOffset, &start, &end); FindWord(currentOffset, &fTrackingMouse->selStart, &fTrackingMouse->selEnd);
break; break;
default: default:
// new click, select char by char // new click, select char by char
if (oldOffset < currentOffset) {
fTrackingMouse->selStart = oldOffset;
fTrackingMouse->selEnd = currentOffset;
} else {
fTrackingMouse->selStart = currentOffset;
fTrackingMouse->selEnd = oldOffset;
}
break; break;
} }
Select(start, end); Select(fTrackingMouse->selStart, fTrackingMouse->selEnd);
TrackMouse(where, NULL); TrackMouse(where, NULL);