Closed Bug 82813 Opened 23 years ago Closed 22 years ago

Whitespace handling needs to be savvy to <pre>

Categories

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

defect

Tracking

()

VERIFIED FIXED
mozilla1.0

People

(Reporter: mozeditor, Assigned: mozeditor)

References

Details

(Whiteboard: [ws] EDITORBASE+; FIXINHAND; need a=)

Attachments

(1 file, 2 obsolete files)

WS handling code that I landed for moz091 does not check for <pre>.  I need to
add this in.  WS handling is very different for pre cases.  I'll attachsome test
cases later on.
Joe, moving this to 1.0, it seems like there is a lot fo detailed work that
needs to take place.
Priority: -- → P2
Whiteboard: [ws]
Target Milestone: --- → mozilla1.0
Status: NEW → ASSIGNED
Whiteboard: [ws] → [ws] EDITORBASE; 3 days
*** Bug 111974 has been marked as a duplicate of this bug. ***
There are four testcases in the duplicate 111974 but I have since found a fifth.
If you type extra spaces at the end of a <pre> line then when you try to delete
them you end up deleting the text instead...
Bugs targeted at mozilla1.0 without the mozilla1.0 keyword moved to mozilla1.0.1 
(you can query for this string to delete spam or retrieve the list of bugs I've 
moved)
Target Milestone: mozilla1.0 → mozilla1.0.1
pulling back to 098
Target Milestone: mozilla1.0.1 → mozilla0.9.8
pushing off 098 to 099
Target Milestone: mozilla0.9.8 → mozilla0.9.9
marking EDITORBASE+ per meeting
Whiteboard: [ws] EDITORBASE; 3 days → [ws] EDITORBASE+; 3 days
Keywords: nsbeta1+
Attached patch diffs for nsWSRunObject.h (obsolete) — Splinter Review
Attached patch diffs for nsWSRunObject.cpp (obsolete) — Splinter Review
this is a limited fix.	You will see uneven preservation of whitespace when you
merge two blocks, one a pre and one not.  However, to fix that I have to do
more than just make the current code smarter - I will have to potentially scan
through the entire block rather just it's boundaries.  To see this, consider
backspacing at the front of a pre that is after a (non-pre) paragraph.	The
text that was in the pre gets appended to the paragraph.  Any runs of
consecutive spaces anywhere in the old pre need to be converted to space-nbsp
combinations.

I think doing that might be beyond the scope of the editor (it is potentially a
performance problem).  So I've made limited fixes that are fast and that allow
normal editting behavior within pre's.
Whiteboard: [ws] EDITORBASE+; 3 days → [ws] EDITORBASE+; FIXINHAND; need r=, sr=
Comment on attachment 68847 [details] [diff] [review]
diffs for nsWSRunObject.h

sr=kin@netscape.com
Attachment #68847 - Flags: superreview+
Comment on attachment 68848 [details] [diff] [review]
diffs for nsWSRunObject.cpp

Are these intermediate assignments just for readability's sake, or can we
remove them?

+	    PRInt32 startOffset = point.mOffset;
+	    PRInt32 endOffset = point.mOffset+1;
+	    return DeleteChars(node, startOffset, node, endOffset);

The 2 blocks you added that call DeleteChars() need to have their indentation
fixed.

Heh, I was going to ask you why we didn't initialize outType, when looking at
one of your other patches:

+  *outType = eNone;

but then I realized "what's the point" if there's no code path that returns
without it being set?

sr=kin@netscape.com
Attachment #68848 - Flags: superreview+
Whiteboard: [ws] EDITORBASE+; FIXINHAND; need r=, sr= → [ws] EDITORBASE+; FIXINHAND; need r=
fixed on tip
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
From the testcases in bug 111974, it appears that this not totally fixed.
Tested on Win XP using 02-20 trunk build.

I am still seeing this issue if you:
1. Open Composer
2. Select Preformat from the paragraph drop-down
3. Type (without quotes) "    test"
4. Try to delete (either forward or backwards) the first t

Actual Results:
all but the first space is deleted.

Expected Results:
the t should be deleted and nothing else.

I am reopening this bug.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
This situation is a lot better now, but I think I can fix this issue too.
Target Milestone: mozilla0.9.9 → ---
pushed off EB+ get P1
Priority: P2 → P1
Target Milestone: --- → mozilla1.0
Whiteboard: [ws] EDITORBASE+; FIXINHAND; need r= → [ws] EDITORBASE+
additional tweak to fix the case mentioned in comment #13
Attachment #68847 - Attachment is obsolete: true
Attachment #68848 - Attachment is obsolete: true
Whiteboard: [ws] EDITORBASE+ → [ws] EDITORBASE+; FIXINHAND; need r=,sr=,a=
Comment on attachment 74693 [details] [diff] [review]
patch to nsWSRunObject.cpp

sr=kin@netscape.com
Attachment #74693 - Flags: superreview+
Whiteboard: [ws] EDITORBASE+; FIXINHAND; need r=,sr=,a= → [ws] EDITORBASE+; FIXINHAND; need r=,a=
Comment on attachment 74693 [details] [diff] [review]
patch to nsWSRunObject.cpp

r=brade
Attachment #74693 - Flags: review+
Whiteboard: [ws] EDITORBASE+; FIXINHAND; need r=,a= → [ws] EDITORBASE+; FIXINHAND; need a=
Comment on attachment 74693 [details] [diff] [review]
patch to nsWSRunObject.cpp

a=asa (on behalf of drivers) for checkin to the 1.0 trunk
Attachment #74693 - Flags: approval+
fixed on trunk
Status: REOPENED → RESOLVED
Closed: 23 years ago22 years ago
Resolution: --- → FIXED
Neil, can you verify this and mark verified-fixed? thanks
Status: RESOLVED → VERIFIED
This appears to have fixed all my five test cases.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: