Zero character indents?
-
Why is Npp showing indent marks even in lines with zero characters?
-
@TBugReporter
Probably line 2 DOES contain 2 tab chars.
Do a select all (CTRL-A), the highlight will be short for truly empty lines and longer for lines with whitespace chars only.Another question is why Notepad++, when pressing ENTER on whitespace only line keeps the whitespace. I would prefer Notepad++ to be smart enough to delete the whitespace while maintaining indentation on the next line thus avoiding unintentional whitespace only lines and extra whitespace in general. However, others may disagree with my opinion.
In any case, Trim Trailing Space and Save (Alt-Shift-S) is a friend. I would like an option to make it the default so every save will trim trailing space.
-
Scintilla, the underlying edit component Notepad++ uses internally, provides (beyond turning indent marks off) three indent mark styles (citing from Scintilla’s documentation):
SC_IV_REAL
- Indentation guides are shown inside real indentation white space.SC_IV_LOOKFORWARD
- Indentation guides are shown beyond the actual indentation up to the level of the next non-empty line. If the previous non-empty line was a fold header then indentation guides are shown for one more level of indent than that line. This setting is good for Python.SC_IV_LOOKBOTH
- Indentation guides are shown beyond the actual indentation up to the level of the next non-empty line or previous non-empty line whichever is the greater. This setting is good for most languages.
Notepad++ mostly uses style
SC_IV_LOOKBOTH
. However, for some programming languages (like Python, Haskell, VB and some others) it usesSC_IV_LOOKFORWARD
.When writing source code, it seems like you would presumably prefer style
SC_IV_LOOKFORWARD
and when writing normal text you would presumably prefer styleSC_IV_REAL
. You can set these styles by using a scripting plugin (e.g. PythonScript, NppExec and others) or by using my ExtSettings plugin, which is available via PluginsAdmin. -
@gstavi said in Zero character indents?:
Trim Trailing Space and Save (Alt-Shift-S) is a friend. I would like an option to make it the default so every save will trim trailing space.
Do what I did many years ago, about 5 minutes after I started using Notepad++: Change your save keycombo to run this macro instead. (I’m sure you’ve already done this)
-
@gstavi said in Zero character indents?:
Probably line 2 DOES contain 2 tab chars.
Do you really think I’m incapable of knowing what’s in a four line test file that I created myself?
Another question is why Notepad++, when pressing ENTER on whitespace only line keeps the whitespace.
I honestly can’t think of any reason why anyone would want trailing whitespace on any line, but automatically removing it strikes me as a little too Orwellian; I just want to know where the spaces are - and where they aren’t.
@dinkumoil said in Zero character indents?:
Scintilla, the underlying edit component Notepad++ uses internally, provides (beyond turning indent marks off) three indent mark styles […]
When writing source code, it seems like you would presumably prefer styleSC_IV_LOOKFORWARD
and when writing normal text you would presumably prefer styleSC_IV_REAL
.Actually, after installing your plugin, I prefer “Real indentation” for everything. I’m competent enough to remove the extraneous whitespace characters; I just don’t appreciate being misled into thinking there are spaces where there aren’t.
-
@TBugReporter said in Zero character indents?:
I just don’t appreciate being misled into thinking there are spaces where there aren’t.
The true answer to knowing where the whitespace is is to turn on visible whitespace:
to get an effect like this (dots for spaces, right-arrows for tabs):
I do understand your original complaint, though, about the “Indent Guide” showing on line 2 of your file.
-
Actually, I usually just keep the ¶ button on, but this time I turned it off because all the [CR][LF]s were becoming distracting. (And yes, I know it’s possible to show whitespace without the [CR][LF]s, but I didn’t feel like digging into the menus for what I thought was going to be a quick edit.)