Problem seeing some line numbers when Folding plain text
-
Hello, all!
So, I finally decided to try and stop just getting by and figured out how to implement Folding with plain text (created a new User Defined Language (UDL) by using {{ and }} for start and end).
All works pretty good, though I had to manually go in and put Style information for the Normal text because I use Dark mode and that was the only way I saw to fix it and not have reversed text (and numbers, too). Strangely, even though I did get a nice response from a helpful user (PeterJones) suggesting I make my character color Transparent. Sadly, I found it didn’t help. It simply made my text black on black (invisible). But since I don’t need to worry about using it in different modes, I just manually hard-coded the colors to suit my needs, so I guess it’s fine.
But as I said above, I’m experiencing a side-effect that I cannot figure out because it’s only causing a partial problem instead of a full problem.
Specifically, my text file is a bit over 2000 lines long. I use the code folding to break the 14 sections down. Also, I have about twenty lines of text above the folded parts and also maybe a dozen lines at the end of the folded parts, and when all is folded, the 14 sections only show their Header Line.
The partial-problem I have is that, even though I have line numbers turned on, I find that between sections 1 thru 12, there are no line numbers shown at all. (Not even for header lines that are supposed to be outside the folds). Note that the line numbers for the header lines for section 13 and 14 still stay visible, as do the last dozen or so lines at the end of all the folds, (if it matters, the line numbers for those lines don’t change).
If I “unfold” section 1, not only can I now see line line numbers of the unfolded lines, but I can also see the line number of the Header line that WASN’T folded at the beginning of the section 1. The same thing happens as I unfold further and further sections as long as I do them in order.
Now, maybe this next symptom is expected, but if I, instead, try to go to one of the middle folded sections and unfold it, it’s line numbers still are not shown. For instance, if I have all sections folded, and unfold section 4, all of lines in section 4 still show no line numbers.
Anyone have any thoughts about why line numbers would be hidden for many (but not all) of the folded sections? If it matters, I’ve searched my entire file and the only place I use double-curly-brackets is as markers at the start and end of each section, as folding requires. Also, I have the latest version of NPP installed (v8.6.9)
Frank
Note: Just to let you see what it looks like, here’s a screenshot:
-
@Frank-Wojtczak ,
You don’t see them, because they are folded. You won’t see numbers for those sections, unless the amount of lines is negligible. If you have sections, inside of sections (we usully use Classes, with functions inside), there are a lot of text that depending on which one you unfold will show the numbers where that text is, but not the rest of the folded text because it doesn’t know the line number applicable, unless they are unfolded…it’s variable dependent on the number of unfolded parts. -
@Lycan-Thrope But you are ignoring all the lines that have [ and ] at either end. Those lines are NOT folded, and yet you don’t see their line numbers either. I purposely put those lines NOT in the folded area. Why are their line numbers missing?
Also, please note that you CAN see the line numbers for the [STUFF TO BE SORTED], the [CREDENTIALS], and the [end-of-file] lines. Why are they visible?
-
@Frank-Wojtczak ,
Did you put two cr/lf at the end of the file, for starters? There is a well known bug that if you don’t have that at the end of the file, the folding doesn’t work properly for the whole file. Have run into it myself with UDL’s.Additionally, I don’t have or know your UDL, so I don’t have any idea what else could be wrong in the UDL YOU have designed.
-
@Lycan-Thrope Each time I use the {{ or }} (start and end section), I put a CR-LF at the end of of those each line with nothing else on those lines.
My UDL is simply the {{ for the Start and the }} for the end. I have modified nothing else in the UDL (except to change the default style to match my dark mode: white text color on black background color).
That’s it. I haven’t modified the UDL any further then that.
One more thought occurred to me. When you said:
Did you put two cr/lf at the end of the file, for starters?
You were referring to the very end of the file, correct? After all the multiple lines at the end that are NOT part of a FOLD area, I currently have the last part of the last line of text is:
~~~~~~~~~~~~~~~~ CR LF
CR LFIs this what you are asking if I have done?
(Note: I don’t know why the line I quoted of yours defaults to hidden)
-
@Frank-Wojtczak said in Problem seeing some line numbers when Folding plain text:
You were referring to the very end of the file, correct? After all the multiple lines at the end that are NOT part of a FOLD area, I currently have the last part of the last line of text is:
CR LF Is this what you are asking if I have done?
I have to correct myself, as this issue of an empty line with a CR is related to the Function List functionality, not the UDL. However, on that note, I know the UDL can be a bit buggy depending on the way things are setup in the UDL definition, which is what I meant about not knowing the UDL you created. Sorry about that.
(Note: I don’t know why the line I quoted of yours defaults to hidden)
Me either. I’m just a user like you, who’s been here a little longer, but I’m not an expert at any of this Forum’s capabilities, nor of the more esoteric behaviors of it or Notepad++'s either as I’m still learning also.
By the way Frank, if you want more help, you need to provide more info and resources. For instance, the text you’re using to show how the UDL isn’t working, is in a screenshot. It’s not in the
</>
pair which is the forum’s way of showing the text so people can pull it from your message and use to figure out why it’s not working. You only need to include enough to allow someone to see how the UDL works, because I believe the forum limits the amount of text you can have…but either way, a better description of the UDL so people can try to recreate it to see the problem would be needed also, and just saying that you use{{
and}}
pairs won’t help if they don’t have the text you are using to test with. -
@Frank-Wojtczak said in Problem seeing some line numbers when Folding plain text:
I had to manually go in and put Style information for the Normal text because I use Dark mode and that was the only way I saw to fix it and not have reversed text (and numbers, too). Strangely, even though I did get a nice response from a helpful user (PeterJones) suggesting I make my character color Transparent.
For those who were curious, that was Code Folding Plan Text in Dark Mode from last year.
You can set the Default Style to “transparent” (I now prefer to think of it as “inherit”) for both Foreground and Background and have it work right in Dark Mode:
Folder & Default > Default Style > Styler Folder & Default > Folding In Code 1 style > Styler Folder & Default > Folding in Code 1 style > Open/Close Comment & Number > Number Style > Styler Setting both colors to “Transparent” is the right way of making it inherit from the current theme, and it does work.
It simply made my text black on black (invisible)
Presumably, that means you only told it to set the background color to Transparent, rather than telling it to make both colors Transparent, because that would keep the default foreground color of black, and inherit the dark background from your dark theme.
(Note: I don’t know why the line I quoted of yours defaults to hidden)
Normally, when you quote something, there is a single
>
in front of it. In your post, there were two:> >
. That sometimes accidentally happens if you copy something from a quote, and then paste it immediately after the quote: the Forum “helpfully” adds a second level of indentation. When there is a second level of indentation (two> >
), then the Forum hides it, to avoid cluttering a conversation with deep quotes. So if you ever see a “quote section” with two or more>
at the start of the line, just know the forum will hide it; delete it until it’s only one>
if you don’t want it hidden.Finally:
Regarding your actual problem – the Notepad++ line numbers are missing – that’s one I’ve never seen. I need to get going right now, but if I have time later, I’ll see if I can replicate. (Unfortunately, either way, it’s likely nothing will happen. The developer tends to ignore any issue about the UDL system.)
-
@PeterJones said in Problem seeing some line numbers when Folding plain text:
if I have time later, I’ll see if I can replicate
Unfortunately, I cannot replicate it:
(the contents of each folded section are just empty lines in my case)That doesn’t mean it’s not a real problem for you. Unfortunately, some of the bugs in the UDL are really weird, and aren’t consistent. Often, if there’s a comment as the first line (or group of lines), it can cause folding sections later to not line up with the actual folding indicators.
It might also be one or more of your plugins interfering. You might try running with the
-noPlugin
command-line option, and if that fixes the problem, then see if you can narrow down the culprit plugin(s) using the Possible Culprit: Plugin section of this FAQ -
@Frank-Wojtczak, Do you see the same issue with the line numbers if you create a simple
test.htm
file with something such as:line 1 <x> Line 3 </x> <x> Line 6 </x> <x> Line 9 </x> line 11
When I fold all three blocks I see:
The goal with this test is to see if the issue is with your Notepad++ style settings or something more specific to the UDL you created for
{{ }}
folding. Often times when people update Notepad++ they don’t realize the installer retains all of the old style settings, and won’t overwrite them. At times people end up with style settings that are out of sync with what newer Notepad++ editions of the editor were tested with. -
With regard to the original problem, it might be an insurmountable challenge to show you my (2000+) text file because, among other things, there is some private info in there that I can’t allow others to see. And, having to go thru 2000+ lines and “sanitizing” all those lines is way too much to go through to resolve this.
However, what I did do is use the Search/Replace feature and removed all letters, numbers, and punctuation (except for Curly brackets) from the entirety of the file between the start of the first FOLD area and ending of the last FOLD area. The only thing left (aside from the FOLD areas) are:
A) Each of the areas to be folded have the “Description” line just before the next line with just the “OPEN” double-curly brackets
B) Any other single curly brackets that were wherever they were in the file as part of the previous text. (there were no other double-curly brackets used anywhere else in the file)
Upon ending up with a relatively short and almost empty file with a few dozen single curly brackets scattered through the document, I can now fold and unfold, all the line numbers stay visible at all times.
At this point, I can only try to (slowly) work my way through the entire file, one folded section at a time, and see if I can find out what line(s) are causing the problem.
In short, I’m guessing that, even though there are no other “double open” {{ or “double close” }} curly brackets anywhere in the file, my assumption is that (somehow) a single curly bracket is causing the problem, or something that’s NOT a curly bracket is causing the problem. But I’ll need to scour through the document to find out whats wrong.
By the way, @PeterJones, I found out the reason I was getting black on black text was because I didn’t notice that there were TWO of the Transparent boxes to check and I had only checked just the right-hand box. Now the Transparent trick works just fine.
As for the problem with the quote being hidden, that was simply my lack of knowledge of using the Forum software. Back in the day (maybe it’s still available?) I used to get by with BBCode, but it’d been a while and I messed up/forgot what codes did what. I ended up just using the “chevron” character (Shift-comma or Shift-period) on an English keyboard and that was obviously my problem, so just ignore that.
-
@Frank-Wojtczak said in Problem seeing some line numbers when Folding plain text:
Upon ending up with a relatively short and almost empty file with a few dozen single curly brackets scattered through the document, I can now fold and unfold, all the line numbers stay visible at all times.
At this point, I can only try to (slowly) work my way through the entire file, one folded section at a time, and see if I can find out what line(s) are causing the problem.
In short, I’m guessing that, even though there are no other “double open” {{ or “double close” }} curly brackets anywhere in the file, my assumption is that (somehow) a single curly bracket is causing the problem, or something that’s NOT a curly bracket is causing the problem. But I’ll need to scour through the document to find out whats wrong.
That’s exactly what I was trying to relay to you. Don’t feel bad or alone. Thanks to the help from the folks here, I was able to get as complete a package as possible using the UDL, FunctionList and Autocomplete capabilities to emulate my development language’s IDE…but it took me the better part of a year.
Take the sections one by one until you find the offending issue. It’s painstaking, but it’s about the only way to fix it with the tools we have available, being the UDL…when the other option is writing a full on lexer.
Welcome to Notepad++ UDL creation. :-)
-
@Lycan-Thrope said in [Problem seeing some line numbers when
Take the sections one by one until you find the offending issue. It’s painstaking, but it’s about the only way to fix it with the tools we have available, being the UDL…when the other option is writing a full on lexer.
Welcome to Notepad++ UDL creation. :-)
I appreciate all the help that you, and all the other respondents have provided here. As much as I wish it was a simple solution, sometimes it’s not and you just have to slog through a problem to get a resolution. Either way, it’s good to have a place to be able to ask questions and get good help in return.
Thanks to all of you for the good information! (and quick replies!)