Merge pull request #577 from RaiKoHoff/Dev_ChngDPI

Fix: Reload with prefered encoding
This commit is contained in:
Rainer Kottenhoff 2018-08-06 20:10:54 +02:00 committed by GitHub
commit 7dfe5cbef3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 177 additions and 141 deletions

Binary file not shown.

View File

@ -281,41 +281,42 @@
#define CMD_RECODEANSI 20011
#define CMD_RECODEOEM 20012
#define CMD_RELOADASCIIASUTF8 20013
#define CMD_RELOADNOFILEVARS 20014
#define CMD_LEXDEFAULT 20015
#define CMD_LEXHTML 20016
#define CMD_LEXXML 20017
#define CMD_TIMESTAMPS 20018
#define CMD_WEBACTION1 20019
#define CMD_WEBACTION2 20020
#define CMD_FINDNEXTSEL 20021
#define CMD_FINDPREVSEL 20022
#define CMD_INCLINELIMIT 20023
#define CMD_DECLINELIMIT 20024
#define CMD_STRINGIFY 20025
#define CMD_STRINGIFY2 20026
#define CMD_EMBRACE 20027
#define CMD_EMBRACE2 20028
#define CMD_EMBRACE3 20029
#define CMD_EMBRACE4 20030
#define CMD_INCREASENUM 20031
#define CMD_DECREASENUM 20032
#define CMD_TOGGLETITLE 20033
#define CMD_JUMP2SELSTART 20034
#define CMD_JUMP2SELEND 20035
#define CMD_COPYPATHNAME 20036
#define CMD_COPYWINPOS 20037
#define CMD_DEFAULTWINPOS 20038
#define CMD_OPENINIFILE 20039
#define CMD_CTRLENTER 20040
#define CMD_OPEN_HYPERLINK 20041
#define CMD_ALTUP 20042
#define CMD_ALTDOWN 20043
#define CMD_ALTLEFT 20044
#define CMD_ALTRIGHT 20045
#define CMD_TAB 20046
#define CMD_BACKTAB 20047
#define CMD_VK_INSERT 20048
#define CMD_RELOADFORCEDETECTION 20014
#define CMD_RELOADNOFILEVARS 20015
#define CMD_LEXDEFAULT 20016
#define CMD_LEXHTML 20017
#define CMD_LEXXML 20018
#define CMD_TIMESTAMPS 20019
#define CMD_WEBACTION1 20020
#define CMD_WEBACTION2 20021
#define CMD_FINDNEXTSEL 20022
#define CMD_FINDPREVSEL 20023
#define CMD_INCLINELIMIT 20024
#define CMD_DECLINELIMIT 20025
#define CMD_STRINGIFY 20026
#define CMD_STRINGIFY2 20027
#define CMD_EMBRACE 20028
#define CMD_EMBRACE2 20029
#define CMD_EMBRACE3 20030
#define CMD_EMBRACE4 20031
#define CMD_INCREASENUM 20032
#define CMD_DECREASENUM 20033
#define CMD_TOGGLETITLE 20034
#define CMD_JUMP2SELSTART 20035
#define CMD_JUMP2SELEND 20036
#define CMD_COPYPATHNAME 20037
#define CMD_COPYWINPOS 20038
#define CMD_DEFAULTWINPOS 20039
#define CMD_OPENINIFILE 20040
#define CMD_CTRLENTER 20041
#define CMD_OPEN_HYPERLINK 20042
#define CMD_ALTUP 20043
#define CMD_ALTDOWN 20044
#define CMD_ALTLEFT 20045
#define CMD_ALTRIGHT 20046
#define CMD_TAB 20047
#define CMD_BACKTAB 20048
#define CMD_VK_INSERT 20049
#define IDM_FILE_NEW 40000
#define IDM_FILE_OPEN 40001

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1020,24 +1020,34 @@ bool EditLoadFile(
bPreferOEM = true;
}
const int iForcedEncoding = Encoding_SrcCmdLn(CPI_GET);
const int iFileEncWeak = Encoding_SrcWeak(CPI_GET);
const size_t cbNbytes4Analysis = (cbData < 200000L) ? cbData : 200000L;
size_t const cbNbytes4Analysis = (cbData < 200000L) ? cbData : 200000L;
// if not skipped, analyze bytes
bool bIsReliable = false;
const int iAnalyzedEncoding = bSkipANSICPDetection ? CPI_NONE : Encoding_Analyze(lpData, cbNbytes4Analysis, &bIsReliable);
int const iAnalyzedEncoding = (bSkipANSICPDetection && !g_bForceCompEncDetection) ? CPI_NONE :
Encoding_Analyze(lpData, cbNbytes4Analysis, &bIsReliable);
int const iFileEncWeak = Encoding_SrcWeak(CPI_GET);
int iForcedEncoding = bLoadASCIIasUTF8 ? CPI_UTF8 : Encoding_SrcCmdLn(CPI_GET);
if (g_bForceCompEncDetection && !Encoding_IsNONE(iAnalyzedEncoding) && bIsReliable) {
iForcedEncoding = iAnalyzedEncoding;
}
// choose best encoding guess
int iPreferedEncoding = (bPreferOEM) ? g_DOSEncoding : (bUseDefaultForFileEncoding ? g_iDefaultNewFileEncoding : CPI_ANSI_DEFAULT);
if (iForcedEncoding != CPI_NONE)
int iPreferedEncoding = CPI_NONE;
if (!Encoding_IsNONE(iForcedEncoding))
iPreferedEncoding = iForcedEncoding;
else if (iFileEncWeak != CPI_NONE)
iPreferedEncoding = iFileEncWeak;
else if (Encoding_IsUNICODE(iAnalyzedEncoding) && !bSkipUTFDetection)
iPreferedEncoding = iAnalyzedEncoding;
else if (iAnalyzedEncoding != CPI_NONE)
else if (!Encoding_IsNONE(iAnalyzedEncoding))
iPreferedEncoding = iAnalyzedEncoding;
else
iPreferedEncoding = (bPreferOEM) ? g_DOSEncoding :
(bUseDefaultForFileEncoding ? g_iDefaultNewFileEncoding : CPI_ANSI_DEFAULT);
bool bBOM = false;
@ -3698,7 +3708,7 @@ void EditRemoveDuplicateLines(HWND hwnd, bool bRemoveEmptyLines)
if (iSelEnd <= SciCall_PositionFromLine(iEndLine)) { --iEndLine; }
}
else {
iEndLine = Sci_GetLastDocLine();
iEndLine = Sci_GetLastDocLineNumber();
}
if ((iEndLine - iStartLine) <= 1) { return; }
@ -6369,7 +6379,7 @@ bool EditToggleView(HWND hwnd, bool bToggleView)
SciCall_SetReadOnly(true);
}
else {
EditScrollTo(hwnd, Sci_GetCurrentLine(), true);
EditScrollTo(hwnd, Sci_GetCurrentLineNumber(), true);
SciCall_SetReadOnly(false);
}

