when i'm writing my markdown, very often VSCode changes whitespace to something else, e.g., # Example -> # Example. It looks the same, but it's not whitespace (eslint says no-irregular-whitespace which is how I was able to spot it, but in MD this doesn't show).
> `# Hello`.charCodeAt(0)
35
> `# Hello`.charCodeAt(1)
160
> `# Hello`.charCodeAt(2)
32
> `# Hello`.charCodeAt(3)
72
It causes a lot of trouble occasionally. Why does it do that?
Related
I would like to keep all my C/C++ code files using space for indentation. There are existing source files, most of them are with space indentation, but some lines are with tab character.
I would like to globally search all the tab characters in all .h/.hpp/.c/.cpp files, replace them with space.How can I do that?
I've tried use ^t but not working.
For example, line 79 and 80 starts with tab character, should be replace with space:
But if search globally, these lines are not found, but found other lines:
Seems I asked an silly question.. I just forgot to click "use regular expression". After choosing that, it finds what I want.
Using Atom 1.14.3, I have whitespace package that handles auto-inserting newlines at the end of files.
Even if I delete the end newline and hit save, it re-adds the newline. This is good.
Whitespace package configuration seems to be okay:
The problem is, when I commit to Github, it says the newline has been removed:
Why is this? Is it an Atom issue, or a potential local github setting issue?
EDIT: somehow, I needed to disable whitespace package, manually add two CRLF at the end of the file, and then commit for Github to pick up the single CRLF at the end of the file.
I think you might be misunderstanding where the newlines are.
Let's look at your two screenshots, and where the newlines are in each.
233 return router;\n
234 };\n
Here we have 234 as the last line in the file. We have a line 235 displayed, but that is because the newline on 234 creates the next line for your editor cursor to be on. If you started typing on 235, you'd be creating more content. But right now, 235 is an empty line (including having no terminating newline).
233 return router;\n
234 };\n
235 \n
This is similar except it also has an empty line 235 that ends with a newline. Now the newline-less empty input line has moved to 236.
When you saved with the whitespace package active, it removed extraneous newlines at the end of the file, leaving only one. As in the first screenshot. However, when you look at the Github diff, things are little different. Github is showing you the file contents, not in an editor. So there is no reason to have the phantom last line for your cursor. Instead, it shows you the simple truth of the matter: line 234 is the last line in the file. Line 235 is now gone.
Let's take a look at the settings for the whitespace package. Specifically the first setting:
Ensure Single Trailing Newline
If the buffer doesn't end with a newline character when it's saved, then append one. If it ends with more than one newline, remove all but one. To disable/enable for a certain language, use syntax-scoped properties in your config.cson.
Here are the first two sentences of the description again, with some emphasis added:
If the buffer doesn't end with a newline character when it's saved, then append one. If it ends with more than one newline, remove all but one.
I have an ANSI XML file using windows linebreaks.
At the end of a line, I have CRLF[space][space] (0 x 0D 0A 20 20)
In other text editors, this displays as newline, space space. in VIM, it appears to be doing a sort of 'page break' instead of a linebreak, with a screenfull of # characters down the left margin.
I have tried reloading the file using different encodings and explicit linebreak formats, but it made no useful difference.
Does anyone understand this phenomenon?
Thank you
This is just trying to show a long line all at once. You can turn it off with lastline
'display' 'dy' string (default "")
global
{not in Vi}
Change the way text is displayed. This is comma separated list of
flags:
lastline When included, as much as possible of the last line
in a window will be displayed. When not included, a
last line that doesn't fit is replaced with "#" lines.
uhex Show unprintable characters hexadecimal as <xx>
instead of using ^C and ~C.
I am trying to delete a file from the first blank line to the end of a .txt file. I am using the following line of code:
sed -i -b '/^$/,$d'
(taken almost directly from Unix Power Tools). In a multi-page document, this successfully deletes the second page of text, but still leaves the footer on the first page(see below *text slightly modified for space):
29 0235600 Drain Pan
62 6151060 Nut, Serrated 5/16-18 Hex
7003932
30 6201920 Screw, 8-15X2 6-Lobe PH
W/H Network Svce
63
64 7003931 W/H Network Svce
4
# 1 - Revision D - February, 2007
375844
Previous Page Main Menu Model 648PRO Menu Next Page
I am using GNU sed version 4.2.1
Any suggestions please.
Those things at the end (CR/LF) are DOS style end-of-line characters. I don't know why the -b option isn't coping with them, but you can try this kludge:
sed -i '/^.$/,$d'
I'm running the indigo release on Windows Vista.
I have set both the print margin in General -> Editors -> Text Editors and the maximum line width in Java -> Code Style -> Formatter to 100 characters, yet it is still determined to wrap my comments at column 80.
For example, when this is typed at the top of my file:
(longest lines are 90 and 94 characters respectively)
// This comment is over 80 characters long, but it is in no way over 100 characters long.
/*
* The same problem occurs in block comments as well. True, neither problem is code breaking,
* but it certainly is annoying all the same.
*/
It is formatted to:
(lines are 73 and 79 characters respectively)
// This comment is over 80 characters long, but it is in no way over 100
// characters long.
/*
* The same problem occurs in block comments as well. True, neither problem is
* code breaking,
* but it certainly is annoying all the same.
*/
I have tried restarting Java and have hit every "apply" button I can find, but to no avail. It does not appear to be listed as a known issue in the release notes. Is there something I'm missing? Something simple perhaps?
At least on Eclipse Helios (3.6), there's a separate "Comments"-tab on the Formatter-settings, which has its own "Maximum line width for comments"-setting.