I have a text area tinymce file that removes extra spaces and I don't want that.
For example if in the text area if I put hello, 5 spaces, bye, and when I save the file and view it again, 4 spaces are deleted and I see hello bye. (4 extra spaces are deleted)
Sorry if I sound not too informed about this, but I just wonder if this is a default feature or if there is an easy way to turn off this feature. (I do not want the extra spaces to be deleted.)
Thanks,
The issue here is that modern browsers will not display several spaces - but will show them as one single space. The solution here is to replace every second space with a " " before the content gets into the editor (best is to replace them on serverside). This way the browser will show all the spaces.
Related
In vscode, when I open a file containing unicode characters,
I notice that tabs do not always advance to the next tab stop.
For example, the following might be part of an ASCII-flavor table
a<tab>b<tab>c<tab>d<tab>e
α<tab>β<tab>γ<tab>δ<tab>ε
𝔸<tab>𝔹<tab>ℂ<tab>𝔻<tab>𝔼
While sublime text renders it correctly(IMO)
vscdoe has a different idea
As I understand it, vscode renders a tab by
replacing it with a proper number of space characters.
So if there are characters showing using proportional fonts,
no integer number of spaces will make it to the proper stop.
(See this related issue.)
So my question is, how can I fix this?
Is it possible to tell vscode that
"Fine, if you were to assume that those unicode characters
are 2 spaces wide when tabbing,
would you please render them as 2 spaces wide?"
I have indented my files in my sublime text but when I push to github they don't look indented. How do I fix this?
The approach taken to indent file on sublime is:
select the code > Edit > Line > Reindent
looks like this on github:
Your issue looks to be caused by your use of literal tab characters for indenting as opposed to using spaces instead.
If there's a hotter holy war topic among developers than the debate of tabs versus spaces, it's probably related to how wide you should interpret a tab character to be for display purposes if you happen to use them.
In particular your images would appear to indicate that you think that tabs should be 2 characters wide and GitHub thinks they should be 8. As mentioned in this answer you can append an extra query field to the URL in GitHub in order to view the files the way you prefer them to be viewed.
As far as I'm aware that just changes how they're rendered on the page when you view and doesn't actually modify the file at all. If it's important that the file retain the same indent levels regardless of where or how you view the file, you should convert from tab indentation to space indentation instead since a space is unambiguously sized.
If you're using Sublime Text you can do that by clicking in the status bar where it says Tab Size: 2 and select Convert indentation to spaces; the status bar will switch to say Spaces: 2 to indicate that the indent has changed.
By this I mean if some file was written with 4 spaces, can you simply highlight it all and click on something to turn it into 2 spaces. I'm not sure if in practice (parsing) this would make sense/could lead to broken code.
I currently have my editor.tabSize set to 2, and sometimes I open files written with 4 spaces and I want to be able to turn them into 2 spaces. I have at least figured out to turn off the auto-detect so that when I highlight sections of the code and hit shift-tab, then tab again it will turn the selected code from 4 spaces into 2 spaces.
Is there a feature like this or does it make sense that this wouldn't exist?
To change the current document from using 4 spaces to 2 spaces:
Click on Spaces: 4 in the status bar or run the Indent using Spaces command
Select 2 for the new tab size
Run for Format Document command to apply the new indentation to the entire document
I receive a lot of text files like this
120
1
230
1.3
3
13240
7
In addition, there is some regular text there too (single space between the words). So I would like to come up with a way to automatically "search and replace" two, three, four, five, etc. spaces (all but single spaces) so that the above numbers no longer have any spaces in front of them. Any thoughts? Maybe a macro would help?
You don't need a macro, actually, this can be done simply with the Find and Replace tool.
Open the Find and Replace dialog box (control+H by default).
If the Search Options section is not currently displayed, press the "More > >" button to display it.
In the Search Options section, check the "Use wildcards" checkbox.
In the "Find what:" field, enter a single space followed by {2,} .
In the "Replace with:" field, either leave it blank to remove the leading spaces entirely or put a single space to replace all repeated spaces with a single one.
Press the Replace All button.
Note that if you choose to remove leading spaces entirely, this may backfire if you have any lines beginning with just a single space; these will still have the space there, while the ones that used to have multiple spaces at the beginning will have them all removed.
I understand how to get Eclipse to insert spaces in place of tabs, but then I'd rather not have to arrow through 12 spaces to reach an indented block.
Bonus points if there's a way to hide the spaces from the 'show whitespace characters'. I like to see whitespace characters for tabs and carriage returns, but the display gets too cluttered when spaces are also displayed.
Try CTRL+[right,left] arrow key. Certainly one of my most-used combos.
As it turns out, this appears to not be possible in Eclipse.
With the next Eclipse 20199.12/4.14, that might actually be possible! (albeit ten years later)
See "Backspace/delete can treat spaces as tabs"
If you use the Insert spaces for tabs option, now you can also change the backspace and delete keys behavior to remove multiple spaces at once, as if they were a tab.
The new setting is called Remove multiple spaces on backspace/delete and is found on the General > Editors > Text Editors preference page.