[Mystery solved] Decrease tab width to 4 space

The Swift forums render tabs in code blocks as 8 spaces wide. It's pretty restricting given how narrow the UI is, and differ from Xcode, which defaults to 4 spaces.

Could we change it?


class MyClass {
	func aFunction() {
		for i in 1...10 {
			print("This is getting pretty wide!")

Your example renders as 4 characters wide for me.

As a workaround, you could trying joining the civilized world and indenting with 2 spaces instead of a tab :-)

1 Like

Might be a browser-specific thing? The tabs are rendered 4-wide in Safari on Catalina for me as well.

If you're after a specific width why not use spaces? :p

I haven't seen consensus on this in the Swift community. The standard library defaults to 2 spaces, Xcode defaults to tabs, but in any case, I think space-gang and tab-gang can agree that linux kernel 8-space tabs is tooo wiiiiide

Interesting. I see it 8 spaces wide in

  • Firefox Nightly 77.0a1 (2020-04-07) (64-bit)
  • Firefox Stable 74.0.1 (64-bit)

but 4 spaces wide in

  • Chrome Version 80.0.3987.163 (Official Build) (64-bit)
  • Safari Version 13.1 (15609.

I wonder if it's being caused by one of my add-ons or style sheets. It's not something I've intentionally altered.

If you're after a specific width why not use spaces? :stuck_out_tongue:

Well the whole benefit is that users could decide for themselves on their end, though Discourse doesn't seem to have a setting for that (that I can find)

Looking at the CSS being used here, it seems that Discord is setting tab-size to 4, but according to this page Firefox currently only supports that property with the -moz- prefix. Discord would need to add the prefixed property as well, or Firefox would need to start supporting the unprefixed property.


Interesting find, that's it! tab-size and -tab-size both yield "Invalid property name" only -moz-tab-size works.

1 Like

What happens if you just use spaces and no tabs? Developers who use spaces make more money than devs who use tabs, you know.

It's fixed :) https://meta.discourse.org/t/add-moz-tab-size-until-firefox-supports-tab-size/149924

Though the Swift forum isn't running that latest version yet, so it hasn't picked up the change just yet

Terms of Service

Privacy Policy

Cookie Policy