Closed Bug 310227 Opened 19 years ago Closed 19 years ago

Deleting characters with backspace makes the caret disappear in Editor and textareas

Categories

(Core :: DOM: Editor, defect)

defect
Not set
major

Tracking

()

VERIFIED FIXED

People

(Reporter: tobias, Assigned: rbs)

References

Details

(Keywords: regression)

Attachments

(3 files)

Using 
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9a1) Gecko/20050927
SeaMonkey/1.1a Mnenhy/0.7.2.10010 {Build ID 2005092706}

deleting some Charakters in MailNews Editor while compose Message let Caret
desapear. Write on reanimate Caret in most cases after type the same Number of
deleted Charakters. This was first seen in Build 2005092704 by Rüdiger Lahl
<dhcbh2.2jg.1@privat.lahls.de> 

Reproduceable: always

Steps to reproduce:
1. Start to compoe a Message
2. type some text in Message Body
3. Delete some Charakters using Backspace

Actual Results:
when write on, Caret has disapeared mostly for the number of deleted Charakters
Also while file this Bug here, the Caret was invisible after I have deleted some
Charakters. Possible regression from Checkin for Bug 308023?
Keywords: regression
I'm looking into this. I can reproduce the bug with the 2005-09-27 SeaMonkey
build. However, I do not see the bug with my own Firefox build, which contains
the fix to 308023 - so I'm not sure it's a regerssion from that fix. I'll keep
investigating.
Summary: Deleting Charakters with Backspace let Caret disapear in Editor → Deleting characters with backspace makes the caret disappear in Editor and textareas
Severity: normal → major
OS: Windows 2000 → All
Hardware: PC → All
I verified that this is NOT a regression from 308023 by getting the latest
sources, compiling, reproducing the bug - then backing out 308023, recompiling -
and the bug is still there.

I'll continue investigating this tomorrow (unless someone else figures it out by
then).
No longer depends on: 308023
Could it be bug 307875, then?
Depends on: 307875
Blocks: 307875
No longer depends on: 307875
(In reply to comment #3)
> Could it be bug 307875, then?

Yes, backing out the patch for 307875 does fix this.
This is surprisingly annoying.
Flags: blocking1.8.1?
Investigating....
Assignee: mozeditor → rbs
Flags: blocking1.8.1? → blocking1.9a1?
*** Bug 310434 has been marked as a duplicate of this bug. ***
This patch restores the caret by resetting |mDrawn| when the caret is erased.
Since poking into dirty frames is blocked, there are early returns causing it
not to be reset.

The real underlying effect is that the next nsCaret::DrawCaret() will refetch
the frame & offset (which are up-to-date by the time the caret is redrawn).
http://lxr.mozilla.org/mozilla/source/layout/base/nsCaret.cpp#862

However... we are back to bug 304383. Wwhen you delete the last character,
there is a character-data-changed, which marks the frame dirty. Then comes a
content-removed (since it was the last char), and the hack added in bug 304383
to erase the caret has no effect. That hack does not work anymore because of
the early returns (due to the frame being dirty).
Disable one of the early returns that affect the caret.

The caret holds a lastcontent & lastoffset (I noted that it used to hold a
frame but this was changed to fix similar out-of-sync issues in bug 296464).
The caret needs them to erase itself from its old location.

[Since the frame can become out-dated, why not just keep the old rect. This
way, the caret won't have to figure out where it used to be based on old
frame/content/offset that could change under its feet. I hope folks reworking
the caret in bug 287813 will think carefully through these things.]
Take a breadth by disabling those early returns that are causing troubles so
far.
Attachment #197968 - Flags: superreview?(bzbarsky)
Attachment #197968 - Flags: review?(bzbarsky)
Comment on attachment 197968 [details] [diff] [review]
bring the caret back - take 3

Could also leave them on in debug builds so people see the asserts... (and
those _are_ asserts, right?)
Attachment #197968 - Flags: superreview?(bzbarsky)
Attachment #197968 - Flags: superreview+
Attachment #197968 - Flags: review?(bzbarsky)
Attachment #197968 - Flags: review+
Checked in.

OK, I moved the #if 0 after the DEBUG_VERIFY test so that people (who have added
themselves in the DEBUG_VERIFY test) can see the warning messages.

NS_WARNING is not an assert or Windows. The real assert (NS_ASSERTION) is harsh
(on Windows). It can be quite painful if it occurs a lot because each assert
pops up a modal dialog and possibly breaks into the debugger. You have to click
OK at each keystroke to get rid of the dialog box.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
*** Bug 310657 has been marked as a duplicate of this bug. ***
*** Bug 310748 has been marked as a duplicate of this bug. ***
*** Bug 310829 has been marked as a duplicate of this bug. ***
Verified FIXED using build 2005-10-03-05 of trunk SeaMonkey running on XP.
Status: RESOLVED → VERIFIED
Flags: blocking1.9a1?
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: