the repetition of `use_tabs && has_tabs` is awful but I think it is better to leave refactoring it for later, since it is so short