Comments (41)
Please fix it!
from text-buffer.
See http://discuss.atom.io/t/sometimes-tab-inserts-spaces-even-with-soft-tabs-off/3976/11
from text-buffer.
"Is your use case that you want to open a buffer containing soft tabs and still insert hard tabs? Or vice versa?"
Yes because in PHPDOC Block format the comments are sometimes pushed forward a little with a single space (for alignment) like so:
/*
*
Atom interprets that as "oh you have a space so everything will be spaces" which is annoying if the actual file is hard tabs.
from text-buffer.
Please fix. This is very annoying when working with a team.
from text-buffer.
I hate to add a +1, but this doesn't seem to be going anywhere and I'm going to have to go back to Sublime Text 2 when working on a js project that uses tabs by default, and FYI it absolutely seems to relate to the use of PHP/Javadoc style block format being used, that have a leading space in them.
from text-buffer.
+1
from text-buffer.
+1 from me as well. This annoys me to no end.
from text-buffer.
+1
from text-buffer.
+1
Switched back to Sublime Text 3 because of this behavior.
from text-buffer.
I'm also having this problem with the javascript editor on Ubuntu. I can't copy and paste tabs, and when I press the tab key to further indent a line that is already indented with tabs, it adds the new indent in spaces plus enough spaces to eqaul the tab amount, as if the tabs weren't there, ie with tabs set to 2 spaces a press of the tab key changes \t\t to \t\t......
from text-buffer.
Yes @mer10z it's very annoying. The editor works well when there are no comments in the code, as someone pointed earlier.
For example, if i have:
/**
- comment with spaces
*/
And you try to use tabs, you get spaces.
from text-buffer.
+1
from text-buffer.
Can someone post a file that reproduces this issue? I would have thought a previous fix that ignores comment blocks for purposes of determining the tab setting would fix this: https://github.com/atom/atom/blob/master/src/editor.coffee#L326
Are you guys having issues editing files with mixed tab styles?
from text-buffer.
This is related to atom/atom#2045.
from text-buffer.
@nathansobo
For me this issue has been completely resolved with something you fixed within the .90 - .99 releases so I haven't run across any file that has the issue. I wasn't sure if it was a fluke or not until your comment right now.
from text-buffer.
@nathansobo
The problems that I have are:
- (This problem) Where it inserts spaces instead of tabs even though I have soft-tabs off
- When I start atom, some files come up with 2 space tabs, even though I have it set to 4
- I regularly see tab stops not lining up on adjacent lines.
You can find an example file that I see exhibiting problem 1 here:
https://raw.githubusercontent.com/iandotkelly/atomissue/master/sample.js
If I select any line here and hit tab, it inserts 4 spaces (or two spaces if its also exhibiting problem described above). I have [email protected] installed - I have soft tabs off.
Thanks for showing an interest in my issue - atom would be fantastic if it wasn't for these issues I am seeing. Should I just nuke atom and start again?
from text-buffer.
@iandotkelly The file works fine for me in .99. I am able to tab anywhere and it will use tabs instead of spaces.
Additionally I have been going back and fixing all of the files atom forced spaces upon me in and they are also using tabs now
from text-buffer.
@tm1000 - I guess I will be removing Atom and re-installing then - thanks for trying to replicate my issue though, most appreciated!
from text-buffer.
@tm1000 - so I deleted Atom (from the finder) and deleted my ~/.atom folder and re-installed. Still have the problem!
from text-buffer.
@nathansobo & @tm1000 - if I delete the comment block from my code, save the file and reopen it - tabs start working. If I then replace the comment block back into the code - the soft-tabs behaviour comes back.
I've deleted Atom and downloaded .99 again, and deleted ~/.atom - which is confirmed by me losing all my packages, themes etc.
I have a straightforward setup on my Mac - OSX Mavericks, and I run node.js for development.
from text-buffer.
@iandotkelly Tabs vs Softtabs is determined when the file is first opened (or at least it was when @GameGamer43 did the PR) so I saved your file and then opened it from Atom. I didn't copy and paste anything
When I copy and paste the comment block all spaces are removed from the comment block so it's rather hard for me to test that element, this could be the result of a plugin as I have several that deal with soft/hard tabs when reading vim configurations from files. But at least we've narrowed it down for you which might help @nathansobo
from text-buffer.
@TM100 yes - I see that, the behavior of Atom only changes when I save quit and reopen the file. This behavior implies that it is still the comment block that is causing the problem. I've got used to using such blocks, but if it would fix my issue I would change.
from text-buffer.
@iandotkelly I found the problem! The isComment method on Tokenized line https://github.com/atom/atom/blob/0ad26c337a35cccf7f645ae05e71aab5841f9fbc/src/tokenized-line.coffee#L143 isn't returning the correct value for javascript block comments.
Since this is an Atom core bug I've closed this issue and moved it to atom/atom#2421
from text-buffer.
@probablycorey - Hey that's great news. Thanks!
from text-buffer.
@probablycorey This didn't fix me (see http://discuss.atom.io/t/sometimes-tab-inserts-spaces-even-with-soft-tabs-off/3976/21).
Should I open a new issue?
from text-buffer.
@chamons are you looking for a config option that turns off automatic tab style detection?
I think this might be a valid config option, but I'd like to know more about the problems the automatic detection is causing. Could you create a gist or point me to a sample file that exhibits the behavior you want fixed.
from text-buffer.
This is a very bad thing when editing Makefiles.
from text-buffer.
@Th0masR0ss can you send me an example of the Makefile where the tab setting is incorrectly detected?
from text-buffer.
I'm having trouble making the issue reproduce outside my project. I can take a file where detection is incorrect, copy paste and save it somewhere else with the same name, open that file up and tab "works", while it is still broken locally.
I'd love an option to just force tab to output actual tab characters and stop guessing.
from text-buffer.
@chamons - I hear you. I get atom into all sort of strange states switching between projects that use tabs, and projects that use spaces. I would like to be able to force it rather than it guessing.
from text-buffer.
@nathansobo Sorry, the problem was I was still using 0.95. I've updated, and it works now, however there was one case where Atom used soft tabs even though I told it not to but I can't reproduce it anymore.
from text-buffer.
I second third @chamons's idea to have a "force hard tabs" option
from text-buffer.
This issue should be moved to atom/atom now anyway because usesSoftTabs is in the Editor class.
from text-buffer.
You can toggle soft-tab on/off on an individual editor using the editor:toggle-soft
. But this setting won't persist after the editor is closed. This issue is obviously annoying for some people, so someone could open this issue on the atom repo with a description of how they expect it to behave that would be great!
from text-buffer.
Problem still here why is this close?
I'm trying to find and replace all space to tabs, and right after I replace all, atom change it right back to space....
from text-buffer.
Same problem as @KevinMcCoy wrote
from text-buffer.
I also still have the problem. This makes Atom not usable for me.
from text-buffer.
This has also been causing a lot of issues with the team I'm on. I'm likely to switch back to Sublime now.
from text-buffer.
Why is this marked as closed? This error persists.
from text-buffer.
Hey guys,
A quick & easy fix is to install auto-detect-indentation
from text-buffer.
You folks can set these settings:
core.tabType
in config.cson
and
core.softTabs
in config.cson
You can scope them to languages
The auto-detection result will persist after manually replacing all tabs with another tab type. So if you replace them all, reload the file or set the tabType
setting to the type you want.
from text-buffer.
Related Issues (20)
- Unsaved files reloaded from state don't set modified flag correctly
- After update to 1.14.2 issues with opening large files HOT 7
- text-buffer does not install on Windows HOT 3
- Replacing multiple characters with newlines in a scanInRange only replaces the first occurence HOT 5
- Regular expressions containing \W are multi line.
- TextBuffer v13 fires spurious conflict & reload events HOT 1
- Flaky test - TextBuffer IO when the file changes on disk does not fire duplicate change events when multiple changes happen on disk
- onDidStopChanging and undo Regression in Atom 1.19.4 HOT 4
- existsSync method is necessary; should be reflected in comment HOT 3
- Tracking undo-redo actions HOT 1
- API documentation references DisplayLayer, which is not public
- Missing stub method 'scopeDescriptorForPosition' in NullLanguageMode HOT 1
- 'did-change-text' event is not fired on empty("") to empty("") change after PR#274 HOT 11
- DisplayLayer.updateSpatialIndex error HOT 1
- undo/redo within transact
- Implementing capture groups HOT 1
- TextBuffer makes vim word motion painfully slow in large file HOT 2
- new TextBuffer(); .setFile(...); .reload(); -> .emitDidChangeEvent missing HOT 4
- h HOT 1
- NullHighlightIterator defines getOpenTags/getCloseTags, but everywhere else it's getOpenScopeIds/getCloseScopeIds
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from text-buffer.