[NEW_FEATURE] Support YAML language.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@103 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
donho 2008-01-14 00:46:40 +00:00
parent 2417d3af69
commit c83d5801c9
10 changed files with 45 additions and 21 deletions

View File

@ -1,22 +1,12 @@
Notepad++ v4.7.4 fixed bugs and added features (from v4.7.3) : Notepad++ v4.7.4 fixed bugs and added features (from v4.7.4) :
1. Fix the horizon scroll bar flicker bug.
2. Fix the full screen (F11) bug regarding multi-display issue
3. Explorer context menu is available under xp 64 bits et vista 64 bits.
4. Add YAML language.
5. Fix the crash issue of window dialog while clicking Sort button without selected item.
6. Enhance Sort feature GUI part - Enable Sort button only after clicking on the column tab; Disable Sort button after sorting.
1. Make the "recovery system" for 3 mandatory xml files (config.xml, langs.xml and stylers.xml) to prevent the fail loading due to the corrupted files.
2. Extend plugin capacity - add the Scintilla external lexer capacity.
3. Add the ability to hide the tab bar with "-notabbar" flag in command line (ie. Notepad style).
4. Column selection is remembered now while switching among the files. As well this settings will be stored in the next session.
5. Add 2 Commends (beside Toggle Comment) Comment (Ctrl+K) and Uncomment (Ctrl+Shift+K).
6. Change "UTF8 without BOM" menu item behaviour.
7. Fix the hiding bug while launch time because of change of environment from duel monitors to mono monitor.
8. Remove vista UAC warning for GUP. Add "Update Notepad++" menu item.
9. Add NPPM_HIDETABBAR and NPPM_ISTABBARHIDE plugins messages.
10. Add NPPM_GETNPPVERSION message for plugin system.
11. Enhance the horizontal scroll feature.
12. Change Find in files behaviour : all the hidden directory won't be searched (for example : .svn).
13. Add build date-time in about box.
14. Fix a bug where a file with 2 or more consecutive spaces gives problems with sessions and history.
15. Fixe the problem where opening a file when in save as dialog saves the wrong file.
16. Add "Clean Recent File List" menu command.
17. Enhance full screen feature (F11).
Included plugins : Included plugins :

View File

@ -25,7 +25,8 @@ enum LangType {L_TXT, L_PHP , L_C, L_CPP, L_CS, L_OBJC, L_JAVA, L_RC,\
L_ASP, L_SQL, L_VB, L_JS, L_CSS, L_PERL, L_PYTHON, L_LUA,\ L_ASP, L_SQL, L_VB, L_JS, L_CSS, L_PERL, L_PYTHON, L_LUA,\
L_TEX, L_FORTRAN, L_BASH, L_FLASH, L_NSIS, L_TCL, L_LISP, L_SCHEME,\ L_TEX, L_FORTRAN, L_BASH, L_FLASH, L_NSIS, L_TCL, L_LISP, L_SCHEME,\
L_ASM, L_DIFF, L_PROPS, L_PS, L_RUBY, L_SMALLTALK, L_VHDL, L_KIX, L_AU3,\ L_ASM, L_DIFF, L_PROPS, L_PS, L_RUBY, L_SMALLTALK, L_VHDL, L_KIX, L_AU3,\
L_CAML, L_ADA, L_VERILOG, L_MATLAB, L_HASKELL, L_INNO, L_SEARCHRESULT, L_CMAKE,\ L_CAML, L_ADA, L_VERILOG, L_MATLAB, L_HASKELL, L_INNO, L_SEARCHRESULT,\
L_CMAKE, L_YAML,\
// The end of enumated language type, so it should be always at the end // The end of enumated language type, so it should be always at the end
L_EXTERNAL}; L_EXTERNAL};
enum winVer{WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, WV_S2003, WV_XPX64, WV_VISTA}; enum winVer{WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, WV_S2003, WV_XPX64, WV_VISTA};

View File

