Fixed cursor bug, when switching between spec and class.

Switch buffer instead of re-editing the file, if possible,
to avoid cursor jumping to top of the file all the time.