Merge remote-tracking branch 'notepad3_orig_rizone/master'

This commit is contained in:
Rainer Kottenhoff 2018-02-09 19:41:23 +01:00
commit 00cc8afcd0
4 changed files with 60 additions and 34 deletions

View File

@ -1671,32 +1671,33 @@ DWORD_PTR SHGetFileInfo2(LPCWSTR pszPath,DWORD dwFileAttributes,
//
int FormatNumberStr(LPWSTR lpNumberStr)
{
WCHAR *c;
WCHAR szSep[8];
int i = 0;
static WCHAR szSep[8] = { L'\0' };
const int iPlace = 3;
if (!lstrlen(lpNumberStr))
return(0);
if (!lstrlen(lpNumberStr)) { return 0; }
if (!GetLocaleInfo(LOCALE_USER_DEFAULT,
LOCALE_STHOUSAND,
szSep,
COUNTOF(szSep)))
szSep[0] = L'\'';
StrTrim(lpNumberStr, L" \t");
c = StrEnd(lpNumberStr);
if (lstrlen(lpNumberStr) > iPlace) {
while ((c = CharPrev(lpNumberStr,c)) != lpNumberStr)
{
if (++i == 3)
{
i = 0;
MoveMemory(c+1,c,sizeof(WCHAR)*(lstrlen(c)+1));
*c = szSep[0];
if (szSep[0] == L'\0') {
if (!GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STHOUSAND,
szSep, COUNTOF(szSep))) {
szSep[0] = L'\'';
}
}
WCHAR* ch = StrEnd(lpNumberStr);
int i = 0;
while ((ch = CharPrev(lpNumberStr, ch)) != lpNumberStr) {
if (((++i) % iPlace) == 0) {
MoveMemory(ch + 1, ch, sizeof(WCHAR)*(lstrlen(ch) + 1));
*ch = szSep[0];
}
}
}
return(lstrlen(lpNumberStr));
return lstrlen(lpNumberStr);
}

View File

@ -945,13 +945,7 @@ HWND InitInstance(HINSTANCE hInstance,LPSTR pszCmdLine,int nCmdShow)
//
LRESULT CALLBACK MainWndProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam)
{
if (!bDenyVirtualSpaceAccess)
{
if (GetAsyncKeyState(VK_MENU) & SHRT_MIN) // ALT-KEY DOWN
SendMessage(g_hwndEdit, SCI_SETVIRTUALSPACEOPTIONS, (WPARAM)(SCVS_RECTANGULARSELECTION | SCVS_NOWRAPLINESTART | SCVS_USERACCESSIBLE), 0);
else
SendMessage(g_hwndEdit, SCI_SETVIRTUALSPACEOPTIONS, (WPARAM)SCVS_RECTANGULARSELECTION, 0);
}
static BOOL bAltKeyIsDown = FALSE;
switch(umsg)
{
@ -970,6 +964,29 @@ LRESULT CALLBACK MainWndProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam)
case WM_WINDOWPOSCHANGED:
return DefWindowProc(hwnd,umsg,wParam,lParam);
case WM_SYSKEYDOWN:
if (GetAsyncKeyState(VK_MENU) & SHRT_MIN) // ALT-KEY DOWN
{
if (!bAltKeyIsDown) {
bAltKeyIsDown = TRUE;
if (!bDenyVirtualSpaceAccess) {
SciCall_SetVirtualSpaceOptions(SCVS_RECTANGULARSELECTION | SCVS_NOWRAPLINESTART | SCVS_USERACCESSIBLE);
}
}
}
return DefWindowProc(hwnd, umsg, wParam, lParam);
case WM_SYSKEYUP:
if (!(GetAsyncKeyState(VK_MENU) & SHRT_MIN)) // NOT ALT-KEY DOWN
{
if (bAltKeyIsDown) {
bAltKeyIsDown = FALSE;
SciCall_SetVirtualSpaceOptions(bDenyVirtualSpaceAccess ? SCVS_NONE : SCVS_RECTANGULARSELECTION);
}
}
return DefWindowProc(hwnd, umsg, wParam, lParam);
case WM_CREATE:
return MsgCreate(hwnd,wParam,lParam);
@ -6972,6 +6989,8 @@ void UpdateStatusbar()
static WCHAR tch2ndDef[32] = { L'\0' };
static WCHAR tchLexerName[128] = { L'\0' };
static WCHAR tchLinesSelected[32] = { L'\0' };
static WCHAR tchTmp[32] = { L'\0' };
if (!bShowStatusbar) { return; }
@ -7005,7 +7024,6 @@ void UpdateStatusbar()
const int iSel = (int)SendMessage(g_hwndEdit, SCI_COUNTCHARACTERS, iSelStart, iSelEnd);
StringCchPrintf(tchSel, COUNTOF(tchSel), L"%i", iSel);
FormatNumberStr(tchSel);
StrFormatByteSize((iSelEnd - iSelStart), tchSelB, COUNTOF(tchSelB));
}
else {
@ -7018,15 +7036,17 @@ 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(tchTmp, COUNTOF(tchTmp), L"%i", iMarkOccurrencesCount);
FormatNumberStr(tchTmp);
StringCchPrintf(tchOcc, COUNTOF(tchOcc), L">= %s", tchTmp);
}
}
else {
StringCchCopy(tchOcc, COUNTOF(tchOcc), L"-- ");
StringCchCopy(tchOcc, COUNTOF(tchOcc), L"--");
}
// Print number of selected lines in statusbar

View File

@ -136,7 +136,7 @@ DeclareSciCallR1(DocLineFromVisible, DOCLINEFROMVISIBLE, DocLn, DocLn, line);
DeclareSciCallR2(GetRangePointer, GETRANGEPOINTER, LPCCH, DocPos, start, DocPos, length);
DeclareSciCallR0(GetCharacterPointer, GETCHARACTERPOINTER, LPCCH);
DeclareSciCallV1(SetVirtualSpaceOptions, SETVIRTUALSPACEOPTIONS, int, options);
//=============================================================================
//

View File

@ -2878,7 +2878,7 @@ static PEDITLEXER g_pLexArray[NUMLEXERS] =
// Currently used lexer
static int g_iDefaultLexer = 0;
static PEDITLEXER g_pLexCurrent = &lexStandard; // g_pLexArray[g_iDefaultLexer];
static PEDITLEXER g_pLexCurrent = &lexStandard;
static BOOL g_fStylesModified = FALSE;
static BOOL g_fWarnedNoIniFile = FALSE;
@ -2920,6 +2920,11 @@ BOOL __fastcall IsStyleSchemeDefault(PEDITSTYLE pStyle)
return (pStyle->rid == 63126);
}
PEDITLEXER __fastcall GetDefaultLexer()
{
return g_pLexArray[g_iDefaultLexer];
}
//=============================================================================
//
@ -3185,7 +3190,7 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew) {
// Select standard if NULL is specified
if (!pLexNew) {
pLexNew = GetCurrentStdLexer();
pLexNew = GetDefaultLexer(); //GetCurrentStdLexer();
}
else if (IsLexerStandard(pLexNew)) {
pLexNew = Style_GetUse2ndDefault() ? &lexStandard2nd : &lexStandard;