@ -1512,6 +1512,9 @@ void Notepad_plus::getApiFileName(LangType langType, string &fn)
case L_CMAKE : case L_CMAKE :
fn = "cmake"; break; fn = "cmake"; break;
case L_YAML :
fn = "yaml"; break;
case L_USER : case L_USER :
{ {
Buffer & currentBuf = _pEditView->getCurrentBuffer(); Buffer & currentBuf = _pEditView->getCurrentBuffer();
@ -3621,6 +3624,10 @@ void Notepad_plus::command(int id)
setLanguage(id, L_CMAKE); setLanguage(id, L_CMAKE);
break; break;
case IDM_LANG_YAML :
setLanguage(id, L_YAML);
break;
case IDM_LANG_USER : case IDM_LANG_USER :
setLanguage(id, L_USER); setLanguage(id, L_USER);
break; break;

View File

@ -446,6 +446,7 @@ BEGIN
MENUITEM "VHDL", IDM_LANG_VHDL MENUITEM "VHDL", IDM_LANG_VHDL
MENUITEM "Verilog", IDM_LANG_VERILOG MENUITEM "Verilog", IDM_LANG_VERILOG
MENUITEM "XML", IDM_LANG_XML MENUITEM "XML", IDM_LANG_XML
MENUITEM "YAML", IDM_LANG_YAML
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "User Defined", IDM_LANG_USER MENUITEM "User Defined", IDM_LANG_USER
END END

View File

@ -1595,6 +1595,7 @@ LangType NppParameters::getLangIDFromStr(const char *langName)
if (!strcmp("inno", langName)) return L_INNO; if (!strcmp("inno", langName)) return L_INNO;
if (!strcmp("searchResult", langName)) return L_SEARCHRESULT; if (!strcmp("searchResult", langName)) return L_SEARCHRESULT;
if (!strcmp("cmake", langName)) return L_CMAKE; if (!strcmp("cmake", langName)) return L_CMAKE;
if (!strcmp("yaml", langName)) return L_YAML;
int id = _pSelf->getExternalLangIndexFromName(langName); int id = _pSelf->getExternalLangIndexFromName(langName);
if (id != -1) return (LangType)(id + L_EXTERNAL); if (id != -1) return (LangType)(id + L_EXTERNAL);
@ -3200,11 +3201,15 @@ int NppParameters::langTypeToCommandID(LangType lt) const
case L_CMAKE : case L_CMAKE :
id = IDM_LANG_CMAKE; break; id = IDM_LANG_CMAKE; break;
case L_YAML :
id = IDM_LANG_YAML; break;
case L_SEARCHRESULT : case L_SEARCHRESULT :
id = -1; break; id = -1; break;
case L_TXT : case L_TXT :
id = IDM_LANG_TEXT; break; id = IDM_LANG_TEXT; break;
default : default :
if(lt >= L_EXTERNAL && lt < L_END) if(lt >= L_EXTERNAL && lt < L_END)
id = lt - L_EXTERNAL + IDM_LANG_EXTERNAL; id = lt - L_EXTERNAL + IDM_LANG_EXTERNAL;

View File

@ -770,9 +770,12 @@ void ScintillaEditView::defineDocType(LangType typeDoc)
case L_CMAKE : case L_CMAKE :
setCmakeLexer(); break; setCmakeLexer(); break;
case L_YAML :
setYamlLexer(); break;
case L_TXT : case L_TXT :
default : default :
if(typeDoc >= L_EXTERNAL && typeDoc < NppParameters::getInstance()->L_END) if (typeDoc >= L_EXTERNAL && typeDoc < NppParameters::getInstance()->L_END)
setExternalLexer(typeDoc); setExternalLexer(typeDoc);
else else
execute(SCI_SETLEXER, (_codepage == CP_CHINESE_TRADITIONAL)?SCLEX_MAKEFILE:SCLEX_NULL); execute(SCI_SETLEXER, (_codepage == CP_CHINESE_TRADITIONAL)?SCLEX_MAKEFILE:SCLEX_NULL);

View File

@ -771,6 +771,10 @@ protected:
setLexer(SCLEX_CMAKE, L_CMAKE, "cmake", LIST_0 | LIST_1 | LIST_2); setLexer(SCLEX_CMAKE, L_CMAKE, "cmake", LIST_0 | LIST_1 | LIST_2);
}; };
void setYamlLexer() {
setLexer(SCLEX_YAML, L_YAML, "yaml", LIST_0);
};
void setSearchResultLexer() { void setSearchResultLexer() {
execute(SCI_STYLESETEOLFILLED, SCE_SEARCHRESULT_HEARDER, true); execute(SCI_STYLESETEOLFILLED, SCE_SEARCHRESULT_HEARDER, true);
setLexer(SCLEX_SEARCHRESULT, L_SEARCHRESULT, "searchResult", LIST_1 | LIST_2 | LIST_3); setLexer(SCLEX_SEARCHRESULT, L_SEARCHRESULT, "searchResult", LIST_1 | LIST_2 | LIST_3);

View File

@ -188,7 +188,8 @@
</Language> </Language>
<Language name="xml" ext="xml xsml xsl kml" commentLine="" commentStart="&lt;!--" commentEnd="--&gt;"> <Language name="xml" ext="xml xsml xsl kml" commentLine="" commentStart="&lt;!--" commentEnd="--&gt;">
</Language> </Language>
<Language name="yaml" ext="yml" commentLine="#">
</Language>
<Language name="searchResult" ext=""> <Language name="searchResult" ext="">
<Keywords name="instre1"></Keywords> <Keywords name="instre1"></Keywords>
<Keywords name="instre2"></Keywords> <Keywords name="instre2"></Keywords>

View File

@ -230,6 +230,7 @@
#define IDM_LANG_HASKELL (IDM_LANG + 46) #define IDM_LANG_HASKELL (IDM_LANG + 46)
#define IDM_LANG_INNO (IDM_LANG + 47) #define IDM_LANG_INNO (IDM_LANG + 47)
#define IDM_LANG_CMAKE (IDM_LANG + 48) #define IDM_LANG_CMAKE (IDM_LANG + 48)
#define IDM_LANG_YAML (IDM_LANG + 49)
#define IDM_LANG_EXTERNAL (IDM_LANG + 50) #define IDM_LANG_EXTERNAL (IDM_LANG + 50)
#define IDM_LANG_EXTERNAL_LIMIT (IDM_LANG + 79) #define IDM_LANG_EXTERNAL_LIMIT (IDM_LANG + 79)

View File

@ -677,6 +677,17 @@
<WordsStyle name="SGMLDEFAULT" styleID="21" fgColor="000000" bgColor="A6CAF0" fontName="" fontStyle="0" fontSize="" /> <WordsStyle name="SGMLDEFAULT" styleID="21" fgColor="000000" bgColor="A6CAF0" fontName="" fontStyle="0" fontSize="" />
<WordsStyle name="CDATA" styleID="17" fgColor="FF8000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" /> <WordsStyle name="CDATA" styleID="17" fgColor="FF8000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
</LexerType> </LexerType>
<LexerType name="yaml" desc="YAML" ext="">
<WordsStyle name="DEFAULT" styleID="0" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
<WordsStyle name="IDENTIFIER" styleID="2" fgColor="000080" bgColor="FFFFFF" fontName="" fontStyle="1" fontSize="" />
<WordsStyle name="COMMENT" styleID="1" fgColor="008000" bgColor="FFFFFF" fontName="Comic Sans MS" fontStyle="0" fontSize="8" />
<WordsStyle name="INSTRUCTION WORD" styleID="3" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="1" fontSize="" keywordClass="instre1" />
<WordsStyle name="NUMBER" styleID="4" fgColor="FF8040" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
<WordsStyle name="REFERENCE" styleID="5" fgColor="804000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
<WordsStyle name="DOCUMENT" styleID="6" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
<WordsStyle name="TEXT" styleID="7" fgColor="808080" bgColor="FFFFFF" fontName="" fontStyle="1" fontSize="" />
<WordsStyle name="ERROR" styleID="8" fgColor="FF0000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
</LexerType>
<LexerType name="searchResult" desc="Search result" ext=""> <LexerType name="searchResult" desc="Search result" ext="">
<WordsStyle name="DEFAULT" styleID="0" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" /> <WordsStyle name="DEFAULT" styleID="0" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
<WordsStyle name="SELECTED LINE" styleID="6" fgColor="FFFF80" bgColor="0000FF" fontName="" fontStyle="1" fontSize="" /> <WordsStyle name="SELECTED LINE" styleID="6" fgColor="FFFF80" bgColor="0000FF" fontName="" fontStyle="1" fontSize="" />