Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 350595

Summary: Mac keyboard bindings
Product: [ECD] Orion Reporter: Mihai Sucan <mihai.sucan>
Component: ClientAssignee: Felipe Heidrich <eclipse.felipe>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: bokowski, eclipse.felipe, mihai.sucan, Mike_Wilson, Silenio_Quarti
Version: 0.2   
Target Milestone: 0.2   
Hardware: Macintosh   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Mihai Sucan CLA 2011-06-28 11:13:06 EDT
Build Identifier: 

There are a number of keyboard shortcuts that are standard for Mac users, but they are not implemented in Orion.

Some of these are Ctrl-A/E (line start/end) or Ctrl-W (delete one word backwards), and so on.

I am going to attach a pull request which better aligns the Orion TextView default keyboard bindings to those of a standard Mac editor.

(Please note that these keyboard shortcuts are implemented by default, actually, in contentEditables and in textareas, by Gecko. I am just going to make a patch to Orion to allow expected behavior in such contexts.)

Reproducible: Always
Comment 1 Mihai Sucan CLA 2011-06-28 11:27:27 EDT
Pull request submitted:

https://github.com/eclipse/orion.client/pull/5

I believe that these shortcuts belong to the TextView, because they are basic/native/standard bindings for Macs.

For example Gecko has these keyboard bindings defined here:

http://mxr.mozilla.org/mozilla-central/source/content/xbl/builtin/mac/platformHTMLBindings.xml

We would like to have this in Orion, so we can keep our integration code minimal.

Please let me know if further changes are needed. Thank you! Suggestions for improvements are very much welcome.
Comment 2 Felipe Heidrich CLA 2011-06-28 12:05:49 EDT
I think that is good idea. I will try out the patch and hopefully release it this afternoon.
Comment 3 Felipe Heidrich CLA 2011-06-28 16:32:03 EDT
Hi Mihai,

I tested the changes and I tested also shortcuts in TextEdit, Chrome contentEditable and Firefox contentEditable.

Here are my results:

page down/page up/text start/text end - scrolling without changing the selection is fine works the same everywhere.

emacs key bindings:

