How to adapt pair programming to a shared terminal environment like Cloud9? Pair programming rather than solo programming is best practice in the CS classroom. Online IDEs like Cloud9 allow both members in the pair to work in a shared environment like google docs: working with independent keyboards and mice. What are effective practices for students working side-by-side to collaborate in such an environment?

I've experimented in my classroom and have arrived at my own solution, but I think the question deserves crowd creativity and crowd evaluation. 

Note: I've experimented with Cloud9 in both online and onsite instruction, with different results. This question is about students working onsite, side-by-side.

Background:

Extensive use of pair programming in the K-12 environment is best practice over solo programming. Pair programming increases persistence and engagement, and reduces frustration and boredom. See for example Hanks et al. (2011) Pair programming in education: A literature review. Computer Science Education 21:2.

Schools are increasingly using Chromebooks, which preclude a locally installed IDE. Computer science is being taught in an increasing number of sections on a school's master schedule, precluding instruction exclusively in a desktop computer lab environment. Effectively teaching programming using Chromebooks is important.
I tend to avoid multiple students working on the same code simultaneously (Google Docs style) because it's really difficult to assess what has been done by each student or to stop one student dominating whilst the other doesn't understand what's happening. Either that or students tend to get distracted by what the other is writing.

Having said that, you could try:


One person writes code whilst the other writes comments. This forces the two to discuss both what they're doing and what they're planning to do next.


Other paired programming techniques that don't involve simultaneous access:


Allocating a 'driver' and a 'navigator' to each pair of students: the navigator isn't allowed to touch the mouse of keyboard. The driver has to follow the navigator's instructions. Students swap after a set time. 
Sabotage and share: get students to make deliberate syntax / runtime / logical errors in their code then share a link to their code in a shared document / forum. Get students to record each error they find and fix. Award points per bug fixed.