ProgerXP / Notepad2e

Word highlighting, simultaneous editing, split views, math evaluation, un/grep, comment reformatting, UAC elevation, complete regexps (PCRE), Lua lexers, DPI awareness and more (XP+)
Other
370 stars 52 forks source link

Search comments ignores special comment regions #449

Closed ProgerXP closed 10 months ago

ProgerXP commented 1 year ago

e552147c95559cf246b6dc90375cfc30579025c4 fixed the problem with the first line seen as "not comment" (JavaScript schema below):

//! foo
// foo

It turned out Scintilla's JS lexer (which is a CPP lexer in fact) has several kinds of comments, each using a different style:

#define SCE_C_COMMENT 1
#define SCE_C_COMMENTLINE 2
#define SCE_C_COMMENTDOC 3
#define SCE_C_COMMENTLINEDOC 15
#define SCE_C_COMMENTDOCKEYWORD 17
#define SCE_C_COMMENTDOCKEYWORDERROR 18

Because Search comments relies on the style, it didn't consider SCE_C_COMMENTLINEDOC a comment.

However, the problem fundamentally remains because we can't mark more than 4 styles as comments so last 2 are still treated as non-comments by Find. Let's turn all but the first 2 completely off because they don't appear to be used in Notepad2 schema at all (no style entry and visually all "DOC" look the same). There's no Scintilla setting for that so we should patch it.

Also check if any other schema has different comment kinds (apart from singleline/multiline).

cshnik commented 1 year ago

Fixed. Any types of comment styles are properly processed during the search in/out of comments regions.