Closed Bug 90499 Opened 24 years ago Closed 24 years ago

Can't delete selection if end of selection contains "<br>\n"

Categories

(Core :: DOM: Editor, defect, P2)

defect

Tracking

()

VERIFIED FIXED
mozilla0.9.3

People

(Reporter: kinmoz, Assigned: kinmoz)

Details

(Whiteboard: [PDT+][reviewed][fixed on trunk][nsBranch+])

Attachments

(2 files)

I ran across this little tidbit while looking at a problem file from clayton. It's very common practice to click before the first character on a line and drag the selection along the left edge of other lines to select more lines. I noticed that when I did this in clayton's sample file, that when I hit delete, none of the lines in the selection were actually deleted!! What happened was the line below and outside the selection was joined with the last line in the selection. I was able to reduce the sample file to the following test case (which I will attatch to this bug): <html><body>Line 1<br> Line 2<br></body></html>
Attached file Simple test case.
Adding nsBranch keyword as per beppe. Cc jfrancis.
Status: NEW → ASSIGNED
Keywords: nsBranch
Priority: -- → P2
Target Milestone: --- → mozilla0.9.3
I just attatched a one-liner that fixes the problem. I just need to do some testing to make sure it doesn't screw something up. :-) Any testing help would be greatly appreciated.
Whiteboard: FIX IN HAND
r=brade
sr=waterson
FYI, the bug happens because nsHTMLEditRules::WillDeleteSelection() calls nsWSRunObject::PrepareToDeleteRange(), which can generate transactions that delete the insignificant whitespace at the ends of the selection, before the actual DeleteSelection is done. These transactions cause the selection to be collapsed, so when we actually do get around to deleting the selection, it acts as a backspace. The patch adds an auto variable that tells these transactions not to reset the selection.
Fix checked into the trunk: mozilla/editor/base/nsHTMLEditRules.cpp revision 1.186 Fix should appear in the 07/19/01 QA builds.
Keywords: vtrunk
verified on 7/19 trunk...removing vtrunk keyword.
Keywords: vtrunk
Adding nsBranch+ per beppe.
Whiteboard: FIX IN HAND → [reviewed][fixed on trunk][nsBranch+]
Kin, pls check into the branch. Thanks.
Whiteboard: [reviewed][fixed on trunk][nsBranch+] → [PDT+][reviewed][fixed on trunk][nsBranch+]
kin: weren't sure if you were around tonight, so I checked this in.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Thanks blake!
verified on 7/23 branch build.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: