notepad-plus-plus / notepad-plus-plus

Notepad++ official repository
https://notepad-plus-plus.org/
Other
22.56k stars 4.56k forks source link

HTML syntax folding problem #12323

Open JulioGuri opened 1 year ago

JulioGuri commented 1 year ago

Description of the Issue

In NotePad++: In the left margin, there are lines and squares (or circles) indicating when a tag opens and when it closes. Simple code example; < d i v > anything here < p > any words here < / p > < / d i v >

When clicking on < p > a highlighted line goes until < / p > When clicking on < d i v > a highlighted line goes until < / d i v >

Well, this "good" behaviour does not always happen. In some instances a line goes from a < d i v > to a < p > or a < / p > and different similar "bad" behaviours.

An HTML complex page operating smoothly, presented this NotePad++ odd behaviour. I cannot use NotePad++ to check my lousy programming. Only if the page works, I feel that everything should be correct but if it does'nt, the Notepad++ cannot assist me with the opening and closing tags.

Steps to Reproduce the Issue

Only try to use this NotePad++ feature on an HTML complex page.

Expected Behavior

To work reliably would be of great assistance. As a suggestion not related with the problem, could the "active line" be a little thicker (better visibility)? Perhaps only 1px thicker. Or change its color to red.

Actual Behavior

Explained. The connection between opening and closing tags is erratic.

Otherwise, Notepad++ has very many incredibly helpful features. It is a fantastic tool! Will never thank enough for it.

Debug Information

Notepad++ v8.4.6 (64-bit) Build time : Sep 25 2022 - 19:51:39 Path : C:\Program Files\Notepad++\notepad++.exe Command Line : "C:\Program Files\Notepad++\change.log" Admin mode : OFF Local Conf mode : OFF Cloud Config : OFF OS Name : Windows 10 Pro (64-bit) OS Version : 21H2 OS Build : 19044.2006 Current ANSI codepage : 1252 Plugins : mimeTools (2.8) NppConverter (4.4) NppExport (0.4)

alankilborn commented 1 year ago

Seems to work fine for me.

Text:

<div>
<p>
blah
</p>
</div>

Result:

image

I think you're going to have to put more in your "steps to reproduce" for anyone to have a chance at evaluating your complaint.

ArkadiuszMichalski commented 1 year ago

@JulioGuri Without showing your problematic code it's impossible to helping here (give some URL or put this code directly here). I suspect you have some syntax errors in your HTML file (just because it works in some other program doesn't mean that this errors not exist).

JulioGuri commented 1 year ago

Thanks to both for your fast replies.

After a few hours of checking code in HTML pages, I have discovered what happens.

Please accept my apologies as the odd behaviour arose because of mistakes in my coding.

In this example of a lousy code (which may be inside a longer code):

\

\
blah blah \

\

\
blah blah \
\

In the first block, a closing \

was forgotten. The page works well in the browsers but NotePad++ gets lost and will point to any other tag (not a \
) as the closer of the first \
. Same happens with forgotten \

tags. I have not checked any other tags.

So, the funny behaviour is a consequence of mistakes in my code, not of a malfunction of NotePad++.

As suggestions for improvement of an already excellent tool, I would like to say what follows, if you pardon me.

The first suggestion would be specially helpful with long codes that require page scrolls.

As soon as one clicks on a tag, if NotePad++ does not find its pair, launch some sort of hint without having to scroll all the code - up or down. (Perhaps make the line intermittent?) This means that when I click on \

or \

or whatever, if NotePad++ does not find its closer (\

or \

or whatever), I will know that something is wrong without having to scroll down and see where it lands.

My second suggestion was to change the colour (red?) of the highlighted lines embracing opening and closing tags. Presently, the difference is not very visible..

I do not do much coding and my work has never been in this area. In fact every time I sit to begin a new project I find I have lost concentration and forgotten many things. These are drawbacks that will disappear after a couple of days. (Don't tell anybody, I'm 85).

I find NotePad++ very intuitive and flexible with a huge amount of possibilities. It is precious for me! Thanks its creator for making it and all for helping to maintain it!

alankilborn commented 1 year ago

suggestion(s)...

Well, there's a limit to what Notepad++ endeavors to do. At its core, it is a "simple" and "humble" text editor. It isn't specifically an HTML/web editor, and a lot of the functionality you comment on is related to its editing component (Scintilla) which is a separate project. There are some specific third-party plugins for HTML and the like, that do some of these things better, but they are not affiliated with or controlled by Notepad++ project.

Don't tell anybody, I'm 85

Nice, good to see someone of that age embracing technology, instead of fleeing from it like the house is on fire. :-)

ArkadiuszMichalski commented 1 year ago

As soon as one clicks on a tag, if NotePad++ does not find its pair, launch some sort of hint without having to scroll all the code - up or down.

Such indicator already exists through colors (if you have a pair, they get a dedicated color), and if there is no match, the tag gets nothing. You don't need to scroll the entire page. This option must be enabled: Preferences > Highlighting > Highlight Matching Tags > Enabled. You can also use plugin like "HTML tag" to jump between corresponding tags (open/close).

image

My second suggestion was to change the colour (red?) of the highlighted lines embracing opening and closing tags. Presently, the difference is not very visible.

You can change such things through Settings > Style Configurator.. > Global Styles (also other things are controlled via HTML section).