Bug 17986

Summary: Typing into a textarea or a rich-edit area handles end/home incorrectly
Product: WebKit Reporter: Ojan Vafai <ovafai>
Component: HTML EditingAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: adele, aroben, ojan, ovafai
Priority: P2 Keywords: PlatformOnly
Version: 525.x (Safari 3.1)   
Hardware: PC   
OS: Windows XP   
Attachments:
Description Flags
using home/end in FF vs. Safari Windows none

Description Ojan Vafai 2008-03-21 11:43:41 PDT
In any textarea or rich-edit area:
1. type a couple lines of text
2. click into the middle of the last line
3. hold down shift and press up a couple times to select a couple lines
4. still holding down the shift key, press end 

Step 4 moves the end of your selection to the line you clicked in during step 2, which is incorrect. It also does the wrong thing if you hit end without the shift key held down in step for. In that case, the cursor should go to the end of the line where the end of your selection was. Instead it goes to the line you clicked into during step 2.

The same problem applies to the home key, except in step 2 you click in the middle of the first line and then use shift+down in step 3.
Comment 1 Eric Seidel (no email) 2008-05-07 15:44:09 PDT
This might be a mac vs. pc difference.  I'm not even sure what is supposed to be going on here.  A clear test case could help.
Comment 2 Ojan Vafai 2008-06-26 13:14:47 PDT
home/end should move relative the focus of your selection, not the anchor. I think in webkit terms, that's to say, home/end should move relative the extent of the selection and not the base.

This is kind of a mac/pc difference in that home/end on a PC move to the beginning/end of a line and on a mac go to the beginning/end of the edit area. I'm not sure exactly how to provide a clear test case though. I'll put up screenshots of actual vs. expected results.
Comment 3 Ojan Vafai 2008-06-26 13:27:58 PDT
Created attachment 21959 [details]
using home/end in FF vs. Safari Windows
Comment 4 Ojan Vafai 2008-06-26 13:31:00 PDT
In that screenshot there's FF and Safari Windows after the following steps:
1. Place the cursor before the word "two"
2. Press shift+down twice (end of the selection is now right before the word "four")
3. Press shift+home (should move the beginning of "line four", instead moves to the beginning of "line two")

Given that home/end do the windows behavior, I think it should really be consistent with other Windows apps in terms of how it works for selected text.
Comment 5 Ojan Vafai 2008-06-26 13:35:22 PDT
OK, one last comment, the mac analog of moving to the beginning/end of a line (cmd+left/right) is consistent with Safari. So, in short, I think home/end should behave Windowsy on Windows Safari. :)