Merge pull request #1169 from RaiKoHoff/Dev_RC

Reflect inconsistent line-breaks in status bar
This commit is contained in:
Rainer Kottenhoff 2019-05-04 09:50:07 +02:00 committed by GitHub
commit 07d20beedc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 37 additions and 17 deletions

View File

@ -1 +1 @@
1690
1691

View File

@ -3,7 +3,7 @@
<assemblyIdentity
name="Notepad3"
processorArchitecture="*"
version="5.19.503.1690"
version="5.19.504.1691"
type="win32"
/>
<description>Notepad3 RC</description>

View File

@ -2980,7 +2980,7 @@ static INT_PTR CALLBACK WarnLineEndingDlgProc(HWND hwnd, UINT umsg, WPARAM wPara
//=============================================================================
//
// SelectDefLineEndingDlg()
// WarnLineEndingDlg()
//
bool WarnLineEndingDlg(HWND hwnd, EditFileIOStatus* fioStatus)
{
@ -3086,7 +3086,7 @@ static INT_PTR CALLBACK WarnIndentationDlgProc(HWND hwnd, UINT umsg, WPARAM wPar
//=============================================================================
//
// SelectDefLineEndingDlg()
// WarnIndentationDlg()
//
bool WarnIndentationDlg(HWND hwnd, EditFileIOStatus* fioStatus)
{

View File

@ -4462,6 +4462,7 @@ void EditEnsureSelectionVisible(HWND hwnd)
//
void EditEnsureConsistentLineEndings(HWND hwnd)
{
Globals.bInconsistentLineBreaks = false;
SciCall_ConvertEOLs(SciCall_GetEOLMode());
EditFixPositions(hwnd);
}

View File

@ -485,6 +485,7 @@ static void _InitGlobals()
Globals.bFindReplCopySelOrClip = true;
Globals.bReplaceInitialized = false;
Globals.FindReplaceMatchFoundState = FND_NOP;
Globals.bInconsistentLineBreaks = false;
Flags.bDevDebugMode = DefaultFlags.bDevDebugMode = false;
Flags.bStickyWindowPosition = DefaultFlags.bStickyWindowPosition = false;
@ -3592,7 +3593,7 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
EditEnsureConsistentLineEndings(Globals.hwndEdit);
_OBSERVE_NOTIFY_CHANGE_;
EndWaitCursor();
UpdateStatusbar(false);
UpdateStatusbar(true);
}
break;
@ -9015,6 +9016,13 @@ static void _UpdateStatusbarDelayed(bool bForceRedraw)
}
// ------------------------------------------------------
const WCHAR* const _LF_f = L"%sLF%s";
const WCHAR* const _LFi_f = L"%sLF*%s";
const WCHAR* const _CR_f = L"%sCR%s";
const WCHAR* const _CRi_f = L"%sCR*%s";
const WCHAR* const _CRLF_f = L"%sCR+LF%s";
const WCHAR* const _CRLFi_f = L"%sCR+LF*%s";
if (s_iStatusbarVisible[STATUS_EOLMODE])
{
static int s_iEOLMode = -1;
@ -9022,17 +9030,20 @@ static void _UpdateStatusbarDelayed(bool bForceRedraw)
if (bForceRedraw || (s_iEOLMode != _eol_mode))
{
if (_eol_mode == SC_EOL_LF) {
StringCchPrintf(tchStatusBar[STATUS_EOLMODE], txtWidth, L"%sLF%s",
s_mxSBPrefix[STATUS_EOLMODE], s_mxSBPostfix[STATUS_EOLMODE]);
static WCHAR tchEOL[16] = { L'\0' };
if (_eol_mode == SC_EOL_LF)
{
StringCchPrintf(tchStatusBar[STATUS_EOLMODE], txtWidth, (Globals.bInconsistentLineBreaks ? _LFi_f : _LF_f),
s_mxSBPrefix[STATUS_EOLMODE], s_mxSBPostfix[STATUS_EOLMODE]);
}
else if (_eol_mode == SC_EOL_CR) {
StringCchPrintf(tchStatusBar[STATUS_EOLMODE], txtWidth, L"%sCR%s",
s_mxSBPrefix[STATUS_EOLMODE], s_mxSBPostfix[STATUS_EOLMODE]);
else if (_eol_mode == SC_EOL_CR)
{
StringCchPrintf(tchStatusBar[STATUS_EOLMODE], txtWidth, (Globals.bInconsistentLineBreaks ? _CRi_f : _CR_f),
s_mxSBPrefix[STATUS_EOLMODE], s_mxSBPostfix[STATUS_EOLMODE]);
}
else {
StringCchPrintf(tchStatusBar[STATUS_EOLMODE], txtWidth, L"%sCR+LF%s",
s_mxSBPrefix[STATUS_EOLMODE], s_mxSBPostfix[STATUS_EOLMODE]);
StringCchPrintf(tchStatusBar[STATUS_EOLMODE], txtWidth, (Globals.bInconsistentLineBreaks ? _CRLFi_f : _CRLF_f),
s_mxSBPrefix[STATUS_EOLMODE], s_mxSBPostfix[STATUS_EOLMODE]);
}
s_iEOLMode = _eol_mode;
bIsUpdateNeeded = true;
@ -9789,11 +9800,16 @@ bool FileLoad(bool bDontSave, bool bNew, bool bReload,
}
// Show inconsistent line endings warning
if (fioStatus.bInconsistentEOLs && Settings.WarnInconsistEOLs && !s_flagPrintFileAndLeave)
Globals.bInconsistentLineBreaks = fioStatus.bInconsistentEOLs;
_UpdateStatusbarDelayed(true);
if (Globals.bInconsistentLineBreaks && Settings.WarnInconsistEOLs && !s_flagPrintFileAndLeave)
{
if (WarnLineEndingDlg(Globals.hwndMain, &fioStatus)) {
SciCall_ConvertEOLs(fioStatus.iEOLMode);
Globals.bInconsistentLineBreaks = false;
}
_UpdateStatusbarDelayed(true);
}
// Show inconsistent indentation
@ -9805,7 +9821,6 @@ bool FileLoad(bool bDontSave, bool bNew, bool bReload,
EditIndentationStatistic(Globals.hwndEdit, &fioStatus);
ConsistentIndentationCheck(&fioStatus);
}
if (Settings.AutoDetectIndentSettings && !s_flagPrintFileAndLeave)
{
if (!Settings.WarnInconsistentIndents || (fioStatus.iGlobalIndent != I_MIX_LN))
@ -9820,6 +9835,9 @@ bool FileLoad(bool bDontSave, bool bNew, bool bReload,
else if (!(fioStatus.bFileTooBig || fioStatus.bUnknownExt)) {
InfoBoxLng(MB_ICONWARNING, NULL, IDS_MUI_ERR_LOADFILE, szFileName);
}
UpdateAllBars(true);
return(fSuccess);
}

View File

@ -307,6 +307,7 @@ typedef struct _globals_t
bool bIniFileFromScratch;
bool bFindReplCopySelOrClip;
bool bReplaceInitialized;
bool bInconsistentLineBreaks;
FR_STATES FindReplaceMatchFoundState;

View File

@ -7,8 +7,8 @@
#define SAPPNAME "Notepad3"
#define VERSION_MAJOR 5
#define VERSION_MINOR 19
#define VERSION_REV 503
#define VERSION_BUILD 1690
#define VERSION_REV 504
#define VERSION_BUILD 1691
#define SCINTILLA_VER 415
#define ONIGMO_REGEX_VER 6.2.0
#define VERSION_PATCH RC