Closed Bug 118629 Opened 23 years ago Closed 19 years ago

Shift-LeftArrow-Copy picks up newline (caret renders in wrong place)

Categories

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

defect

Tracking

()

RESOLVED FIXED
mozilla1.8.1

People

(Reporter: kinmoz, Assigned: uriber)

References

()

Details

(Keywords: fixed1.8.1)

Attachments

(2 files)

This bug was initially reported in bug 110186 by kevinar18@hotmail.com ... 
giving it, it's own bug number for tracking.

---- kevinar18@hotmail.com wrote:

Try this:
Go to attachment 57242 [details]
Your cursor should already be positioned right after the D like so (| = cursor):
D|
1.  So do NOT click in the box with the mouse to position the cursor.
2.  Using keyboard combo SHIFT + LEFT ARROW, hightligh the letter D.
3.  Copy the letter using keyboard combo (CTRL + V)
4.  While the letter is still highlighted, hit paste a few times using CTRL V.

You will notice that the Letter "D" is posted all on separate lines....  This 
should not be.

----

The textarea in question, contains a blank line at the end, so I'm assuming that 
the caret should initially be on the blank line below the D, between the 2 <BR> 
nodes at the very end, so shift-left will actually select "D<BR>" hence the 
newline ... which is correct, the problem seems to be that when you initialy 
scroll the textarea down, the caret is rendering right beside the 'D' character:

    D|

instead of below it:

    D
    |

like it should.
Thanks for submitting it.  I was about to do so myself.  I just didn't feel like
taking all the time to start a new bug earlier.
Target Milestone: --- → mozilla1.2
Priority: -- → P3
Target Milestone: mozilla1.2alpha → Future
jfrancis, is this a case where the interline position the editor sets is wrong?
Assignee: kin → jfrancis
kin: sounds likely.  especially since this is a text widget, which doesn't have 
all the brainpower that the html editor has.  unfuturing...
Status: NEW → ASSIGNED
Target Milestone: Future → ---
Target Milestone: --- → M1
differentiating bug severity of my most critical bugs vai abuse of milestone field
M2: severe
M1: very severe and/or fix in hand
Target Milestone: M1 → M2
Confirmed on OS X:
Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.9a1) Gecko/20051001
Firefox/1.6a1 ID:2005100107
OS: Windows 2000 → All
Hardware: PC → All
Attached file Simpler testcase
Easier-to-use testcase.
Notice that there is no need for the shift-left, copy, paste maneuver. Simply
typing a character will also do.
Attached patch patchSplinter Review
This patch fixes this bug, and also replaces my previous fix for bug 308023.

Whenever text is inserted, either by setting the value (as in this bug), by
typing (as in bug 308023), or by pasting (with which a bug existed, but was not
reported), use the following rule:
* If the inserted text ends with a newline, set the hint to HINTRIGHT, i.e.
ensure that the caret will appear on the line following the newline.
* Otherwise, set the hint to HINTLEFT, i.e. ensure that the caret is adjacent
to the last inserted character.

My previous fix for bug 308023 worked well for the typing case, but incorrectly
interfered with the "paste" case (when the pasted text ended with a NL), and
also prevented fixing this bug (the "set value" case).
Assignee: mozeditor → uriber
Attachment #198487 - Flags: superreview?(roc)
Attachment #198487 - Flags: review?(roc)
Target Milestone: M2 → mozilla1.9alpha
Attachment #198487 - Flags: superreview?(roc)
Attachment #198487 - Flags: superreview+
Attachment #198487 - Flags: review?(roc)
Attachment #198487 - Flags: review+
Patch checked in by smontagu%smontagu.org, 2005-10-06 01:19.
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Attachment #198487 - Flags: approval1.8.1?
Attachment #198487 - Flags: approval1.8.1? → branch-1.8.1?(roc)
I'm a bit scared to land a bunch of caret/selection/bidi fixes on the branch. Uri, do you have a good feeling for how things currently are on the trunk? Are we in a good state?
(In reply to comment #9)
> I'm a bit scared to land a bunch of caret/selection/bidi fixes on the branch.
> Uri, do you have a good feeling for how things currently are on the trunk? Are
> we in a good state?

As far as I know, there are currently no regressions on the trunk resulting from caret fixes. That is, the trunk is in an absolutely-better state (caret-wise) than the 1.8 branch.
Attachment #198487 - Flags: approval-branch-1.8.1?(roc) → approval-branch-1.8.1+
Checked in to 1.8.1 branch:
Checking in mozilla/editor/libeditor/text/nsTextEditRules.cpp;
/cvsroot/mozilla/editor/libeditor/text/nsTextEditRules.cpp,v  <--  nsTextEditRules.cpp
new revision: 1.195.4.1; previous revision: 1.195
done
Keywords: fixed1.8.1
Target Milestone: mozilla1.9alpha → mozilla1.8.1
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: