mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2025-12-28 07:54:07 +00:00
+ upd: EOL detection method by Zufuliu
+ upd: VS2017 and VS2019 version info
This commit is contained in:
parent
f09ea37d65
commit
574e87b1ee
2
.gitignore
vendored
2
.gitignore
vendored
@ -49,6 +49,8 @@ Thumbs.db
|
||||
/src/VersionEx.h
|
||||
/minipath/src/VersionEx.h
|
||||
|
||||
/test/test.log
|
||||
|
||||
/Version_*.cmd
|
||||
/Versions/build.txt
|
||||
/np3portableapp/_buildname.txt
|
||||
|
||||
53
src/Edit.c
53
src/Edit.c
@ -838,40 +838,49 @@ void EditDetectEOLMode(LPCSTR lpData, DWORD cbData, EditFileIOStatus* status)
|
||||
|
||||
DocLn linesCount[3] = { 0, 0, 0 };
|
||||
|
||||
LPCSTR cp = lpData;
|
||||
LPCSTR const end = cp + cbData;
|
||||
while (cp < end) {
|
||||
switch (*cp) {
|
||||
case '\n':
|
||||
++cp;
|
||||
|
||||
// tools/GenerateTable.py
|
||||
static const UINT8 eol_table[16] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 0, // 00 - 0F
|
||||
};
|
||||
|
||||
const UINT8* ptr = (const UINT8*)lpData;
|
||||
const UINT8* const end = ptr + cbData;
|
||||
do {
|
||||
// skip to line end
|
||||
UINT ch;
|
||||
UINT type = 0;
|
||||
while (ptr < end && ((ch = *ptr++) > '\r' || (type = eol_table[ch]) == 0)) { /* nop */ }
|
||||
switch (type) {
|
||||
case 1: //'\n'
|
||||
++linesCount[SC_EOL_LF];
|
||||
break;
|
||||
case '\r':
|
||||
++cp;
|
||||
if (*cp == '\n') {
|
||||
++cp;
|
||||
case 2: //'\r'
|
||||
if (*ptr == '\n') {
|
||||
++ptr;
|
||||
++linesCount[SC_EOL_CRLF];
|
||||
}
|
||||
else {
|
||||
++linesCount[SC_EOL_CR];
|
||||
}
|
||||
break;
|
||||
default:
|
||||
++cp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while (ptr < end);
|
||||
|
||||
|
||||
DocLn const linesMax = max_ln(max_ln(linesCount[0], linesCount[1]), linesCount[2]);
|
||||
|
||||
if (linesMax == linesCount[SC_EOL_CRLF]) {
|
||||
iEOLMode = SC_EOL_CRLF;
|
||||
}
|
||||
else if (linesMax == linesCount[SC_EOL_CR]) {
|
||||
iEOLMode = SC_EOL_CR;
|
||||
}
|
||||
else {
|
||||
iEOLMode = SC_EOL_LF;
|
||||
if (linesMax != linesCount[iEOLMode])
|
||||
{
|
||||
if (linesMax == linesCount[SC_EOL_CRLF]) {
|
||||
iEOLMode = SC_EOL_CRLF;
|
||||
}
|
||||
else if (linesMax == linesCount[SC_EOL_CR]) {
|
||||
iEOLMode = SC_EOL_CR;
|
||||
}
|
||||
else {
|
||||
iEOLMode = SC_EOL_LF;
|
||||
}
|
||||
}
|
||||
|
||||
status->iEOLMode = iEOLMode;
|
||||
|
||||
@ -62,7 +62,7 @@
|
||||
#if defined(_MSC_VER)
|
||||
#if (_MSC_VER >= 1920)
|
||||
#if(_MSC_FULL_VER >= v192027404)
|
||||
#define VER_CPL MS Visual C++ 2019 16.(RC) Prev 4.(0-1)
|
||||
#define VER_CPL MS Visual C++ 2019 16.0.0 Prev 4.(0-2)
|
||||
#elif(_MSC_FULL_VER >= 192027323)
|
||||
#define VER_CPL MS Visual C++ 2019 16.0.0 Prev 3.0
|
||||
#elif(_MSC_FULL_VER >= 192027305)
|
||||
@ -72,7 +72,7 @@
|
||||
#endif
|
||||
#elif (_MSC_VER >= 1916)
|
||||
#if(_MSC_FULL_VER >= 191627027)
|
||||
#define VER_CPL MS Visual C++ 2017 v15.9.(7-8)
|
||||
#define VER_CPL MS Visual C++ 2017 v15.9.(7-9)
|
||||
#elif(_MSC_FULL_VER >= 191627026)
|
||||
#define VER_CPL MS Visual C++ 2017 v15.9.(5-6)
|
||||
#elif(_MSC_FULL_VER >= 191627025)
|
||||
|
||||
Binary file not shown.
Loading…
Reference in New Issue
Block a user