Sublime Forum

Spaces Bug

#1

Hey everyone!

Quite frequently, I am getting weird spaces.
Because of that, I am running into IDE highlight errors when using C# and runtime errors using JavaScript.

Here is a video showing the issue:

This is a screenshot of Safari’s debugger when the issue happens:

Those are my settings (can’t add full links due to new users being restricted to 2 links):
https //www shushustorm com
/_Uploads/SublimeText/3207_SpacesBug_Settings/Default (OSX).sublime-keymap
/_Uploads/SublimeText/3207_SpacesBug_Settings/Distraction Free.sublime-settings
/_Uploads/SublimeText/3207_SpacesBug_Settings/Preferences.sublime-settings

I am using macOS 10.13, SublimeText 3207 for writing code and Visual Studio Code for debugging.

Best wishes,
Shu

0 Likes

#2

can you paste the code somewhere?

0 Likes

#3

Does it happen in Sublime Text 4?

0 Likes

#4

@jfcherng
Of course! Forgot about the most obvious!
Not the same code as in the example, since I fixed that already, but here you go:
"
public void Key_Case () {
}
"
I guess it’s always between the regular and the curly braces. Or between method name and opening the regular braces.

@bschaaf
Not sure, unfortunately, since I try to keep a stable workflow across multiple devices and right now, things do work quite well. Granted, with the exception of this, though. Maybe I’ll test version 4 if I can install it alongside the version I am currently using.

0 Likes

#5

Not sure whether the forum does some sanitizations or not. This looks good to me.

0 Likes

#6

Just in case, here is a file that should contain the issue:
https://www.shushustorm.com/_Uploads/SublimeText/3207_SpacesBug_Keyboard.cs
It doesn’t show the highlight errors in SublimeText itself, but Textastic shows them unless I replace some of the whitespace with “regular” whitespace.

EDIT:
I just updated the file to only show the affected area. And it does have something going on indeed. I just sent the file to myself via email and when previewing it in macOS’s Mail, it shows ordinary white space; however, when opening the file in Safari, I am getting an “” between the regular and the curly brackets.

0 Likes

#7

That space is 0xa0 ( ). I best guess would be it’s copied from some websites, which change regular spaces into 0xa0 sometimes.

0 Likes

#8

Might happen in general, but on my end, I always type the code myself, even when looking at a reference. Not sure why this happens, but it regularly places those when I type. I do copy & paste from one SublimeText window to another SublimeText window, if that makes a difference.
Thanks for the reply, though! It’d be great if this could be solved. I am regularly replacing this character and it’s somewhat annoying.

0 Likes

#9

I may test

  • Does it only happen in ST?

    • If yes, provide the plugin list, which can be found in the settings file of Package Control.
0 Likes

#10

Yes, it does only happen when I am using SublimeText. I used Visual Studio Code (even older code from VSC doesn’t show this issue after having edited the files in Sublime) before I decided for bigger files, it’s just getting too slow, so I moved to Sublime, which works much faster, especially without any additional installations.
So I haven’t installed any plugins, just a regular installation of SublimeText. When I navigate to “Tools”, I see the “Install Package Control…” option, so I guess there is no plugin list to begin with, which makes sense, since I never installed any.

0 Likes

#11

0xC2 0xA0 is UTF-8 for a non-breaking space. At least on a Mac this can be entered by holding the option/alt key while pressing space.

Maybe this? https://github.com/sublimehq/sublime_text/issues/851#issuecomment-140478868 But that should happen in other editors as well.

0 Likes

#12

Yes, that’s absolutely it! Thanks for the suggestion! That’s indeed the issue! I just tried typing a method as I regularly would and then another time trying to deliberately not press the alt key when pressing the space bar. The result: First method shows the issue, second one doesn’t: https //www shushustorm com/_Uploads/SublimeText/3207_SpacesBug_Test.cs (can’t link to that host, maybe too many links to the server?)
Still, I only ever encountered this using SublimeText.
Maybe there is a way to disable this. I never need that character and I am just used to typing like that since I immediately need the curly braces afterwards.
EDIT:
Ineed there is a solution here, even one of the replies includes a Sublime solution specifically:
https://superuser.com/questions/78245/how-to-disable-the-option-space-key-combination-for-non-breaking-spaces

0 Likes