Page Up, Page Down, Home, End

by sweavo

Chatting about Macs with a fellow owner, and we agreed on a few minor details where Windows beats Mac OS. Four of them were the behaviour of the Page Up, Page Down, Home and End keys.

In case you’re a Mac owner, I’m talking about the ⇞, ⇟, ↖ and ↘ keys.

We basically found that we didn’t know what these keys really did and ended up not using them deliberately, and occasionally using them by accident, ending up with confusion.

Investigation

So first I thought I’d take a moment to survey how to do the basic navigation operations in both environments, and then see about tuning one to smooth the transition between environments.

This was done using EditPadPro in windows, and MacOS’s built-in TextEdit.

cursor to start/end of line:

Windows: home/end
Mac: cmd + left/right (also the emacs commands ctrl + a/e work all over the Mac and in bash)

select to start/end of line:

Windows: shift + home/end
Mac: shift + cmd + left/right

So far so good; in both environments, add shift to extend the selection

go to prev/next word:

Windows: ctrl + left/right. If within a word, left goes to the start of the current word.
Mac: alt + left/right (actually, right goes to the end of current/next word)

Again in both, adding shift extends the selection by the expected amount

move cursor up/down one page:

Windows: page up / down
Mac: alt + page up / down

Here the dissonance begins. Page up / down on its own on the Mac scrolls without moving the insertion point. As soon as you type or cursor around, the display jumps back to the insertion point. Maybe some people use this all the time? I don’t, it just jars during edit sessions. Additionally, alt + up / down do the same as page up / down except without scrolling smoothly. And adding shift to alt + up / down does NOT extend the selection. Go figure.

move cursor to start / end of document:

Windows: ctrl + home / end
Mac: cmd + down

cmd + left / right were start / end of line, so it’s reasonable that cmd + up / down should be start / end of document, but:

select to end of document:

Windows: shift + ctrl +  end
Mac: shift + cmd + down

Again, add shift. All’s well. But the Mac also supports shift + end, throwing us windows brain-damaged off the scent.

So the biggest difficulty switching between environments is remembering that windows’ home and end functionality is taken by cmd and the arrow keys.

Mitigation:

A quick google revealed KeyReMap4MacBook, and though it’s limited in that you can’t easily exchange key mappings, I managed to hack up an xml file that gives you more windows-like home, end, page up and page down keys.

Follow the instructions for custom key remaps, and once you’ve opened private.xml, paste this:

<?xml version="1.0"?>

<root>

    <item>

        <name>Home and end like Windows</name>

        <identifier>private.windows_home_end</identifier>

        <autogen>__KeyToKey__ KeyCode::HOME, KeyCode::CURSOR_LEFT, VK_COMMAND</autogen>

        <autogen>__KeyToKey__ KeyCode::END, KeyCode::CURSOR_RIGHT, VK_COMMAND</autogen>

    </item>

    <item>

        <name>Page Up / Down like Windows</name>

        <identifier>private.windows_pgup_pgdn</identifier>

        <autogen>__KeyToKey__ KeyCode::PAGEUP, KeyCode::PAGEUP, VK_OPTION</autogen>

        <autogen>__KeyToKey__ KeyCode::PAGEDOWN, KeyCode::PAGEDOWN, VK_OPTION</autogen>

    </item>

</root>


Advertisements