diff --git a/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h b/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h index 794323f18..4ffb6efa1 100644 --- a/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h +++ b/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h @@ -39,7 +39,7 @@ enum LangType {L_TEXT, L_PHP , L_C, L_CPP, L_CS, L_OBJC, L_JAVA, L_RC,\ 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_YAML, L_COBOL, L_GUI4CLI, L_D, L_POWERSHELL, L_R, L_JSP,\ - L_COFFEESCRIPT, L_JSON, L_JAVASCRIPT, L_FORTRAN_77,\ + L_COFFEESCRIPT, L_JSON, L_JAVASCRIPT, L_FORTRAN_77, L_BAANC,\ // Don't use L_JS, use L_JAVASCRIPT instead // The end of enumated language type, so it should be always at the end L_EXTERNAL}; diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index e7778da2a..4ecdcc964 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -2803,6 +2803,8 @@ enum LangType Notepad_plus::menuID2LangType(int cmdID) return L_R; case IDM_LANG_COFFEESCRIPT : return L_COFFEESCRIPT; + case IDM_LANG_BAANC: + return L_BAANC; case IDM_LANG_USER : return L_USER; @@ -3932,7 +3934,9 @@ bool Notepad_plus::doBlockComment(comment_mode currCommentMode) if (not isSingleLineAdvancedMode) { comment = commentLineSymbol; - comment += aSpace; + + if (!(buf->getLangType() == L_BAANC)) // BaanC standardization - no space. + comment += aSpace; comment_length = comment.length(); } @@ -3961,7 +3965,9 @@ bool Notepad_plus::doBlockComment(comment_mode currCommentMode) //--FLS: count lines which were un-commented to decide if undoStreamComment() shall be called. int nUncomments = 0; //Some Lexers need line-comments at the beginning of a line. - const bool avoidIndent = buf->getLangType() == L_FORTRAN_77; + const bool avoidIndent = (buf->getLangType() == L_FORTRAN_77 || buf->getLangType() == L_BAANC); + //Some Lexers comment blank lines, per their standards. + const bool commentEmptyLines = (buf->getLangType() == L_BAANC); _pEditView->execute(SCI_BEGINUNDOACTION); @@ -3971,14 +3977,16 @@ bool Notepad_plus::doBlockComment(comment_mode currCommentMode) size_t lineIndent = _pEditView->execute(SCI_GETLINEINDENTPOSITION, i); size_t lineEnd = _pEditView->execute(SCI_GETLINEENDPOSITION, i); - // empty lines are not commented - if (lineIndent == lineEnd) + // empty lines are not commented, unless required by the language. + if (lineIndent == lineEnd && !commentEmptyLines) continue; if (avoidIndent) lineIndent = lineStart; - size_t linebufferSize = lineEnd - lineIndent + 2; + //size_t linebufferSize = lineEnd - lineIndent + 2; + // Replace hard coded 2 (commentLineSymbol + aSpace) to comment_length. + size_t linebufferSize = lineEnd - lineIndent + comment_length; TCHAR* linebuf = new TCHAR[linebufferSize]; _pEditView->getGenericText(linebuf, linebufferSize, lineIndent, lineEnd); @@ -3993,9 +4001,11 @@ bool Notepad_plus::doBlockComment(comment_mode currCommentMode) //--FLS: In order to do get case insensitive comparison use strnicmp() instead case-sensitive comparison. // Case insensitive comparison is needed e.g. for "REM" and "rem" in Batchfiles. //if (linebufStr.substr(0, comment_length - 1) == comment.substr(0, comment_length - 1)) - if (generic_strnicmp(linebufStr.c_str(), comment.c_str(), comment_length - 1) == 0) + //if (generic_strnicmp(linebufStr.c_str(), comment.c_str(), comment_length - 1) == 0) + if (generic_strnicmp(linebufStr.c_str(), comment.c_str(), !(buf->getLangType() == L_BAANC) ? comment_length - 1 : comment_length) == 0) { - size_t len = linebufStr[comment_length - 1] == aSpace[0] ? comment_length : comment_length - 1; + //size_t len = linebufStr[comment_length - 1] == aSpace[0] ? comment_length : comment_length - 1; + size_t len = linebufStr[comment_length - 1] == aSpace[0] ? comment_length : !(buf->getLangType() == L_BAANC) ? comment_length - 1 : comment_length; _pEditView->execute(SCI_SETSEL, lineIndent, lineIndent + len); _pEditView->replaceSelWith(""); diff --git a/PowerEditor/src/Notepad_plus.rc b/PowerEditor/src/Notepad_plus.rc index 4844c0faf..54c6c2fad 100644 --- a/PowerEditor/src/Notepad_plus.rc +++ b/PowerEditor/src/Notepad_plus.rc @@ -674,6 +674,7 @@ BEGIN MENUITEM "ASP", IDM_LANG_ASP MENUITEM "Assembly", IDM_LANG_ASM MENUITEM "AutoIt", IDM_LANG_AU3 + MENUITEM "BaanC", IDM_LANG_BAANC MENUITEM "Batch", IDM_LANG_BATCH MENUITEM "C", IDM_LANG_C MENUITEM "C#", IDM_LANG_CS @@ -741,7 +742,11 @@ BEGIN MENUITEM "Assembly", IDM_LANG_ASM MENUITEM "AutoIt", IDM_LANG_AU3 END - MENUITEM "Batch", IDM_LANG_BATCH + POPUP "B" + BEGIN + MENUITEM "BaanC", IDM_LANG_BAANC + MENUITEM "Batch", IDM_LANG_BATCH + END POPUP "C" BEGIN MENUITEM "C", IDM_LANG_C diff --git a/PowerEditor/src/NppCommands.cpp b/PowerEditor/src/NppCommands.cpp index 498e714a2..a96e3ac15 100644 --- a/PowerEditor/src/NppCommands.cpp +++ b/PowerEditor/src/NppCommands.cpp @@ -2782,6 +2782,7 @@ void Notepad_plus::command(int id) case IDM_LANG_R : case IDM_LANG_JSP : case IDM_LANG_COFFEESCRIPT: + case IDM_LANG_BAANC: case IDM_LANG_USER : { setLanguage(menuID2LangType(id)); diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index 16cb096d7..03242d194 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -5850,6 +5850,9 @@ int NppParameters::langTypeToCommandID(LangType lt) const case L_COFFEESCRIPT : id = IDM_LANG_COFFEESCRIPT; break; + case L_BAANC: + id = IDM_LANG_BAANC; break; + case L_SEARCHRESULT : id = -1; break; diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp index 9083ed9df..d12e09e74 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp @@ -139,6 +139,7 @@ LanguageName ScintillaEditView::langNames[L_EXTERNAL+1] = { {TEXT("json"), TEXT("json"), TEXT("JSON file"), L_JSON, SCLEX_CPP }, {TEXT("javascript.js"), TEXT("JavaScript"), TEXT("JavaScript file"), L_JAVASCRIPT, SCLEX_CPP }, {TEXT("fortran77"), TEXT("Fortran fixed form"), TEXT("Fortran fixed form source file"), L_FORTRAN_77, SCLEX_F77}, +{TEXT("baanc"), TEXT("BaanC"), TEXT("BaanC File"), L_BAANC, SCLEX_BAAN }, {TEXT("ext"), TEXT("External"), TEXT("External"), L_EXTERNAL, SCLEX_NULL} }; @@ -1507,6 +1508,9 @@ void ScintillaEditView::defineDocType(LangType typeDoc) case L_COFFEESCRIPT : setCoffeeScriptLexer(); break; + case L_BAANC: + setBaanCLexer(); break; + case L_TEXT : default : if (typeDoc >= L_EXTERNAL && typeDoc < _pParameter->L_END) diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h index 848938502..58e40dafe 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h @@ -867,6 +867,11 @@ protected: setLexer(SCLEX_COFFEESCRIPT, L_COFFEESCRIPT, LIST_0 | LIST_1 | LIST_2 | LIST_3); }; + void setBaanCLexer() { + setLexer(SCLEX_BAAN, L_BAANC, LIST_0 | LIST_1); + execute(SCI_SETPROPERTY, reinterpret_cast("styling.within.preprocessor"), reinterpret_cast("1")); + }; + //-------------------- void setSearchResultLexer() { diff --git a/PowerEditor/src/langs.model.xml b/PowerEditor/src/langs.model.xml index cb7adccb8..32df299e4 100644 --- a/PowerEditor/src/langs.model.xml +++ b/PowerEditor/src/langs.model.xml @@ -30,6 +30,12 @@ #region #endregion + + + alike all and array as asc at avg base based between boolean both break bset buffer by call case cast chart clear clearunref common const continue count cross current_date current_timestamp date date.num date.to.num debug default delete deleteempty deleteerror desc dim distinct dll dllusage domain double else empty end endcase enddelete enddllusage endfor endfunctionusage endif endselect endupdate endwhile enum_description eq escape exists extern false fatal fetching field first fixed for from full function functionusage ge global goto group gt having hint hints if in include index inner input inrange integer is join label last le leading left like long lt max mb menu message min multibyte ne no nodebug not notransactions nowarnings null on or order ordered outer path pi prepared print prompt question raw real ref reference refers repeat retry return right row rows select selectbind selectdo selectempty selecteos selecterror session set setunref size skip static step sticky stop strict_boolean string subhint sum table text_content then timestamp to trailing trim true union unref until update updateempty updateerror use used void warning warnings when where wherebind whereused while with + + abort abort.io db.after.delete db.after.insert db.after.update xmlSetData zoom.to$ + 7z adduser alias apt-get ar as asa autoconf automake awk banner base64 basename bash bc bdiff blkid break bsdcpio bsdtar bunzip2 bzcmp bzdiff bzegrep bzfgrep bzgrep bzip2 bzip2recover bzless bzmore c++ cal calendar case cat cc cd cfdisk chattr chgrp chmod chown chroot chvt cksum clang clang++ clear cmp col column comm compgen compress continue convert cp cpio crontab crypt csplit ctags curl cut date dc dd deallocvt declare deluser depmod deroff df dialog diff diff3 dig dircmp dirname disown dmesg do done dpkg dpkg-deb du echo ed egrep elif else env esac eval ex exec exit expand export expr fakeroot false fc fdisk ffmpeg fgrep fi file find flex flock fmt fold for fsck function functions fuser fusermount g++ gas gawk gcc gdb genisoimage getconf getopt getopts git gpg gpgsplit gpgv grep gres groff groups gunzip gzexe hash hd head help hexdump hg history httpd iconv id if ifconfig ifdown ifquery ifup in insmod integer inxi ip jobs join kill killall killall5 lc ld ldd let lex line ln local logname look ls lsattr lsb_release lsblk lscpu lshw lslocks lsmod lsusb lzcmp lzegrep lzfgrep lzgrep lzless lzma lzmainfo lzmore m4 mail mailx make man mkdir mkfifo mkswap mktemp modinfo modprobe mogrify more mount msgfmt mt mv nameif nasm nc ndisasm netcat newgrp nl nm nohup ntps objdump od openssl p7zip pacman passwd paste patch pathchk pax pcat pcregrep pcretest perl pg ping ping6 pivot_root poweroff pr print printf ps pwd python python2 python3 ranlib read readlink readonly reboot reset return rev rm rmdir rmmod rpm rsync sed select service set sh sha1sum sha224sum sha256sum sha3sum sha512sum shift shred shuf shutdown size sleep sort spell split start stop strings strip stty su sudo sum suspend switch_root sync systemctl tac tail tar tee test then time times touch tr trap troff true tsort tty type typeset ulimit umask umount unalias uname uncompress unexpand uniq unlink unlzma unset until unzip unzipsfx useradd userdel uudecode uuencode vi vim wait wc wget whence which while who wpaste wstart xargs xdotool xxd xz xzcat xzcmp xzdiff xzfgrep xzgrep xzless xzmore yes yum zcat zcmp zdiff zegrep zfgrep zforce zgrep zless zmore znew zsh diff --git a/PowerEditor/src/menuCmdID.h b/PowerEditor/src/menuCmdID.h index ed9115f97..bce0e7743 100644 --- a/PowerEditor/src/menuCmdID.h +++ b/PowerEditor/src/menuCmdID.h @@ -482,6 +482,7 @@ #define IDM_LANG_COFFEESCRIPT (IDM_LANG + 56) #define IDM_LANG_JSON (IDM_LANG + 57) #define IDM_LANG_FORTRAN_77 (IDM_LANG + 58) + #define IDM_LANG_BAANC (IDM_LANG + 59) #define IDM_LANG_EXTERNAL (IDM_LANG + 65) #define IDM_LANG_EXTERNAL_LIMIT (IDM_LANG + 79) diff --git a/PowerEditor/src/stylers.model.xml b/PowerEditor/src/stylers.model.xml index f9d3ecaa3..6cf859917 100644 --- a/PowerEditor/src/stylers.model.xml +++ b/PowerEditor/src/stylers.model.xml @@ -77,6 +77,18 @@ + + + + + + + + + + + +