View File

@ -40,8 +40,6 @@
extern HMODULE g_hLngResContainer;
extern bool bLoadASCIIasUTF8;
//=============================================================================
#define ENC_PARSE_NAM_ANSI "ansi,system,ascii,"
@ -281,7 +279,8 @@ int Encoding_CountOf()
// Encoding Helper Functions
//
int g_DOSEncoding;
int g_DOSEncoding = CPI_NONE;
bool g_bForceCompEncDetection = false;
// Supported Encodings
WCHAR wchANSI[16] = { L'\0' };

View File

@ -35,6 +35,7 @@
#define _NP3_ENCODING_H_
extern int g_DOSEncoding;
extern bool g_bForceCompEncDetection;
#define NCP_DEFAULT 1
#define NCP_UTF8 2

View File

@ -3019,22 +3019,24 @@ int ReadStrgsFromCSV(LPCWSTR wchCSVStrg, prefix_t sMatrix[], int const iCount, i
StringCchCopyW(wchTmpBuff, COUNTOF(wchTmpBuff), wchCSVStrg);
TrimString(wchTmpBuff);
// separate values
int const len = (int)StringCchLenW(wchTmpBuff, COUNTOF(wchTmpBuff));
for (int i = 0; i < len; ++i) {
if (wchTmpBuff[i] == L',') { wchTmpBuff[i] = L'\0'; }
}
wchTmpBuff[len + 1] = L'\0'; // double zero at the end
// fill default
for (int i = 0; i < iCount; ++i) { StringCchCopyW(sMatrix[i], (size_t)iLen, sDefault); }
for (int i = 0; i < iCount; ++i) {
if (sDefault && *sDefault)
StringCchCopyW(sMatrix[i], (size_t)iLen, sDefault);
else
sMatrix[i][0] = L'\0';
}
// insert values
int n = 0;
WCHAR* p = wchTmpBuff;
while (*p) {
while (p && *p) {
WCHAR* q = StrStrW(p, L",");
if (q > p) { *q = L'\0'; }
if (n < iCount) {
StringCchCopyW(sMatrix[n++], (size_t)iLen, p);
if (*p != L',') { StringCchCopyW(sMatrix[n], (size_t)iLen, p); }
}
p = StrEnd(p) + 1;
p = (q > p) ? (q + 1) : (p + 1);
++n;
}
return n;
}

View File

@ -151,15 +151,13 @@ static WCHAR g_tchDefaultDir[MAX_PATH] = { L'\0' };
static WCHAR g_tchToolbarButtons[MIDSZ_BUFFER] = { L'\0' };
static WCHAR g_tchStatusbarPrefixes[MIDSZ_BUFFER] = { L'\0' };
static prefix_t g_mxStatusBarPrefix[STATUS_SECTOR_COUNT];
static prefix_t g_mxSBPrefix[STATUS_SECTOR_COUNT];
static prefix_t g_mxSBPostfix[STATUS_SECTOR_COUNT];
static WCHAR g_tchStatusbarSections[SMALL_BUFFER] = { L'\0' };
static int g_iStatusbarSections[STATUS_SECTOR_COUNT] = SBS_INIT_MINUS;
static bool g_iStatusbarVisible[STATUS_SECTOR_COUNT] = SBS_INIT_ZERO;
static int g_vSBSOrder[STATUS_SECTOR_COUNT] = SBS_INIT_MINUS;
static WCHAR g_tchStatusbarWidthSpec[SMALL_BUFFER] = { L'\0' };
static int g_iStatusbarWidthSpec[STATUS_SECTOR_COUNT] = SBS_INIT_ZERO;
@ -2656,6 +2654,7 @@ void MsgInitMenu(HWND hwnd,WPARAM wParam,LPARAM lParam)
int i = (int)StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile));
EnableCmd(hmenu,IDM_FILE_REVERT,i);
EnableCmd(hmenu, CMD_RELOADASCIIASUTF8, i);
EnableCmd(hmenu, CMD_RELOADFORCEDETECTION, i);
EnableCmd(hmenu, CMD_RECODEANSI, i);
EnableCmd(hmenu, CMD_RECODEOEM, i);
EnableCmd(hmenu, CMD_RELOADNOFILEVARS, i);
@ -5258,17 +5257,30 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case CMD_RELOADASCIIASUTF8:
{
WCHAR tchCurFile2[MAX_PATH] = { L'\0' };
bool _bLoadASCIIasUTF8 = bLoadASCIIasUTF8;
bool _bLoadASCIIasUTF8 = bLoadASCIIasUTF8; // remember
if (StringCchLenW(g_wchCurFile,COUNTOF(g_wchCurFile))) {
bLoadASCIIasUTF8 = 1;
bLoadASCIIasUTF8 = true;
StringCchCopy(tchCurFile2,COUNTOF(tchCurFile2),g_wchCurFile);
FileLoad(false,false,true,false,true,tchCurFile2);
bLoadASCIIasUTF8 = _bLoadASCIIasUTF8;
FileLoad(false, false, true, true, true, tchCurFile2);
bLoadASCIIasUTF8 = _bLoadASCIIasUTF8; // restore
}
}
break;
case CMD_RELOADFORCEDETECTION:
{
WCHAR tchCurFile2[MAX_PATH] = { L'\0' };
g_bForceCompEncDetection = true;
if (StringCchLenW(g_wchCurFile, COUNTOF(g_wchCurFile))) {
bLoadASCIIasUTF8 = false;
StringCchCopy(tchCurFile2, COUNTOF(tchCurFile2), g_wchCurFile);
FileLoad(false, false, true, false, false, tchCurFile2);
}
g_bForceCompEncDetection = false;
}
break;
case CMD_RELOADNOFILEVARS:
{
WCHAR tchCurFile2[MAX_PATH] = { L'\0' };
@ -6707,11 +6719,16 @@ void LoadSettings()
LoadIniSection(L"Statusbar Settings", pIniSection, cchIniSection);
// --------------------------------------------------------------------------
IniSectionGetString(pIniSection, L"SectionPrefixes", STATUSBAR_EXTION_PREFIXES, g_tchStatusbarPrefixes, COUNTOF(g_tchStatusbarPrefixes));
ReadStrgsFromCSV(g_tchStatusbarPrefixes, g_mxStatusBarPrefix, STATUS_SECTOR_COUNT, MICRO_BUFFER, L"");
WCHAR tchStatusBar[MIDSZ_BUFFER] = { L'\0' };
IniSectionGetString(pIniSection, L"VisibleSections", STATUSBAR_DEFAULT_IDS, g_tchStatusbarSections, COUNTOF(g_tchStatusbarSections));
ReadVectorFromString(g_tchStatusbarSections, g_iStatusbarSections, STATUS_SECTOR_COUNT, 0, (STATUS_SECTOR_COUNT - 1), -1);
IniSectionGetString(pIniSection, L"SectionPrefixes", STATUSBAR_SECTION_PREFIXES, tchStatusBar, COUNTOF(tchStatusBar));
ReadStrgsFromCSV(tchStatusBar, g_mxSBPrefix, STATUS_SECTOR_COUNT, MICRO_BUFFER, L"");
IniSectionGetString(pIniSection, L"SectionPostfixes", STATUSBAR_SECTION_POSTFIXES, tchStatusBar, COUNTOF(tchStatusBar));
ReadStrgsFromCSV(tchStatusBar, g_mxSBPostfix, STATUS_SECTOR_COUNT, MICRO_BUFFER, L"");
IniSectionGetString(pIniSection, L"VisibleSections", STATUSBAR_DEFAULT_IDS, tchStatusBar, COUNTOF(tchStatusBar));
ReadVectorFromString(tchStatusBar, g_iStatusbarSections, STATUS_SECTOR_COUNT, 0, (STATUS_SECTOR_COUNT - 1), -1);
for (int i = 0; i < STATUS_SECTOR_COUNT; ++i) {
g_iStatusbarVisible[i] = false;
@ -6726,8 +6743,8 @@ void LoadSettings()
}
}
IniSectionGetString(pIniSection, L"SectionWidthSpecs", STATUSBAR_SECTION_WIDTH_SPECS, g_tchStatusbarWidthSpec, COUNTOF(g_tchStatusbarWidthSpec));
ReadVectorFromString(g_tchStatusbarWidthSpec, g_iStatusbarWidthSpec, STATUS_SECTOR_COUNT, -4096, 4096, 0);
IniSectionGetString(pIniSection, L"SectionWidthSpecs", STATUSBAR_SECTION_WIDTH_SPECS, tchStatusBar, COUNTOF(tchStatusBar));
ReadVectorFromString(tchStatusBar, g_iStatusbarWidthSpec, STATUS_SECTOR_COUNT, -4096, 4096, 0);
// --------------------------------------------------------------------------
@ -7977,7 +7994,8 @@ static void __fastcall _UpdateStatusbarDelayed(bool bForceRedraw)
if ((s_iLnFromPos != iLnFromPos) || (s_iLnCnt != iLnCnt))
{
FormatLngStringW(tchStatusBar[STATUS_DOCLINE], txtWidth, IDS_STATUS_DOCLINE, g_mxStatusBarPrefix[STATUS_DOCLINE], tchLn, tchLines);
StringCchPrintf(tchStatusBar[STATUS_DOCLINE], txtWidth, L"%s%s / %s%s",
g_mxSBPrefix[STATUS_DOCLINE], tchLn, tchLines, g_mxSBPostfix[STATUS_DOCLINE]);
s_iLnFromPos = iLnFromPos;
s_iLnCnt = iLnCnt;
bIsUpdateNeeded = true;
@ -7986,6 +8004,7 @@ static void __fastcall _UpdateStatusbarDelayed(bool bForceRedraw)
// ------------------------------------------------------
static WCHAR tchCol[32] = { L'\0' };
static WCHAR tchCols[32] = { L'\0' };
static DocPos s_iCol = -1;
DocPos const iCol = SciCall_GetColumn(iPos) + SciCall_GetSelectionNCaretVirtualSpace(0) + 1;
@ -7994,22 +8013,19 @@ static void __fastcall _UpdateStatusbarDelayed(bool bForceRedraw)
FormatNumberStr(tchCol);
}
static WCHAR tchCols[32] = { L'\0' };
static bool s_bmarkLongLines = false;
static int s_iLongLinesLimit = -1;
if ((s_bmarkLongLines != bMarkLongLines) || (s_iCol != iCol) || (s_iLongLinesLimit != g_iLongLinesLimit)) {
if (bMarkLongLines) {
StringCchPrintf(tchCols, COUNTOF(tchCols), L"%td", g_iLongLinesLimit);
FormatNumberStr(tchCols);
FormatLngStringW(tchStatusBar[STATUS_DOCCOLUMN], txtWidth, IDS_STATUS_DOCCOLUMN2, g_mxStatusBarPrefix[STATUS_DOCCOLUMN], tchCol, tchCols);
}
else {
tchCols[0] = L'\0';
FormatLngStringW(tchStatusBar[STATUS_DOCCOLUMN], txtWidth, IDS_STATUS_DOCCOLUMN, g_mxStatusBarPrefix[STATUS_DOCCOLUMN], tchCol);
}
static DocPos s_iLineLen = -1;
DocPos const iLineLen = Sci_GetNetLineLength(Sci_GetCurrentLineNumber()) + 1;
if (s_iLineLen != iLineLen) {
StringCchPrintf(tchCols, COUNTOF(tchCols), L"%td", iLineLen);
FormatNumberStr(tchCols);
}
if ((s_iCol != iCol) || (s_iLineLen != iLineLen)) {
StringCchPrintf(tchStatusBar[STATUS_DOCCOLUMN], txtWidth, L"%s%s / %s%s",
g_mxSBPrefix[STATUS_DOCCOLUMN], tchCol, tchCols, g_mxSBPostfix[STATUS_DOCCOLUMN]);
s_iCol = iCol;
s_bmarkLongLines = bMarkLongLines;
s_iLongLinesLimit = g_iLongLinesLimit;
s_iLineLen = iLineLen;
bIsUpdateNeeded = true;
}
@ -8041,9 +8057,10 @@ static void __fastcall _UpdateStatusbarDelayed(bool bForceRedraw)
tchSel[0] = L'-'; tchSel[1] = L'-'; tchSel[2] = L'\0';
tchSelB[0] = L'0'; tchSelB[1] = L'\0';
}
FormatLngStringW(tchStatusBar[STATUS_SELECTION], txtWidth, IDS_STATUS_SELECTION, g_mxStatusBarPrefix[STATUS_SELECTION], tchSel);
FormatLngStringW(tchStatusBar[STATUS_SELCTBYTES], txtWidth, IDS_STATUS_SELCTBYTES, g_mxStatusBarPrefix[STATUS_SELCTBYTES], tchSelB);
StringCchPrintf(tchStatusBar[STATUS_SELECTION], txtWidth, L"%s%s%s",
g_mxSBPrefix[STATUS_SELECTION], tchSel, g_mxSBPostfix[STATUS_SELECTION]);
StringCchPrintf(tchStatusBar[STATUS_SELCTBYTES], txtWidth, L"%s%s%s",
g_mxSBPrefix[STATUS_SELCTBYTES], tchSelB, g_mxSBPostfix[STATUS_SELCTBYTES]);
s_bIsSelCountable = bIsSelCountable;
s_iSelStart = iSelStart;
@ -8077,8 +8094,8 @@ static void __fastcall _UpdateStatusbarDelayed(bool bForceRedraw)
StringCchPrintf(tchLinesSelected, COUNTOF(tchLinesSelected), L"%i", iLinesSelected);
FormatNumberStr(tchLinesSelected);
}
FormatLngStringW(tchStatusBar[STATUS_SELCTLINES], txtWidth, IDS_STATUS_SELCTLINES, g_mxStatusBarPrefix[STATUS_SELCTLINES], tchLinesSelected);
StringCchPrintf(tchStatusBar[STATUS_SELCTLINES], txtWidth, L"%s%s%s",
g_mxSBPrefix[STATUS_SELCTLINES], tchLinesSelected, g_mxSBPostfix[STATUS_SELCTLINES]);
s_bIsSelectionEmpty = bIsSelectionEmpty;
s_iLinesSelected = iLinesSelected;
@ -8112,7 +8129,8 @@ static void __fastcall _UpdateStatusbarDelayed(bool bForceRedraw)
StringCchCopy(tchOcc, COUNTOF(tchOcc), L"--");
}
FormatLngStringW(tchStatusBar[STATUS_OCCURRENCE], txtWidth, IDS_STATUS_OCCURRENCE, g_mxStatusBarPrefix[STATUS_OCCURRENCE], tchOcc);
StringCchPrintf(tchStatusBar[STATUS_OCCURRENCE], txtWidth, L"%s%s%s",
g_mxSBPrefix[STATUS_OCCURRENCE], tchOcc, g_mxSBPostfix[STATUS_OCCURRENCE]);
s_bMOVisible = g_bMarkOccurrencesMatchVisible;
s_iMarkOccurrencesCount = g_iMarkOccurrencesCount;
@ -8127,7 +8145,10 @@ static void __fastcall _UpdateStatusbarDelayed(bool bForceRedraw)
DocPos const iTextLength = SciCall_GetTextLength();
if (s_iTextLength != iTextLength) {
StrFormatByteSize(iTextLength, tchBytes, COUNTOF(tchBytes));
FormatLngStringW(tchStatusBar[STATUS_DOCSIZE], txtWidth, IDS_STATUS_DOCSIZE, g_mxStatusBarPrefix[STATUS_DOCSIZE], tchBytes);
StringCchPrintf(tchStatusBar[STATUS_DOCSIZE], txtWidth, L"%s%s%s",
g_mxSBPrefix[STATUS_DOCSIZE], tchBytes, g_mxSBPostfix[STATUS_DOCSIZE]);
s_iTextLength = iTextLength;
bIsUpdateNeeded = true;
}
@ -8136,7 +8157,10 @@ static void __fastcall _UpdateStatusbarDelayed(bool bForceRedraw)
int const iEncoding = Encoding_Current(CPI_GET);
if (s_iEncoding != iEncoding) {
Encoding_SetLabel(iEncoding);
StringCchPrintf(tchStatusBar[STATUS_CODEPAGE], txtWidth, L"%s%s", g_mxStatusBarPrefix[STATUS_CODEPAGE], Encoding_GetLabel(iEncoding));
StringCchPrintf(tchStatusBar[STATUS_CODEPAGE], txtWidth, L"%s%s%s",
g_mxSBPrefix[STATUS_CODEPAGE], Encoding_GetLabel(iEncoding), g_mxSBPostfix[STATUS_CODEPAGE]);
s_iEncoding = iEncoding;
bIsUpdateNeeded = true;
}
@ -8147,14 +8171,17 @@ static void __fastcall _UpdateStatusbarDelayed(bool bForceRedraw)
if (s_iEOLMode != g_iEOLMode) {
if (g_iEOLMode == SC_EOL_CR)
{
StringCchPrintf(tchStatusBar[STATUS_EOLMODE], txtWidth, L"%sCR", g_mxStatusBarPrefix[STATUS_EOLMODE]);
StringCchPrintf(tchStatusBar[STATUS_EOLMODE], txtWidth, L"%sCR%s",
g_mxSBPrefix[STATUS_EOLMODE], g_mxSBPostfix[STATUS_EOLMODE]);
}
else if (g_iEOLMode == SC_EOL_LF)
{
StringCchPrintf(tchStatusBar[STATUS_EOLMODE], txtWidth, L"%sLF", g_mxStatusBarPrefix[STATUS_EOLMODE]);
StringCchPrintf(tchStatusBar[STATUS_EOLMODE], txtWidth, L"%sLF%s",
g_mxSBPrefix[STATUS_EOLMODE], g_mxSBPostfix[STATUS_EOLMODE]);
}
else {
StringCchPrintf(tchStatusBar[STATUS_EOLMODE], txtWidth, L"%sCR+LF", g_mxStatusBarPrefix[STATUS_EOLMODE]);
StringCchPrintf(tchStatusBar[STATUS_EOLMODE], txtWidth, L"%sCR+LF%s",
g_mxSBPrefix[STATUS_EOLMODE], g_mxSBPostfix[STATUS_EOLMODE]);
}
s_iEOLMode = g_iEOLMode;
bIsUpdateNeeded = true;
@ -8166,10 +8193,12 @@ static void __fastcall _UpdateStatusbarDelayed(bool bForceRedraw)
if (s_bIsOVR != bIsOVR) {
if (bIsOVR)
{
StringCchPrintf(tchStatusBar[STATUS_OVRMODE], txtWidth, L"%sOVR", g_mxStatusBarPrefix[STATUS_OVRMODE]);
StringCchPrintf(tchStatusBar[STATUS_OVRMODE], txtWidth, L"%sOVR%s",
g_mxSBPrefix[STATUS_OVRMODE], g_mxSBPostfix[STATUS_OVRMODE]);
}
else {
StringCchPrintf(tchStatusBar[STATUS_OVRMODE], txtWidth, L"%sINS", g_mxStatusBarPrefix[STATUS_OVRMODE]);
StringCchPrintf(tchStatusBar[STATUS_OVRMODE], txtWidth, L"%sINS%s",
g_mxSBPrefix[STATUS_OVRMODE], g_mxSBPostfix[STATUS_OVRMODE]);
}
s_bIsOVR = bIsOVR;
bIsUpdateNeeded = true;
@ -8181,9 +8210,11 @@ static void __fastcall _UpdateStatusbarDelayed(bool bForceRedraw)
if (s_bUse2ndDefault != bUse2ndDefault)
{
if (bUse2ndDefault)
StringCchPrintf(tchStatusBar[STATUS_2ND_DEF], txtWidth, L"%s2ND", g_mxStatusBarPrefix[STATUS_2ND_DEF]);
StringCchPrintf(tchStatusBar[STATUS_2ND_DEF], txtWidth, L"%s2ND%s",
g_mxSBPrefix[STATUS_2ND_DEF], g_mxSBPostfix[STATUS_2ND_DEF]);
else
StringCchPrintf(tchStatusBar[STATUS_2ND_DEF], txtWidth, L"%sSTD", g_mxStatusBarPrefix[STATUS_2ND_DEF]);
StringCchPrintf(tchStatusBar[STATUS_2ND_DEF], txtWidth, L"%sSTD%s",
g_mxSBPrefix[STATUS_2ND_DEF], g_mxSBPostfix[STATUS_2ND_DEF]);
s_bUse2ndDefault = bUse2ndDefault;
bIsUpdateNeeded = true;
@ -8201,7 +8232,9 @@ static void __fastcall _UpdateStatusbarDelayed(bool bForceRedraw)
else
Style_GetLexerDisplayName(Style_GetCurrentLexerPtr(), tchLexerName, MINI_BUFFER);
StringCchPrintf(tchStatusBar[STATUS_LEXER], txtWidth, L"%s%s", g_mxStatusBarPrefix[STATUS_LEXER], tchLexerName);
StringCchPrintf(tchStatusBar[STATUS_LEXER], txtWidth, L"%s%s%s",
g_mxSBPrefix[STATUS_LEXER], tchLexerName, g_mxSBPostfix[STATUS_LEXER]);
s_iCurLexer = iCurLexer;
bIsUpdateNeeded = true;
}
@ -8250,8 +8283,15 @@ static void __fastcall _UpdateStatusbarDelayed(bool bForceRedraw)
else
StringCchCopy(tchReplOccs, COUNTOF(tchReplOccs), L"--");
FormatLngStringW(tchFRStatus, COUNTOF(tchFRStatus), IDS_FR_STATUS_FMT,
tchLn, tchLines, tchCol, tchSel, tchOcc, tchReplOccs, FR_Status[g_FindReplaceMatchFoundState]);
const WCHAR* SBFMT = L" %s%s / %s %s%s %s%s %s%s %s%s ( %s ) ";
StringCchPrintf(tchFRStatus, COUNTOF(tchFRStatus), SBFMT,
g_mxSBPrefix[STATUS_DOCLINE], tchLn, tchLines,
g_mxSBPrefix[STATUS_DOCCOLUMN], tchCol,
g_mxSBPrefix[STATUS_SELECTION], tchSel,
g_mxSBPrefix[STATUS_OCCURRENCE], tchOcc,
g_mxSBPrefix[STATUS_OCCREPLACE], tchReplOccs,
FR_Status[g_FindReplaceMatchFoundState]);
SetWindowText(GetDlgItem(g_hwndDlgFindReplace, IDS_FR_STATUS_TEXT), tchFRStatus);
}

View File

@ -312,15 +312,6 @@ END
STRINGTABLE
BEGIN
IDS_WARN_PREF_LNG_NOT_AVAIL "Sorry, your prefered language (%s) is not available."
IDS_STATUS_DOCLINE "%s%s / %s"
IDS_STATUS_DOCCOLUMN "%s%s"
IDS_STATUS_DOCCOLUMN2 "%s%s / %s"
IDS_STATUS_SELECTION "%s%s"
IDS_STATUS_SELCTLINES "%s%s"
IDS_STATUS_SELCTBYTES "%s%s"
IDS_STATUS_OCCURRENCE "%s%s"
IDS_STATUS_DOCSIZE "%s%s [UTF-8]"
IDS_FR_STATUS_FMT " Ln %s / %s Col %s Sel %s Occ %s Repl %s ( %s ) "
END

View File

@ -235,6 +235,7 @@ DeclareSciCallR1(GetLineIndentPosition, GETLINEINDENTPOSITION, DocPos, DocLn, li
DeclareSciCallR2(GetRangePointer, GETRANGEPOINTER, char* const, DocPos, start, DocPos, length)
DeclareSciCallR0(GetCharacterPointer, GETCHARACTERPOINTER, char* const)
DeclareSciCallR2(GetLine, GETLINE, DocPos, DocLn, line, const char*, text)
DeclareSciCallR2(GetCurLine, GETCURLINE, DocPos, unsigned int, length, const char*, text)
DeclareSciCallV1(SetVirtualSpaceOptions, SETVIRTUALSPACEOPTIONS, int, options)
@ -396,8 +397,8 @@ DeclareSciCallR0(IsSelectionRectangle, SELECTIONISRECTANGLE, bool)
#define Sci_GetEOLLen() ((SciCall_GetEOLMode() == SC_EOL_CRLF) ? 2 : 1)
#define Sci_GetCurrentLine() SciCall_LineFromPosition(SciCall_GetCurrentPos())
#define Sci_GetLastDocLine() (SciCall_GetLineCount() - 1)
#define Sci_GetCurrentLineNumber() SciCall_LineFromPosition(SciCall_GetCurrentPos())
#define Sci_GetLastDocLineNumber() (SciCall_GetLineCount() - 1)
// length of line w/o line-end chars (full use SciCall_LineLength()
#define Sci_GetNetLineLength(line) (SciCall_GetLineEndPosition(line) - SciCall_PositionFromLine(line))

View File

@ -2718,7 +2718,7 @@ KEYWORDLIST KeyWords_D = {
// Keywords 7
"",
// ---
""
"", ""
};
@ -2762,7 +2762,7 @@ KEYWORDLIST KeyWords_Go = {
// Keywords 7
"",
// ---
""
"", ""
};
@ -2804,7 +2804,7 @@ KEYWORDLIST KeyWords_Awk = {
"ARGC ARGIND ARGV FILENAME FNR FS NF NR OFMT OFS ORS RLENGTH RS RSTART SUBSEP TEXTDOMAIN "
"BINMODE CONVFMT FIELDWIDTHS FPAT IGNORECASE LINT TEXTDOMAiN ENVIRON ERRNO PROCINFO RT",
""
"", "", "", "", "", "" ,""
};
@ -2961,7 +2961,7 @@ KEYWORDLIST KeyWords_Rust = {
// Keywords 7
"",
// 0
"" };
"", "" };
EDITLEXER lexRust = { SCLEX_RUST, IDS_LEX_RUST_SRC, L"Rust Source Code", L"rs; rust", L"", &KeyWords_Rust,{
@ -4454,9 +4454,9 @@ void Style_SetLexerFromFile(HWND hwnd,LPCWSTR lpszFile)
}
}
if (!bFound && Encoding_Current(CPI_GET) == g_DOSEncoding)
if (!bFound && Encoding_Current(CPI_GET) == g_DOSEncoding) {
pLexNew = &lexANSI;
}
// Apply the new lexer
Style_SetLexer(hwnd,pLexNew);
}

