[Core] Refactored tab size hint calculation for #1440.

Calculate once for all tabs.
[Core] Better tab width calc algorithm. Probably fixes #1440.