Open zufuliu opened 5 months ago
split attribute list from tag list
That change would not be completely compatible leading to unhighlighted attributes.
I think it's a compatible change: if app set keywordsAttr
(word list 6) to non-empty, we know it want to using separator tag list and attribute list, and then using it instead of word list 0 (tag list) for classifyAttribHTML()
. A more compatible change would let app to set which word list is attribute list instead of hardcoded 6. Lightweight app can put all attributes and event handlers into the word list similar to Notepad4 did, e.g. SciTE would need to update:
keywordclass.hypertext=\
$(hypertext.elements) $(hypertext.attributes) $(html5.elements) $(html5.attributes) public !doctype
# attributes
keywords7.$(file.patterns.xxx)=
Here are two patches to fix this: html-0604-1.patch
html-0604-1.patch
set attribute list when parameter is not an empty string (decouple from tag list without set anything):
attributeList = wl[0] ? wordListN : &keywords;
html-0604-2.patch
set attribute list only when parameter contains word:
if (n == 6) {
attributeList = wordListN->Length() ? wordListN : &keywords;
}
This appears to duplicate behaviour available from substyles added with 1c6e3e5 so isn't necessary.
I don't think it's duplicate. Even with substyles, body
is still classified as SCE_H_ATTRIBUTE
:
https://github.com/ScintillaOrg/lexilla/blob/85d1d679d442dc4faaf4c73b5594f805499f8313/lexers/LexHTML.cxx#L259-L269
So, there need a way to not use keywords
(word list 0) to classify attributes. The patch provided a method that's easy for app to migration than implement substyles.
I don't think it's duplicate. Even with substyles, body
is still classified as SCE_H_ATTRIBUTE
:
https://github.com/ScintillaOrg/lexilla/blob/85d1d679d442dc4faaf4c73b5594f805499f8313/lexers/LexHTML.cxx#L259-L269
So, there need a way to not use keywords
(word list 0) to classify attributes. The patch provided a method that's easy for app to migration than implement substyles.
Created for https://sourceforge.net/p/scintilla/bugs/514/, copy my last post:
I think a simple fix is just split attribute list from tag list
keywords
(this is what Notepad4 did since 2018):Also, those
keywords<n>
fields needs better describable names.Application wants better support (handle attributes for each tag) can opt-in new sub-style classifiers added in Lexilla 5.3.2, and using
keywordsAttr
for global attributes (see https://html.spec.whatwg.org/multipage/dom.html#global-attributes).