Merge remote-tracking branch 'Notepad3_upstream_Rizone/master'

This commit is contained in:
Rainer Kottenhoff 2018-01-12 12:04:16 +01:00
commit d765d649fb
14 changed files with 389 additions and 750 deletions

View File

@ -271,7 +271,7 @@
<ClCompile Include="lexers\LexMake.cxx" />
<ClCompile Include="lexers\LexMarkdown.cxx" />
<ClCompile Include="lexers\LexMatlab.cxx" />
<ClCompile Include="lexers\LexNim.cxx" />
<ClCompile Include="lexers\LexNimrod.cxx" />
<ClCompile Include="lexers\LexNsis.cxx" />
<ClCompile Include="lexers\LexNull.cxx" />
<ClCompile Include="lexers\LexPascal.cxx" />

View File

@ -441,7 +441,7 @@
<ClCompile Include="..\onigmo\st.c">
<Filter>onigmo</Filter>
</ClCompile>
<ClCompile Include="lexers\LexNim.cxx">
<ClCompile Include="lexers\LexNimrod.cxx">
<Filter>lexers</Filter>
</ClCompile>
</ItemGroup>

View File

@ -136,7 +136,6 @@
#define SCLEX_EDIFACT 121
#define SCLEX_INDENT 122
#define SCLEX_AHK 200
#define SCLEX_NIM 201
#define SCLEX_AUTOMATIC 1000
#define SCE_P_DEFAULT 0
#define SCE_P_COMMENTLINE 1

View File

@ -2926,7 +2926,6 @@ val SCLEX_AUTOMATIC=1000
# Lexical states for SCLEX_PYTHON
lex Python=SCLEX_PYTHON SCE_P_
lex Nimrod=SCLEX_NIMROD SCE_P_
lex Nim=SCLEX_NIM SCE_P_
val SCE_P_DEFAULT=0
val SCE_P_COMMENTLINE=1
val SCE_P_NUMBER=2

View File

