diff --git a/Build/Notepad3.ini b/Build/Notepad3.ini index 02e7aca12..7a5a52640 100644 Binary files a/Build/Notepad3.ini and b/Build/Notepad3.ini differ diff --git a/src/Helpers.c b/src/Helpers.c index 9d16c8257..75b3c17bd 100644 --- a/src/Helpers.c +++ b/src/Helpers.c @@ -1007,7 +1007,7 @@ LONG StatusCalcPaneWidth(HWND hwnd,LPCWSTR lpsz) SelectObject(hdc,hfold); ReleaseDC(hwnd,hdc); - return (size.cx + 12L); + return (size.cx + 8L); } @@ -2887,8 +2887,8 @@ int ReadVectorFromString(LPCWSTR wchStrg, int* iVector, int iCount, int iMin, in while (*p) { int iValue; if (swscanf_s(p, L"%i", &iValue) == 1) { - if ((n < iCount) && (iValue >= iMin) && (iValue <= iMax)) { - iVector[n++] = iValue; + if (n < iCount) { + iVector[n++] = min(max(iValue, iMin), iMax); } } p = StrEnd(p) + 1; diff --git a/src/Notepad3.c b/src/Notepad3.c index f7fdb631f..05f02ab2c 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -742,29 +742,31 @@ static int g_aSBSOrder[STATUS_SECTOR_COUNT]; // _StatusbarSetSections() // // -static void __fastcall _StatusbarSetSections(int cx) +static void __fastcall _StatusbarSetSections(int width) { - static int lastCX = -1; - if (!bShowStatusbar || (cx == lastCX)) { return; } // static calculation + static int lastWinWidth = -1; + width -= STAUSBAR_RIGHT_MARGIN; + + if (!bShowStatusbar || (width < 0) || (width == lastWinWidth)) { return; } // static calculation // prepare sector array for (int i = 0; i < STATUS_SECTOR_COUNT; ++i) { g_vStatusbarSectionWidth[i] = -1; - g_aSBSOrder[i] = -1; + g_aSBSOrder[i] = i; } int vSections[STATUS_SECTOR_COUNT]; ReadVectorFromString(g_tchStatusbarSections, vSections, STATUS_SECTOR_COUNT, 0, (STATUS_SECTOR_COUNT - 1), -1); int vWeights[STATUS_SECTOR_COUNT]; - ReadVectorFromString(g_tchStatusbarRelWidths, vWeights, STATUS_SECTOR_COUNT, 0, (STATUS_SECTOR_COUNT - 1), 1); + ReadVectorFromString(g_tchStatusbarRelWidths, vWeights, STATUS_SECTOR_COUNT, 0, 4096, 1); int cnt = 0; int totalWeight = 0; for (int i = 0; i < STATUS_SECTOR_COUNT; ++i) { int const iID = vSections[i]; if (iID != -1) { - g_vStatusbarSectionWidth[iID] = (cx * vWeights[iID]); + g_vStatusbarSectionWidth[iID] = (width * vWeights[iID]); totalWeight += vWeights[iID]; g_aSBSOrder[cnt++] = iID; } @@ -777,7 +779,7 @@ static void __fastcall _StatusbarSetSections(int cx) } } } - lastCX = cx; + lastWinWidth = width; } diff --git a/src/TypeDefs.h b/src/TypeDefs.h index 43d36b986..217d99112 100644 --- a/src/TypeDefs.h +++ b/src/TypeDefs.h @@ -91,8 +91,9 @@ typedef enum { } STATUS_SECTOR_T; #define STATUSBAR_DEFAULT_IDS L"0 1 2 3 4 5 6 7 8 9 10" -#define STATUSBAR_SECTION_WIDTH L"2 2 3 2 2 2 2 1 1 1 3" +#define STATUSBAR_SECTION_WIDTH L"20 20 28 20 20 20 20 7 7 7 36" #define STATUSBAR_EXTION_PREFIXES L"Ln ,Col ,Sel ,SelLn ,Occ ,,,,,,,," +#define STAUSBAR_RIGHT_MARGIN 20 // --------------------------------------------------------------------------