Reduce some nesting and make it a little easier to follow. refs: https://github.com/wez/wezterm/pull/5316