@ -1,431 +0,0 @@
// Scintilla source code edit control
// Nim lexer
// (c) 2009 Andreas Rumpf
/** @file LexNim.cxx
** Lexer for Nim.
**/
// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#include <assert.h>
#include <ctype.h>
#include "ILexer.h"
#include "Scintilla.h"
#include "SciLexer.h"
#include "WordList.h"
#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
#include "CharacterSet.h"
#include "LexerModule.h"
using namespace Scintilla;
static inline bool IsAWordChar(int ch) {
return (ch >= 0x80) || isalnum(ch) || ch == '_';
}
static Sci_Position tillEndOfTripleQuote(Accessor &styler, Sci_Position pos, Sci_Position max) {
/* search for """ */
for (;;) {
if (styler.SafeGetCharAt(pos, '\0') == '\0') return pos;
if (pos >= max) return pos;
if (styler.Match(pos, "\"\"\"")) {
return pos + 2;
}
pos++;
}
}
#define CR 13 /* use both because Scite allows changing the line ending */
#define LF 10
static bool inline isNewLine(int ch) {
return ch == CR || ch == LF;
}
static Sci_Position scanString(Accessor &styler, Sci_Position pos, Sci_Position max, bool rawMode) {
for (;;) {
if (pos >= max) return pos;
char ch = styler.SafeGetCharAt(pos, '\0');
if (ch == CR || ch == LF || ch == '\0') return pos;
if (ch == '"') return pos;
if (ch == '\\' && !rawMode) {
pos += 2;
} else {
pos++;
}
}
}
static Sci_Position scanChar(Accessor &styler, Sci_Position pos, Sci_Position max) {
for (;;) {
if (pos >= max) return pos;
char ch = styler.SafeGetCharAt(pos, '\0');
if (ch == CR || ch == LF || ch == '\0') return pos;
if (ch == '\'' && !isalnum(styler.SafeGetCharAt(pos+1, '\0')) )
return pos;
if (ch == '\\') {
pos += 2;
} else {
pos++;
}
}
}
static Sci_Position scanIdent(Accessor &styler, Sci_Position pos, WordList &keywords) {
char buf[100]; /* copy to lowercase and ignore underscores */
Sci_Position i = 0;
for (;;) {
char ch = styler.SafeGetCharAt(pos, '\0');
if (!IsAWordChar(ch)) break;
if (ch != '_' && i < ((int)sizeof(buf))-1) {
buf[i] = static_cast<char>(tolower(ch));
i++;
}
pos++;
}
buf[i] = '\0';
/* look for keyword */
if (keywords.InList(buf)) {
styler.ColourTo(pos-1, SCE_P_WORD);
} else {
styler.ColourTo(pos-1, SCE_P_IDENTIFIER);
}
return pos;
}
static Sci_Position scanNumber(Accessor &styler, Sci_Position pos) {
char ch, ch2;
ch = styler.SafeGetCharAt(pos, '\0');
ch2 = styler.SafeGetCharAt(pos+1, '\0');
if (ch == '0' && (ch2 == 'b' || ch2 == 'B')) {
/* binary number: */
pos += 2;
for (;;) {
ch = styler.SafeGetCharAt(pos, '\0');
if (ch == '_' || (ch >= '0' && ch <= '1')) ++pos;
else break;
}
} else if (ch == '0' &&
(ch2 == 'o' || ch2 == 'O' || ch2 == 'c' || ch2 == 'C')) {
/* octal number: */
pos += 2;
for (;;) {
ch = styler.SafeGetCharAt(pos, '\0');
if (ch == '_' || (ch >= '0' && ch <= '7')) ++pos;
else break;
}
} else if (ch == '0' && (ch2 == 'x' || ch2 == 'X')) {
/* hexadecimal number: */
pos += 2;
for (;;) {
ch = styler.SafeGetCharAt(pos, '\0');
if (ch == '_' || (ch >= '0' && ch <= '9')
|| (ch >= 'a' && ch <= 'f')
|| (ch >= 'A' && ch <= 'F')) ++pos;
else break;
}
} else {
// skip decimal part:
for (;;) {
ch = styler.SafeGetCharAt(pos, '\0');
if (ch == '_' || (ch >= '0' && ch <= '9')) ++pos;
else break;
}
ch2 = styler.SafeGetCharAt(pos+1, '\0');
if (ch == '.' && ch2 >= '0' && ch2 <= '9') {
++pos; // skip '.'
for (;;) {
ch = styler.SafeGetCharAt(pos, '\0');
if (ch == '_' || (ch >= '0' && ch <= '9')) ++pos;
else break;
}
}
if (ch == 'e' || ch == 'E') {
++pos;
ch = styler.SafeGetCharAt(pos, '\0');
if (ch == '-' || ch == '+') ++pos;
for (;;) {
ch = styler.SafeGetCharAt(pos, '\0');
if (ch == '_' || (ch >= '0' && ch <= '9')) ++pos;
else break;
}
}
}
if (ch == '\'') {
/* a type suffix: */
pos++;
for (;;) {
ch = styler.SafeGetCharAt(pos);
if ((ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'Z')
|| (ch >= 'a' && ch <= 'z') || ch == '_') ++pos;
else break;
}
}
styler.ColourTo(pos-1, SCE_P_NUMBER);
return pos;
}
/* rewritten from scratch, because I couldn't get rid of the bugs...
(A character based approach sucks!)
*/
static void ColouriseNimDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
Sci_Position pos = startPos;
Sci_Position max = startPos + length;
char ch;
WordList &keywords = *keywordlists[0];
styler.StartAt(startPos);
styler.StartSegment(startPos);
switch (initStyle) {
/* check where we are: */
case SCE_P_TRIPLEDOUBLE:
pos = tillEndOfTripleQuote(styler, pos, max);
styler.ColourTo(pos, SCE_P_TRIPLEDOUBLE);
pos++;
break;
default: /* nothing to do: */
break;
}
while (pos < max) {
ch = styler.SafeGetCharAt(pos, '\0');
switch (ch) {
case '\0': return;
case '#': {
bool doccomment = (styler.SafeGetCharAt(pos+1) == '#');
while (pos < max && !isNewLine(styler.SafeGetCharAt(pos, LF))) pos++;
if (doccomment)
styler.ColourTo(pos, SCE_C_COMMENTLINEDOC);
else
styler.ColourTo(pos, SCE_P_COMMENTLINE);
} break;
case 'r': case 'R': {
if (styler.SafeGetCharAt(pos+1) == '"') {
pos = scanString(styler, pos+2, max, true);
styler.ColourTo(pos, SCE_P_STRING);
pos++;
} else {
pos = scanIdent(styler, pos, keywords);
}
} break;
case '"':
if (styler.Match(pos+1, "\"\"")) {
pos = tillEndOfTripleQuote(styler, pos+3, max);
styler.ColourTo(pos, SCE_P_TRIPLEDOUBLE);
} else {
pos = scanString(styler, pos+1, max, false);
styler.ColourTo(pos, SCE_P_STRING);
}
pos++;
break;
case '\'':
pos = scanChar(styler, pos+1, max);
styler.ColourTo(pos, SCE_P_CHARACTER);
pos++;
break;
default: // identifers, numbers, operators, whitespace
if (ch >= '0' && ch <= '9') {
pos = scanNumber(styler, pos);
} else if (IsAWordChar(ch)) {
pos = scanIdent(styler, pos, keywords);
} else if (ch == '`') {
pos++;
while (pos < max) {
ch = styler.SafeGetCharAt(pos, LF);
if (ch == '`') {
++pos;
break;
}
if (ch == CR || ch == LF) break;
++pos;
}
styler.ColourTo(pos, SCE_P_IDENTIFIER);
} else if (strchr("()[]{}:=;-\\/&%$!+<>|^?,.*~@", ch)) {
styler.ColourTo(pos, SCE_P_OPERATOR);
pos++;
} else {
styler.ColourTo(pos, SCE_P_DEFAULT);
pos++;
}
break;
}
}
}
static bool IsCommentLine(Sci_Position line, Accessor &styler) {
Sci_Position pos = styler.LineStart(line);
Sci_Position eol_pos = styler.LineStart(line + 1) - 1;
for (Sci_Position i = pos; i < eol_pos; i++) {
char ch = styler[i];
if (ch == '#')
return true;
else if (ch != ' ' && ch != '\t')
return false;
}
return false;
}
static bool IsQuoteLine(Sci_Position line, Accessor &styler) {
int style = styler.StyleAt(styler.LineStart(line)) & 31;
return ((style == SCE_P_TRIPLE) || (style == SCE_P_TRIPLEDOUBLE));
}
static void FoldNimDoc(Sci_PositionU startPos, Sci_Position length,
int /*initStyle - unused*/,
WordList *[], Accessor &styler) {
const Sci_Position maxPos = startPos + length;
const Sci_Position maxLines = styler.GetLine(maxPos - 1); // Requested last line
const Sci_Position docLines = styler.GetLine(styler.Length() - 1); // Available last line
const bool foldComment = styler.GetPropertyInt("fold.comment.nim") != 0;
const bool foldQuotes = styler.GetPropertyInt("fold.quotes.nim") != 0;
// Backtrack to previous non-blank line so we can determine indent level
// for any white space lines (needed esp. within triple quoted strings)
// and so we can fix any preceding fold level (which is why we go back
// at least one line in all cases)
int spaceFlags = 0;
Sci_Position lineCurrent = styler.GetLine(startPos);
int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, NULL);
while (lineCurrent > 0) {
lineCurrent--;
indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, NULL);
if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG) &&
(!IsCommentLine(lineCurrent, styler)) &&
(!IsQuoteLine(lineCurrent, styler)))
break;
}
int indentCurrentLevel = indentCurrent & SC_FOLDLEVELNUMBERMASK;
// Set up initial loop state
startPos = styler.LineStart(lineCurrent);
int prev_state = SCE_P_DEFAULT & 31;
if (lineCurrent >= 1)
prev_state = styler.StyleAt(startPos - 1) & 31;
int prevQuote = foldQuotes && ((prev_state == SCE_P_TRIPLE) ||
(prev_state == SCE_P_TRIPLEDOUBLE));
int prevComment = 0;
if (lineCurrent >= 1)
prevComment = foldComment && IsCommentLine(lineCurrent - 1, styler);
// Process all characters to end of requested range or end of any triple quote
// or comment that hangs over the end of the range. Cap processing in all cases
// to end of document (in case of unclosed quote or comment at end).
while ((lineCurrent <= docLines) && ((lineCurrent <= maxLines) ||
prevQuote || prevComment)) {
// Gather info
int lev = indentCurrent;
Sci_Position lineNext = lineCurrent + 1;
int indentNext = indentCurrent;
int quote = false;
if (lineNext <= docLines) {
// Information about next line is only available if not at end of document
indentNext = styler.IndentAmount(lineNext, &spaceFlags, NULL);
int style = styler.StyleAt(styler.LineStart(lineNext)) & 31;
quote = foldQuotes && ((style == SCE_P_TRIPLE) || (style == SCE_P_TRIPLEDOUBLE));
}
const int quote_start = (quote && !prevQuote);
const int quote_continue = (quote && prevQuote);
const int comment = foldComment && IsCommentLine(lineCurrent, styler);
const int comment_start = (comment && !prevComment && (lineNext <= docLines) &&
IsCommentLine(lineNext, styler) &&
(lev > SC_FOLDLEVELBASE));
const int comment_continue = (comment && prevComment);
if ((!quote || !prevQuote) && !comment)
indentCurrentLevel = indentCurrent & SC_FOLDLEVELNUMBERMASK;
if (quote)
indentNext = indentCurrentLevel;
if (indentNext & SC_FOLDLEVELWHITEFLAG)
indentNext = SC_FOLDLEVELWHITEFLAG | indentCurrentLevel;
if (quote_start) {
// Place fold point at start of triple quoted string
lev |= SC_FOLDLEVELHEADERFLAG;
} else if (quote_continue || prevQuote) {
// Add level to rest of lines in the string
lev = lev + 1;
} else if (comment_start) {
// Place fold point at start of a block of comments
lev |= SC_FOLDLEVELHEADERFLAG;
} else if (comment_continue) {
// Add level to rest of lines in the block
lev = lev + 1;
}
// Skip past any blank lines for next indent level info; we skip also
// comments (all comments, not just those starting in column 0)
// which effectively folds them into surrounding code rather
// than screwing up folding.
while (!quote &&
(lineNext < docLines) &&
((indentNext & SC_FOLDLEVELWHITEFLAG) ||
(lineNext <= docLines && IsCommentLine(lineNext, styler)))) {
lineNext++;
indentNext = styler.IndentAmount(lineNext, &spaceFlags, NULL);
}
const int levelAfterComments = indentNext & SC_FOLDLEVELNUMBERMASK;
const int levelBeforeComments =
Maximum(indentCurrentLevel,levelAfterComments);
// Now set all the indent levels on the lines we skipped
// Do this from end to start. Once we encounter one line
// which is indented more than the line after the end of
// the comment-block, use the level of the block before
Sci_Position skipLine = lineNext;
int skipLevel = levelAfterComments;
while (--skipLine > lineCurrent) {
int skipLineIndent = styler.IndentAmount(skipLine, &spaceFlags, NULL);
if ((skipLineIndent & SC_FOLDLEVELNUMBERMASK) > levelAfterComments)
skipLevel = levelBeforeComments;
int whiteFlag = skipLineIndent & SC_FOLDLEVELWHITEFLAG;
styler.SetLevel(skipLine, skipLevel | whiteFlag);
}
// Set fold header on non-quote/non-comment line
if (!quote && !comment && !(indentCurrent & SC_FOLDLEVELWHITEFLAG) ) {
if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) <
(indentNext & SC_FOLDLEVELNUMBERMASK))
lev |= SC_FOLDLEVELHEADERFLAG;
}
// Keep track of triple quote and block comment state of previous line
prevQuote = quote;
prevComment = comment_start || comment_continue;
// Set fold level for this line and move to next line
styler.SetLevel(lineCurrent, lev);
indentCurrent = indentNext;
lineCurrent = lineNext;
}
// NOTE: Cannot set level of last line here because indentCurrent doesn't have
// header flag set; the loop above is crafted to take care of this case!
//styler.SetLevel(lineCurrent, indentCurrent);
}
static const char * const nimWordListDesc[] = {
"Keywords",
0
};
LexerModule lmNim(SCLEX_NIM, ColouriseNimDoc, "nim", FoldNimDoc,
nimWordListDesc);

