readline: refactor conditional expressions