From 8dace2bf025342dbcf0116efb4290ebf2c0ebea1 Mon Sep 17 00:00:00 2001 From: "rods%netscape.com" Date: Fri, 7 Aug 1998 20:15:36 +0000 Subject: [PATCH] Shift click (without first clicking) no longer crashes the viewer --- layout/base/src/nsFrame.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/layout/base/src/nsFrame.cpp b/layout/base/src/nsFrame.cpp index b6a24d713492..af3868d1a692 100644 --- a/layout/base/src/nsFrame.cpp +++ b/layout/base/src/nsFrame.cpp @@ -727,19 +727,24 @@ NS_METHOD nsFrame::HandlePress(nsIPresContext& aPresContext, } else { // Content is After End if (mouseEvent->isShift) { - if (mStartSelectionPoint->IsAnchor()) { + if (selStartContent == nsnull && selEndContent == nsnull) { + // Shift Click without first clicking in the window + // is interpreted the same as just clicking in a window + mEndSelectionPoint->SetPoint(newContent, mStartPos, PR_TRUE); + mStartSelectionPoint->SetPoint(newContent, mStartPos, PR_TRUE); + addRangeToSelectionTrackers(newContent, newContent, kInsertInAddList); // add to selection + + } else if (mStartSelectionPoint->IsAnchor()) { if (SELECTION_DEBUG) printf("New Content is after, Append new content\n"); addRangeToSelectionTrackers(selEndContent, newContent, kInsertInAddList); // add to selection mEndSelectionPoint->SetPoint(newContent, mStartPos, PR_FALSE); + } else { if (SELECTION_DEBUG) printf("New Content is after, End will now be Start\n"); addRangeToSelectionTrackers(selStartContent, selEndContent, kInsertInRemoveList); // removed from selection - mStartSelectionPoint->SetPoint(selEndContent, mEndSelectionPoint->GetOffset(), PR_TRUE); - mEndSelectionPoint->SetPoint(newContent, mStartPos, PR_FALSE); - addRangeToSelectionTrackers(newContent, newContent, kInsertInAddList); // add to selection }