View File

@ -141,7 +141,7 @@ int Scintilla_LinkLexers() {
//LINK_LEXER(lmMSSQL);
//LINK_LEXER(lmMySQL);
//LINK_LEXER(lmNimrod);
LINK_LEXER(lmNim);
LINK_LEXER(lmNimrod);
//LINK_LEXER(lmNncrontab);
LINK_LEXER(lmNsis);
LINK_LEXER(lmNull);

View File

@ -4332,10 +4332,16 @@ RegExResult_t __fastcall EditFindHasMatch(HWND hwnd, LPCEDITFINDREPLACE lpefr, B
//
// EditFindReplaceDlgProcW()
//
static void __fastcall EditSetTimerMarkAll(HWND hwnd)
static void __fastcall EditSetTimerMarkAll(HWND hwnd, int delay)
{
if (delay < USER_TIMER_MINIMUM) {
TEST_AND_RESET(TIMER_BIT_MARK_OCC);
KillTimer(hwnd, IDT_TIMER_MRKALL);
SendMessage(hwnd, WM_COMMAND, MAKELONG(IDC_MARKALL_OCC, 1), 0);
return;
}
TEST_AND_SET(TIMER_BIT_MARK_OCC);
SetTimer(hwnd, IDT_TIMER_MRKALL, 100, NULL);
SetTimer(hwnd, IDT_TIMER_MRKALL, delay, NULL);
}
@ -4564,7 +4570,7 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
EditSetSearchFlags(hwnd, lpefr);
bFlagsChanged = TRUE;
EditSetTimerMarkAll(hwnd);
EditSetTimerMarkAll(hwnd, 50);
}
return TRUE;
@ -4609,7 +4615,7 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
lpefr = (LPEDITFINDREPLACE)GetWindowLongPtr(hwnd, DWLP_USER);
if (lpefr->bMarkOccurences) {
bFlagsChanged = TRUE;
EditSetTimerMarkAll(hwnd);
EditSetTimerMarkAll(hwnd,50);
}
}
return FALSE;
@ -4645,7 +4651,7 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
SendDlgItemMessage(hwnd, LOWORD(wParam), CB_SETEDITSEL, 0, MAKELPARAM(lSelEnd, lSelEnd));
}
bFlagsChanged = TRUE;
EditSetTimerMarkAll(hwnd);
EditSetTimerMarkAll(hwnd,50);
}
break;
@ -4678,7 +4684,7 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
InvalidateRect(GetDlgItem(hwnd, IDC_FINDTEXT), NULL, TRUE);
}
bFlagsChanged = TRUE;
EditSetTimerMarkAll(hwnd);
EditSetTimerMarkAll(hwnd,0);
}
break;
@ -4736,7 +4742,7 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
CheckDlgButton(hwnd, IDC_FINDTRANSFORMBS, (lpefr->bTransformBS) ? BST_CHECKED : BST_UNCHECKED);
}
bFlagsChanged = TRUE;
EditSetTimerMarkAll(hwnd);
EditSetTimerMarkAll(hwnd,0);
break;
case IDC_DOT_MATCH_ALL:
@ -4749,7 +4755,7 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
lpefr->fuFlags &= ~(SCFIND_DOT_MATCH_ALL);
}
bFlagsChanged = TRUE;
EditSetTimerMarkAll(hwnd);
EditSetTimerMarkAll(hwnd,0);
break;
case IDC_WILDCARDSEARCH:
@ -4776,7 +4782,7 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
CheckDlgButton(hwnd, IDC_FINDTRANSFORMBS, (lpefr->bTransformBS) ? BST_CHECKED : BST_UNCHECKED);
}
bFlagsChanged = TRUE;
EditSetTimerMarkAll(hwnd);
EditSetTimerMarkAll(hwnd,0);
break;
case IDC_FINDTRANSFORMBS:
@ -4789,22 +4795,22 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
bSaveTFBackSlashes = FALSE;
}
bFlagsChanged = TRUE;
EditSetTimerMarkAll(hwnd);
EditSetTimerMarkAll(hwnd,0);
break;
case IDC_FINDCASE:
bFlagsChanged = TRUE;
EditSetTimerMarkAll(hwnd);
EditSetTimerMarkAll(hwnd,0);
break;
case IDC_FINDWORD:
bFlagsChanged = TRUE;
EditSetTimerMarkAll(hwnd);
EditSetTimerMarkAll(hwnd,0);
break;
case IDC_FINDSTART:
bFlagsChanged = TRUE;
EditSetTimerMarkAll(hwnd);
EditSetTimerMarkAll(hwnd,0);
break;
@ -4941,7 +4947,7 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
}
}
bFlagsChanged = TRUE;
EditSetTimerMarkAll(hwnd);
EditSetTimerMarkAll(hwnd,50);
break;
@ -4959,7 +4965,7 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
SetDlgItemTextW(hwnd, IDC_FINDTEXT, wszRepl);
SetDlgItemTextW(hwnd, IDC_REPLACETEXT, wszFind);
bFlagsChanged = TRUE;
EditSetTimerMarkAll(hwnd);
EditSetTimerMarkAll(hwnd,50);
}
break;
@ -5479,7 +5485,6 @@ int EditReplaceAllInRange(HWND hwnd, LPCEDITFINDREPLACE lpefr, BOOL bShowInfo, i
// === iterate over findings and replace strings ===
int offset = 0;
for (ReplPos_t* pPosPair = (ReplPos_t*)utarray_front(ReplPosUTArray);
pPosPair != NULL;
@ -5492,7 +5497,7 @@ int EditReplaceAllInRange(HWND hwnd, LPCEDITFINDREPLACE lpefr, BOOL bShowInfo, i
EditEnterTargetTransaction();
// @@@ found same ?
// found same ?
//if ((iPos >= 0) && (start == (pPosPair->beg + offset)) && (end == (pPosPair->end + offset))) {
SciCall_SetTargetRange(start, end);
offset += ((int)SendMessage(hwnd, iReplaceMsg, (WPARAM)-1, (LPARAM)pszReplace) - pPosPair->end + pPosPair->beg);
@ -6944,7 +6949,7 @@ BOOL FileVars_Apply(HWND hwnd,LPFILEVARS lpfv) {
if (!bWordWrap)
SendMessage(g_hwndEdit,SCI_SETWRAPMODE,SC_WRAP_NONE,0);
else
SendMessage(g_hwndEdit,SCI_SETWRAPMODE,(iWordWrapMode == 0) ? SC_WRAP_WORD : SC_WRAP_CHAR,0);
SendMessage(g_hwndEdit,SCI_SETWRAPMODE,(iWordWrapMode == 0) ? SC_WRAP_WHITESPACE : SC_WRAP_CHAR,0);
if (lpfv->mask & FV_LONGLINESLIMIT)
iLongLinesLimit = lpfv->iLongLinesLimit;

View File

@ -1982,8 +1982,7 @@ BOOL MRU_Load(LPMRULIST pmru)
WCHAR tchName[32] = { L'\0' };
WCHAR tchItem[1024] = { L'\0' };
WCHAR wchBookMarks[MRU_BMRK_SIZE] = { L'\0' };
WCHAR *pIniSection = LocalAlloc(LPTR,sizeof(WCHAR)*32*1024);
WCHAR *pIniSection = LocalAlloc(LPTR,sizeof(WCHAR) * 2 * MRU_MAXITEMS * 1024);
MRU_Empty(pmru);
LoadIniSection(pmru->szRegKey,pIniSection,(int)LocalSize(pIniSection)/sizeof(WCHAR));
@ -2019,7 +2018,7 @@ BOOL MRU_Save(LPMRULIST pmru) {
int i;
WCHAR tchName[32] = { L'\0' };
WCHAR *pIniSection = LocalAlloc(LPTR,sizeof(WCHAR)*32*1024);
WCHAR *pIniSection = LocalAlloc(LPTR,sizeof(WCHAR) * 2 * MRU_MAXITEMS * 1024);
//IniDeleteSection(pmru->szRegKey);

View File

@ -217,7 +217,7 @@ UINT CharSetFromCodePage(UINT);
//==== MRU Functions ==========================================================
#define MRU_MAXITEMS 24
#define MRU_MAXITEMS 24
#define MRU_NOCASE 1
#define MRU_UTF8 2
#define MRU_BMRK_SIZE 1024

View File

@ -1306,7 +1306,7 @@ LRESULT MsgCreate(HWND hwnd,WPARAM wParam,LPARAM lParam)
if (!bWordWrap)
SendMessage(g_hwndEdit,SCI_SETWRAPMODE,SC_WRAP_NONE,0);
else
SendMessage(g_hwndEdit,SCI_SETWRAPMODE,(iWordWrapMode == 0) ? SC_WRAP_WORD : SC_WRAP_CHAR,0);
SendMessage(g_hwndEdit,SCI_SETWRAPMODE,(iWordWrapMode == 0) ? SC_WRAP_WHITESPACE : SC_WRAP_CHAR,0);
if (iWordWrapIndent == 5)
SendMessage(g_hwndEdit,SCI_SETWRAPINDENTMODE,SC_WRAPINDENT_SAME,0);
@ -1488,7 +1488,6 @@ void CreateBars(HWND hwnd,HINSTANCE hInstance)
BOOL bExternalBitmap = FALSE;
DWORD dwToolbarStyle = WS_TOOLBAR;
DWORD dwStatusbarStyle = WS_CHILD | WS_CLIPSIBLINGS;
DWORD dwReBarStyle = WS_REBAR;
BOOL bIsPrivAppThemed = PrivateIsAppThemed();
@ -1587,7 +1586,7 @@ void CreateBars(HWND hwnd,HINSTANCE hInstance)
DeleteObject(hbmpCopy);
// Load toolbar labels
pIniSection = LocalAlloc(LPTR,sizeof(WCHAR)*32*1024);
pIniSection = LocalAlloc(LPTR,sizeof(WCHAR) * 32 * 1024);
cchIniSection = (int)LocalSize(pIniSection)/sizeof(WCHAR);
LoadIniSection(L"Toolbar Labels",pIniSection,cchIniSection);
n = 1;
@ -1617,6 +1616,8 @@ void CreateBars(HWND hwnd,HINSTANCE hInstance)
SendMessage(hwndToolbar,TB_GETITEMRECT,0,(LPARAM)&rc);
//SendMessage(hwndToolbar,TB_SETINDENT,2,0);
DWORD dwStatusbarStyle = WS_CHILD | WS_CLIPSIBLINGS;
if (bShowStatusbar)
dwStatusbarStyle |= WS_VISIBLE;
@ -1802,9 +1803,6 @@ void MsgSize(HWND hwnd,WPARAM wParam,LPARAM lParam)
int x,y,cx,cy;
HDWP hdwp;
// Statusbar
int aWidth[6];
if (wParam == SIZE_MINIMIZED)
return;
@ -1852,12 +1850,16 @@ void MsgSize(HWND hwnd,WPARAM wParam,LPARAM lParam)
EndDeferWindowPos(hdwp);
// Statusbar width
aWidth[0] = max(120,min(cx/3,StatusCalcPaneWidth(g_hwndStatus,L" Ln 9'999'999 : 9'999'999 Col 9'999'999 : 999 Sel 9'999'999 SelLn 9'999'999 Occ 9'999'999 ")));
aWidth[1] = aWidth[0] + StatusCalcPaneWidth(g_hwndStatus,L" 9'999'999 Bytes [UTF-8] ");
aWidth[2] = aWidth[1] + StatusCalcPaneWidth(g_hwndStatus,L" Unicode (UTF-8) Signature ");
aWidth[3] = aWidth[2] + StatusCalcPaneWidth(g_hwndStatus,L" CR+LF ");
aWidth[4] = aWidth[3] + StatusCalcPaneWidth(g_hwndStatus,L" OVR ");
aWidth[5] = -1;
int aWidth[7];
aWidth[STATUS_DOCPOS] = max(100,min(cx/3, StatusCalcPaneWidth(g_hwndStatus,
L" Ln 9'999'999 : 9'999'999 Col 9'999'999 : 999 Sel 9'999'999 SelLn 9'999'999 Occ 9'999'999 ")));
aWidth[STATUS_DOCSIZE] = aWidth[STATUS_DOCPOS] + StatusCalcPaneWidth(g_hwndStatus,L" 999 Bytes [UTF-8] ");
aWidth[STATUS_CODEPAGE] = aWidth[STATUS_DOCSIZE] + StatusCalcPaneWidth(g_hwndStatus,L" Unicode (UTF-8) Signature ");
aWidth[STATUS_EOLMODE] = aWidth[STATUS_CODEPAGE] + StatusCalcPaneWidth(g_hwndStatus,L" CR+LF ");
aWidth[STATUS_OVRMODE] = aWidth[STATUS_EOLMODE] + StatusCalcPaneWidth(g_hwndStatus,L" OVR ");
aWidth[STATUS_2ND_DEF] = aWidth[STATUS_OVRMODE] + StatusCalcPaneWidth(g_hwndStatus, L" 2ND ");
aWidth[STATUS_LEXER] = -1;
SendMessage(g_hwndStatus,SB_SETPARTS,COUNTOF(aWidth),(LPARAM)aWidth);
@ -2360,7 +2362,7 @@ void MsgInitMenu(HWND hwnd,WPARAM wParam,LPARAM lParam)
i == SCLEX_SQL || i == SCLEX_PERL || i == SCLEX_PYTHON || i == SCLEX_PROPERTIES ||i == SCLEX_CONF ||
i == SCLEX_POWERSHELL || i == SCLEX_BATCH || i == SCLEX_DIFF || i == SCLEX_BASH || i == SCLEX_TCL ||
i == SCLEX_AU3 || i == SCLEX_LATEX || i == SCLEX_AHK || i == SCLEX_RUBY || i == SCLEX_CMAKE || i == SCLEX_MARKDOWN ||
i == SCLEX_YAML || i == SCLEX_REGISTRY || i == SCLEX_NIM));
i == SCLEX_YAML || i == SCLEX_REGISTRY || i == SCLEX_NIMROD));
EnableCmd(hmenu,IDM_EDIT_INSERT_ENCODING,*mEncoding[Encoding_Current(CPI_GET)].pszParseNames);
@ -3729,7 +3731,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case SCLEX_AVS:
case SCLEX_YAML:
case SCLEX_COFFEESCRIPT:
case SCLEX_NIM:
case SCLEX_NIMROD:
BeginWaitCursor(NULL);
EditToggleLineComments(g_hwndEdit,L"#",TRUE);
EndWaitCursor();
@ -3797,7 +3799,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case SCLEX_YAML:
case SCLEX_JSON:
case SCLEX_REGISTRY:
case SCLEX_NIM:
case SCLEX_NIMROD:
break;
case SCLEX_HTML:
case SCLEX_XML:
@ -4127,8 +4129,9 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
if (!bWordWrap)
SendMessage(g_hwndEdit,SCI_SETWRAPMODE,SC_WRAP_NONE,0);
else
SendMessage(g_hwndEdit,SCI_SETWRAPMODE,(iWordWrapMode == 0) ? SC_WRAP_WORD : SC_WRAP_CHAR,0);
SendMessage(g_hwndEdit,SCI_SETWRAPMODE,(iWordWrapMode == 0) ? SC_WRAP_WHITESPACE : SC_WRAP_CHAR,0);
bWordWrapG = bWordWrap;
//EditApplyLexerStyle(g_hwndEdit, 0, -1);
UpdateToolbar();
break;
@ -4137,7 +4140,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
if (WordWrapSettingsDlg(hwnd,IDD_WORDWRAP,&iWordWrapIndent))
{
if (bWordWrap)
SendMessage(g_hwndEdit,SCI_SETWRAPMODE,(iWordWrapMode == 0) ? SC_WRAP_WORD : SC_WRAP_CHAR,0);
SendMessage(g_hwndEdit,SCI_SETWRAPMODE,(iWordWrapMode == 0) ? SC_WRAP_WHITESPACE : SC_WRAP_CHAR,0);
if (iWordWrapIndent == 5)
SendMessage(g_hwndEdit,SCI_SETWRAPINDENTMODE,SC_WRAPINDENT_SAME,0);
else if (iWordWrapIndent == 6)
@ -5901,14 +5904,18 @@ LRESULT MsgNotify(HWND hwnd,WPARAM wParam,LPARAM lParam)
SendMessage(hwnd,WM_COMMAND,MAKELONG(i,1),0);
return TRUE;
case STATUS_LEXER:
SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_VIEW_SCHEME,1),0);
return TRUE;
case STATUS_OVRMODE:
SendMessage(g_hwndEdit,SCI_EDITTOGGLEOVERTYPE,0,0);
return TRUE;
case STATUS_2ND_DEF:
SendMessage(hwnd, WM_COMMAND, MAKELONG(IDM_VIEW_USE2NDDEFAULT, 1), 0);
return TRUE;
case STATUS_LEXER:
SendMessage(hwnd, WM_COMMAND, MAKELONG(IDM_VIEW_SCHEME, 1), 0);
return TRUE;
default:
return FALSE;
}
@ -7122,7 +7129,7 @@ int CreateIniFileEx(LPCWSTR lpszIniFile) {
//
void MarkAllOccurrences(int delay)
{
if (delay <= 0) {
if (delay < USER_TIMER_MINIMUM) {
EditMarkAllOccurrences();
return;
}
@ -7136,7 +7143,7 @@ void MarkAllOccurrences(int delay)
//
void UpdateVisibleUrlHotspot(int delay)
{
if (delay <= 0) {
if (delay < USER_TIMER_MINIMUM) {
EditUpdateVisibleUrlHotspot();
return;
}
@ -7212,10 +7219,12 @@ void UpdateStatusbar()
static WCHAR tchDocPos[256] = { L'\0' };
static WCHAR tchBytes[64] = { L'\0' };
static WCHAR tchDocSize[256] = { L'\0' };
static WCHAR tchDocSize[64] = { L'\0' };
static WCHAR tchEncoding[64] = { L'\0' };
static WCHAR tchEOLMode[32] = { L'\0' };
static WCHAR tchOvrMode[32] = { L'\0' };
static WCHAR tch2ndDef[32] = { L'\0' };
static WCHAR tchLexerName[128] = { L'\0' };
static WCHAR tchLinesSelected[32] = { L'\0' };
@ -7256,15 +7265,15 @@ void UpdateStatusbar()
{
if ((iMarkOccurrencesMaxCount < 0) || (iMarkOccurrencesCount < iMarkOccurrencesMaxCount))
{
StringCchPrintf(tchOcc, COUNTOF(tchOcc), L"%i", iMarkOccurrencesCount);
StringCchPrintf(tchOcc, COUNTOF(tchOcc), L"%i ", iMarkOccurrencesCount);
FormatNumberStr(tchOcc);
}
else {
StringCchPrintf(tchOcc, COUNTOF(tchOcc), L">= %i", iMarkOccurrencesMaxCount);
StringCchPrintf(tchOcc, COUNTOF(tchOcc), L">= %i ", iMarkOccurrencesMaxCount);
}
}
else {
StringCchCopy(tchOcc, COUNTOF(tchOcc), L"--");
StringCchCopy(tchOcc, COUNTOF(tchOcc), L"-- ");
}
// Print number of selected lines in statusbar
@ -7288,32 +7297,41 @@ void UpdateStatusbar()
FormatString(tchDocSize, COUNTOF(tchDocSize), IDS_DOCSIZE, tchBytes);
Encoding_GetLabel(Encoding_Current(CPI_GET));
StringCchPrintf(tchEncoding, COUNTOF(tchEncoding), L" %s ", mEncoding[Encoding_Current(CPI_GET)].wchLabel);
if (iEOLMode == SC_EOL_CR)
{
StringCchCopy(tchEOLMode, COUNTOF(tchEOLMode), L" CR");
StringCchCopy(tchEOLMode, COUNTOF(tchEOLMode), L" CR ");
}
else if (iEOLMode == SC_EOL_LF)
{
StringCchCopy(tchEOLMode, COUNTOF(tchEOLMode), L" LF");
StringCchCopy(tchEOLMode, COUNTOF(tchEOLMode), L" LF ");
}
else {
StringCchCopy(tchEOLMode, COUNTOF(tchEOLMode), L" CR+LF");
StringCchCopy(tchEOLMode, COUNTOF(tchEOLMode), L" CR+LF ");
}
if (SendMessage(g_hwndEdit, SCI_GETOVERTYPE, 0, 0))
{
StringCchCopy(tchOvrMode, COUNTOF(tchOvrMode), L" OVR");
StringCchCopy(tchOvrMode, COUNTOF(tchOvrMode), L" OVR ");
}
else {
StringCchCopy(tchOvrMode, COUNTOF(tchOvrMode), L" INS");
StringCchCopy(tchOvrMode, COUNTOF(tchOvrMode), L" INS ");
}
if (Style_GetUse2ndDefault())
{
StringCchCopy(tch2ndDef, COUNTOF(tch2ndDef), L" 2ND ");
}
else {
StringCchCopy(tch2ndDef, COUNTOF(tch2ndDef), L" STD ");
}
Style_GetCurrentLexerName(tchLexerName, COUNTOF(tchLexerName));
StatusSetText(g_hwndStatus, STATUS_DOCPOS, tchDocPos);
StatusSetText(g_hwndStatus, STATUS_DOCSIZE, tchDocSize);
StatusSetText(g_hwndStatus, STATUS_CODEPAGE, mEncoding[Encoding_Current(CPI_GET)].wchLabel);
StatusSetText(g_hwndStatus, STATUS_CODEPAGE, tchEncoding);
StatusSetText(g_hwndStatus, STATUS_EOLMODE, tchEOLMode);
StatusSetText(g_hwndStatus, STATUS_OVRMODE, tchOvrMode);
StatusSetText(g_hwndStatus, STATUS_2ND_DEF, tch2ndDef);
StatusSetText(g_hwndStatus, STATUS_LEXER, tchLexerName);
//InvalidateRect(g_hwndStatus,NULL,TRUE);
@ -8078,7 +8096,7 @@ BOOL OpenFileDlg(HWND hwnd,LPWSTR lpstrFile,int cchFile,LPCWSTR lpstrInitialDir)
{
OPENFILENAME ofn;
WCHAR szFile[MAX_PATH] = { L'\0' };
WCHAR szFilter[NUMLEXERS*1024];
WCHAR szFilter[NUMLEXERS * AVG_NUM_OF_STYLES_PER_LEXER * 100];
WCHAR tchInitialDir[MAX_PATH] = { L'\0' };
Style_GetOpenDlgFilterStr(szFilter,COUNTOF(szFilter));
@ -8133,7 +8151,7 @@ BOOL SaveFileDlg(HWND hwnd,LPWSTR lpstrFile,int cchFile,LPCWSTR lpstrInitialDir)
{
OPENFILENAME ofn;
WCHAR szNewFile[MAX_PATH] = { L'\0' };
WCHAR szFilter[NUMLEXERS*1024] = { L'\0' };
WCHAR szFilter[NUMLEXERS * AVG_NUM_OF_STYLES_PER_LEXER * 100] = { L'\0' };
WCHAR tchInitialDir[MAX_PATH] = { L'\0' };
StringCchCopy(szNewFile,COUNTOF(szNewFile),lpstrFile);

View File

@ -91,7 +91,8 @@ typedef enum {
#define STATUS_CODEPAGE 2
#define STATUS_EOLMODE 3
#define STATUS_OVRMODE 4
#define STATUS_LEXER 5
#define STATUS_2ND_DEF 5
#define STATUS_LEXER 6
#define STATUS_HELP 255

View File

@ -1921,6 +1921,7 @@ STRINGTABLE
BEGIN
63264 "Hyperlink Hotspots"
63265 "2nd Hyperlink Hotspots"
63266 "2nd Default Text"
END
#endif // English (United States) resources

File diff suppressed because it is too large Load Diff

View File

@ -59,8 +59,8 @@ typedef struct _editlexer
// Number of Lexers in pLexArray
#define NUMLEXERS 45
#define MAX_NUM_OF_STYLES_PER_LEXER 64
#define NUMLEXERS 46
#define AVG_NUM_OF_STYLES_PER_LEXER 20
void Style_Load();