View File

@ -87,18 +87,19 @@ typedef WCHAR prefix_t[MICRO_BUFFER];
typedef enum {
STATUS_DOCLINE = 0, STATUS_DOCCOLUMN, STATUS_SELECTION, STATUS_SELCTBYTES, STATUS_SELCTLINES, STATUS_OCCURRENCE,
STATUS_DOCSIZE, STATUS_CODEPAGE, STATUS_EOLMODE, STATUS_OVRMODE, STATUS_2ND_DEF, STATUS_LEXER,
STATUS_DOCSIZE, STATUS_CODEPAGE, STATUS_EOLMODE, STATUS_OVRMODE, STATUS_2ND_DEF, STATUS_LEXER, STATUS_OCCREPLACE,
STATUS_SECTOR_COUNT,
STATUS_HELP = 255
} STATUS_SECTOR_T;
#define SBS_INIT_ZERO { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
#define SBS_INIT_MINUS { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
#define SBS_INIT_ORDER { 0, 1, 2, 3, 4, 5, 6, 7. 8. 9, 10, 11 }
#define SBS_INIT_ZERO { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
#define SBS_INIT_MINUS { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
#define SBS_INIT_ORDER { 0, 1, 2, 3, 4, 5, 6, 7. 8. 9, 10, 11, 12 }
#define STATUSBAR_EXTION_PREFIXES L"Ln ,Col ,Sel ,Sb ,SLn ,Occ ,,,,,,,"
#define STATUSBAR_DEFAULT_IDS L"0 1 2 4 5 6 7 8 9 10 11"
#define STATUSBAR_SECTION_WIDTH_SPECS L"30 20 20 20 20 20 0 0 0 0 0 0"
#define STATUSBAR_SECTION_PREFIXES L"Ln ,Col ,Sel ,Sb ,SLn ,Occ ,,,,,,,Repl ,"
#define STATUSBAR_SECTION_POSTFIXES L",,, [UTF-8],,, [UTF-8],,,,,,,"
#define STATUSBAR_DEFAULT_IDS L"0 1 2 4 5 6 7 8 9 10 11 12"
#define STATUSBAR_SECTION_WIDTH_SPECS L"30 20 20 20 20 20 0 0 0 0 0 0 0"
#define STAUSBAR_RIGHT_MARGIN 20
// --------------------------------------------------------------------------

View File

@ -52,16 +52,6 @@
#define IDS_WARN_PREF_LNG_NOT_AVAIL 4000
#define IDS_FR_STATUS_FMT 5000
#define IDS_STATUS_DOCLINE 5001
#define IDS_STATUS_DOCCOLUMN 5002
#define IDS_STATUS_DOCCOLUMN2 5003
#define IDS_STATUS_SELECTION 5004
#define IDS_STATUS_SELCTLINES 5015
#define IDS_STATUS_SELCTBYTES 5016
#define IDS_STATUS_OCCURRENCE 5017
#define IDS_STATUS_DOCSIZE 5018
#include "../language/common_res.h"