Copy tweaks from master
Save cursor position when switching buffers