-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CLOSED] New lines always create white spaces #2918
Comments
Comment by TomMalbran Change the Tab settings at the status bar to use Tabs instead of Spaces and it should insert tabs when indenting instead of spaces. |
Comment by MiguelCastillo Hi, thank you for your response. I made sure I tried that before logging this issue. With either tabs or spaces selected in the status bar spaces are always inserted on new lines. I am running on sprint 21 with latest github changes. Did you have a second to try to reproduce the issue? |
Comment by pthiess reviewed |
Comment by njx
|
Comment by redmunds I can't reproduce on Win7 using same steps as NJ. I verified using the Brackets Show Whitespace extension (https://github.com/DennisKehrig/brackets-show-whitespace). |
Comment by MiguelCastillo Sorry I haven't gotten back to this. It is rather easy to reproduce. I am on win7 x64...
The issue happens with any file... https://github.com/MiguelCastillo/bracket-whitespace/blob/master/Untitled.js |
Comment by MiguelCastillo I found what you need to do to reproduce the issue! Set you "Spaces" to a value other than "Tab Size". If your tab sizing is 4, change spaces to to 2 or 3 or whatever that isn't multiple of whatever tab sizing is... I am sooo much happier now that I know how to get around the issue! Set white spaces and tabs to 4 :) |
Comment by redmunds
Note that the CodeMirror SHA has been updated in Brackets, so use If not, can you install the Show Whitespace (https://github.com/DennisKehrig/brackets-show-whitespace) extension to help us all visualize the problem? Use Show > View Whitespace to enable it. |
Comment by redmunds I just noticed in the status bar of your screen shot it says "Tab Size 4". Maybe that's not clear, but it indicates to use Tabs instead of spaces. Click on "Tab Size" once and it will change to "Spaces". Does that fix it? |
Comment by MiguelCastillo AH!! Yes, that fixed it too. The usability for that setting is rather confusing. If the ui is displaying "Tab Size 4", I am expecting that tabs are being used for spaces. Switching to "Spaces 4" should give me spaces. Hummm. The interesting thing is that when "Tab Spaces" and "Spaces" have the same value, they both insert tabs... I am not sure if this is an issue or just more confusion on my part :) My question would then be what is the purpose of the little confusing setting? Thanks for you help |
Comment by njx Also |
Comment by MiguelCastillo I have tried plain install of brackets with no extensions when providing feedback on the issue... The behavior is the same with and without the extensions I use, so the screenshots I have provided do show extensions being used. Here is a screenshot if my extensions' folder |
Comment by MiguelCastillo
|
Comment by redmunds Brackets uses "soft tabs", so if you have your preference set to insert 4 spaces, using the keyboard left/right arrows will advance by 4 spaces at a time, the same as if you had tabs. Maybe that's what you're seeing. The Display Whitespace extension will show you exactly what you have (but it can make the editor a little sluggish, so I disable it when not using it). According to your screenshot, all of the extensions are installed in Brackets. Move them to the Roaming/Brackets/extensions/disabled folder to disable them. |
Comment by MiguelCastillo As I mentioned before, I made sure to test without any extensions. Also tests with my extensions give the exact same result as without... The screenshot was just to show But yes The setting gets even more confusing when spaces and tab spaces have different values. Not at all what I expected. As far as this issue is concerned, it seems like things are working as designed; whether good or bad usability. Thanks for your feedback guys! :) |
Comment by njx Hi I believe the behavior we originally intended is that the "Tab Size/Spaces" control is independent of the number control, and switching between "Tab Size" and "Spaces" is supposed to just switch whether you're using hard or soft tabs. The intended behavior should be (if the number is set to "n"):
That's clearly not what's happening now: if you set a value while "Spaces" is showing, and then switch to "Tab Size", the number also changes. I think that's just wrong. I'll try to see when this broke--it's possible that it broke when we switched to CodeMirror v3; maybe the semantics of the indent-related options changed and we didn't notice. Thanks for sticking with us and patiently explaining the problem! |
Comment by TomMalbran The Tab Size and the Space Indentation numbers are different values. So you could have Tab Size and 4 and Spaces and 2, since there are 3 different values set in the Editor (Spaces/Tabs, Tab Size and Spaces Indentation). I believe that is the correct behavior here. |
Comment by redmunds I think this is working as designed. You can have different values for Spaces and Tabs. Consider the case where you have Spaces 2 and Tab Size 4. Clicking on Spaces/Tab Size toggles between the settings. When Spaces is showing, you'll get 2 spaces for each indent or Tab key. Brackets will not insert any Tab chars, but if you happen to have any in your page, they will be displayed a 4 spaces (which is why it says "Tab Size" instead of "Tabs"). And you get the soft tab behavior with spaces. When you switch to Tab Size, then it's as you describe above. Brackets inserts a single Tab char and displays it to 4 spaces. You do not get soft tab behavior. The Spaces setting is not used, but it's remembered for when you switch back to Spaces. |
Comment by MiguelCastillo It makes sense to have two independent values if you want to extra flexibility, I actually do like it. But consider the size of this thread to explain something as simple as tab/space... There is something inherently wrong with the usability. LOL, the setting isn't that big of a deal. I am just happy I understand how to get my tabs inserted when pressing the return key :) |
Comment by njx
I agree that you want to set all these things individually potentially, but I think the current design ends up conflating things in a confusing way. I'm going to go ahead and call this "move to backlog" to discuss refining the UI here. Thanks everyone for your input! |
Comment by njx Marking "move to backlog" and removing from Sprint 22. |
Comment by TomMalbran I see the problem now. It seems like we are using indentUnit in the wrong way, since it should apply for both tabs and spaces and not just spaces as we do. I have a simple fix for this that I could post soon. |
Comment by redmunds
|
Comment by TomMalbran If you have indentUnit set to 4 and Tab Size set to 2, then it inserts 2 tabs instead of 1. If you change the indentUnit option in CodeMirror to 2, then it will insert 1 tab as expected. It seems like CodeMirror uses the indentUnit for both tabs and spaces when indenting and not just spaces as how we handle it, so we need to change the indentUnit when changing the tabs. |
Comment by njx
|
Comment by njx Nope, it looks like it's always worked this way, so it's not a regression. Leaving it as "move to backlog" so we can figure out what we want to do with it. |
Comment by TomMalbran I think it always worked like this. Check a look at my possible fix #3209. |
Comment by redmunds
Yes, I'm seeing that problem. |
Comment by jasonsanjose Just catching up with this discussion. If it's helpful, the original pull request for this issue was #1801. |
Comment by redmunds This was auto-closed, so re-opening. This now behaves as it was designed, but we may want to change the design. Note that this (some what cryptic?) design was reached because Brackets does not have a Preferences dialog. Once a Preferences dialog is added, the UI can be more verbose about these settings, and the status bar can be simplified. |
Issue by MiguelCastillo
Monday Mar 11, 2013 at 22:00 GMT
Originally opened as adobe/brackets#3100
When pressing enter to create a new line, white spaces are always inserted. For example, if you put the cursor at the beginning of a line and press enter, white spaces are inserted. This is really annoying if you use tabs.
This seems to be a recent regression.
Thanks,
Miguel
The text was updated successfully, but these errors were encountered: