Fix navbar overflow and incorrect cursor movement

(Thanks, @mdo!)