2

I have opened a simple text file in Notepad++ and "iterated" through all languages' styles available in my Language menu. I noticed, that after applying some of them, text displays spaces in the beginning of some lines (left margin), while in other language formatting all this spaces are gone and each line starts with a character next to left margin.

Does anyone know, where in User Defined Language window is an option responsible for that? Or which language styler (XML file) parameter controls this?

EDIT: I have Notepad++ 6.5.1 and I found spaces, when using Javascript, Pascal and Resource file. I also found it in non-standard Markdown styling, described here. Example:

enter image description here

I don't like spaces in the beginning of lines, so I would like to remove them from all my languages / styles, but I don't know which param / option is responsible for that.

Community
  • 1
  • 1
trejder
  • 17,148
  • 27
  • 124
  • 216
  • 1
    I iterated through all Languages included in Notepad++ v6.5.1, and I didn't found a single one trimming leading spaces in the beginning of lines. Could you please let us know which language did you tried? – psxls Dec 16 '13 at 11:40
  • Isn't this a `SuperUser` question? – Pankaj Jaju Dec 16 '13 at 11:44
  • @psxls (I do have Notepad++ `6.5.1`) Sure! As for standard (built-in) styles, I found it in `Javascript`, `Pascal` and `Resource file`. I also found it in non-standard `Markdown` styling, described [here](http://stackoverflow.com/q/20323915/1469208), which I'm using the most (updated question with screenshot as a kind of proof). – trejder Dec 16 '13 at 11:48
  • 2
    @PankajJaju You're free to flag this question as requiring migration. But I've seen similar number of questions about Notepad++ in both SO and SU, so I've choosen SO, as visited by more people! :] – trejder Dec 16 '13 at 11:53
  • 1
    @trejder That's strange because for example JavaScript language shouldn't remove whitespaces, and I can't reproduce it! Can you please also share with us a minimal text sample with which you get this effect? – psxls Dec 16 '13 at 11:56
  • @psxls I see spaces in virtually every document I've been editing for past 3 weeks (since I started using Notepad++). The difference is, that when set to `Javascript` (build-in), I'm getting spaces in fewer lines, than when set to `Markdown` (custom). Sample: `5. If your change will be approved (either by you or someone else), Gerrit should auto-merge it. If it fails on that (because, for example, it is binded to some abandoned change,`. On my 1680x1050 and Notepad++ window maximized, line breaks between of `it` and `is` (in `for example, it is`) and that space appears by the left margin. – trejder Dec 16 '13 at 12:07
  • 1
    @trejder OK now I see! I'll try to answer to your question. – psxls Dec 16 '13 at 12:38
  • @George Stocker: Have you ever run into [this meta answer](http://meta.stackexchange.com/a/75909/189165)? Can you please, kindly explain me, what is the reason for _closing_ a question with comment "Seek help at Super User", instead of actually **migrate** it there? – trejder Dec 17 '13 at 07:16
  • 1
    @trejder It already has an accepted answer; not sure they would want it. – George Stocker Dec 17 '13 at 14:29

1 Answers1

2

It seems that you have Word wrap enabled (from View menu). So the spaces "in the beginning of some lines" that you are referring to, is the space between two words of your sentence, that depending on the language, the lexer decides whether to move it in the next row or not.

So this doesn't actually remove the spaces, it's just a matter of visualization. If you remove the Word wrap option, the spaces are still there.

Now, to achieve this result to each of your documents, the only thing to do is to NOT apply any language style or to be more precise, to select Normal Text language from the Language menu, as shown in below screenshot (which actually makes sense since from your screenshot it seems that you are editing simple text files). In addition go to Settings > Preferences... > New Document and in the Default language and make sure that you have Normal Text selected.

enter image description here

psxls
  • 6,807
  • 6
  • 30
  • 50
  • So... If I'm getting you right, you mean that **every** language setting, _except_ `Normal Text` displays spaces as a first character of line. I only had a strange lucky / run into twixed coincidence, that I didn't seen them for some languages? Am I getting you right? – trejder Dec 16 '13 at 13:04
  • 1
    No! *Some* languages, as for example `MS Ini`, or your custom Markup, display the space in the end of the previous line, as `Normal Text` do. So it's not a property of `Normal Text` only. But, this isn't an option that you can enable. I believe this has to do with the lexer of each language (but I'm not able to answer this with certainty). And it seems that the default behavior, which you can see when `Normal Text` is selected (which doesn't have any styles, any keywords etc), do exactly what you want when word wrapping. – psxls Dec 16 '13 at 13:18
  • 1
    My custom markup (`Markdown`) is **not** following `Normal Text` and **it is** displaying spaces in the beginning of lines. Which actually drives me crazy! :] But, I get your point. Thank you! :] I may only add, with 99,99% certainty, that this is Notepad++'s case, not Scintilla's. As I've been using another editor, based on Scintilla, and it hasn't been showing spaces in the beginning of lines, no matter, what language / lexer was selected. – trejder Dec 16 '13 at 13:30