It seems that Firefox is a bit different than Chrome and TextEdit (and this page too http://www.danrodney.com/mac/).

These commands exist in Firefox but don't exist in TextEdit/Chrome
w - delete word previous
u - delete line start (not working in textview on chrome)

These commands exist in TextEdit/Chrome but don't exist in Firefox 
y - undo kill (yank)
l - center current line
o - insert line break without moving caret
t - transpose

These commands are the same:
a - line start
e - line end
f - char next
b - char previous (not working in textview on chrome)
d - delete next
h - delete previous
n - line down
p - line up
v - page down (textview/firefox does not update the caret, others do)
k - delete line end (kill)

I would personally mirror the bindings from TextEdit as it is, IMO, the best reference for the platform. 

What do you think ?
Comment 4 Mihai Sucan CLA 2011-06-28 16:42:07 EDT
(In reply to comment #3)
> Hi Mihai,
> 
> I tested the changes and I tested also shortcuts in TextEdit, Chrome
> contentEditable and Firefox contentEditable.

Thank you for looking into the patch and testing it.

Please note I wrote it on a Linux PC, with some Mac friends who tested it later. :)


> Here are my results:
> 
> page down/page up/text start/text end - scrolling without changing the
> selection is fine works the same everywhere.
> 
> emacs key bindings:
> 
> It seems that Firefox is a bit different than Chrome and TextEdit (and this
> page too http://www.danrodney.com/mac/).
> 
> These commands exist in Firefox but don't exist in TextEdit/Chrome
> w - delete word previous
> u - delete line start (not working in textview on chrome)

These must be coming from emacs. We'd like them in the patch, since they are in Firefox by default.

If you want I can put them behind if (isFirefox). Do you want this?


> These commands exist in TextEdit/Chrome but don't exist in Firefox 
> y - undo kill (yank)
> l - center current line
> o - insert line break without moving caret
> t - transpose

True. I did not implement them because Firefox does not implement them natively. Therefore, it was really a matter of giving users the expected Firefox behavior.

Nonetheless, your point is correct. Do you want me to implement these shortcuts as well? Or can these be in a separate follow-up bug? (we do not block on these)


> I would personally mirror the bindings from TextEdit as it is, IMO, the best
> reference for the platform. 
> 
> What do you think ?

Agreed. This patch brings Orion much closer to TextEdit behavior, with the exception of y/l/o/t.

Thanks again!
Comment 5 Felipe Heidrich CLA 2011-07-05 16:24:33 EDT
I will release your commit right now (the code is good, I tested it again) and I'll go over the code for a few cosmetic changes.

I will change so that u/w are only available on firefox, for non-firefox we should have y/l/o/t available (do you want implement them ?)


final notes (I'll work on these two):
-find out why command+b is not working on chrome 
-decide if command-v (page-down) should move the selection
-- in firefox answer is no
-- other ua the answer is yes (chrome/safari tested)


I personally think we should do it (it easy for us). My thinking is that textview should have native behaviour, and that we should use a plain contentEditable on the user-agent as the reference for the "native behaviour".

Agreed ?
Comment 6 Felipe Heidrich CLA 2011-07-05 16:38:57 EDT
Pushed http://git.eclipse.org/c/e4/org.eclipse.orion.client.git/commit/?id=e18c89ac53c275d11d9bf0b5a462a5ebae4d5c9f

I'll keep this bug open till we make all the little changes we have in mind.
Comment 7 Mihai Sucan CLA 2011-07-05 17:06:30 EDT
(In reply to comment #5)
> I will release your commit right now (the code is good, I tested it again) and
> I'll go over the code for a few cosmetic changes.

Sounds great!


> I will change so that u/w are only available on firefox, for non-firefox we
> should have y/l/o/t available (do you want implement them ?)

Agreed.

We have a lot of work on our plate for the devtools. I'd very much like to implement them, but I have other priorities now. :( We have some to meet for each Firefox release.


> final notes (I'll work on these two):
> -find out why command+b is not working on chrome 
> -decide if command-v (page-down) should move the selection
> -- in firefox answer is no
> -- other ua the answer is yes (chrome/safari tested)
> 
> 
> I personally think we should do it (it easy for us). My thinking is that
> textview should have native behaviour, and that we should use a plain
> contentEditable on the user-agent as the reference for the "native behaviour".
> 
> Agreed ?

Agreed.

Ultimately it's best to follow the system-native behavior.

Given Firefox does things differently ... you can file bugs into our Bugzilla for us to fix our issues.

Thank you for the code push! Now I can update our integration code.
Comment 8 Mihai Sucan CLA 2011-07-05 17:12:18 EDT
(correction)

(In reply to comment #7)
> We have some to meet for ...
... We have some goals to meet for ...
Comment 9 Felipe Heidrich CLA 2011-07-06 15:24:39 EDT
(In reply to comment #7)
> We have a lot of work on our plate for the devtools. I'd very much like to
> implement them, but I have other priorities now. :( We have some to meet for
> each Firefox release.

That is fine, I'll report a bug for that and if you ever find time to work on this before I do just add a note to the bug so we don't duplicate any efforts.
Comment 10 Mihai Sucan CLA 2011-07-06 16:32:01 EDT
(In reply to comment #9)
> (In reply to comment #7)
> > We have a lot of work on our plate for the devtools. I'd very much like to
> > implement them, but I have other priorities now. :( We have some to meet for
> > each Firefox release.
> 
> That is fine, I'll report a bug for that and if you ever find time to work on
> this before I do just add a note to the bug so we don't duplicate any efforts.

That's fine for me as well. Please CC me to the bug. Thank you!

If there's nothing else to do here, you can mark this bug as fixed, then.
Comment 11 Felipe Heidrich CLA 2011-07-07 10:30:41 EDT
Agreed, closing bug

see bug 351455 for the y/l/o/t keybindings