diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b25947b5ce..e55cf321e3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,7 +11,7 @@ jobs: name: Visual C++ 2019 runs-on: windows-2019 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Update Version Hash run: | @@ -75,7 +75,7 @@ jobs: name: Visual C++ 2022 runs-on: windows-2022 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Update Version Hash run: | @@ -155,7 +155,7 @@ jobs: name: LLVM (Visual C++ 2019) runs-on: windows-2019 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Update Version Hash run: | @@ -209,7 +209,7 @@ jobs: name: LLVM (Visual C++ 2022) runs-on: windows-2022 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Update Version Hash run: | @@ -279,7 +279,7 @@ jobs: name: llvm-mingw runs-on: windows-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Update Version Hash run: | @@ -343,7 +343,7 @@ jobs: name: ucrt GCC and Clang runs-on: windows-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Update Version Hash run: | @@ -397,7 +397,7 @@ jobs: name: 64-bit GCC and Clang runs-on: windows-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Update Version Hash run: | @@ -451,7 +451,7 @@ jobs: name: 32-bit GCC and Clang runs-on: windows-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Update Version Hash run: | diff --git a/build/install_llvm.bat b/build/install_llvm.bat index 9e70084c51..3dbf7e6a5a 100644 --- a/build/install_llvm.bat +++ b/build/install_llvm.bat @@ -1,8 +1,8 @@ @ECHO OFF @rem used for AppVeyor and GitHub Actions -curl -fsSL -o "LLVM-17.0.2-win64.exe" "https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.2/LLVM-17.0.2-win64.exe" -"LLVM-17.0.2-win64.exe" /S +curl -fsSL -o "LLVM-17.0.5-win64.exe" "https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.5/LLVM-17.0.5-win64.exe" +"LLVM-17.0.5-win64.exe" /S IF /I "%~1" == "latest" ( git clone -q --depth=1 --branch=main https://github.com/zufuliu/llvm-utils.git diff --git a/build/install_mingw.bat b/build/install_mingw.bat index 8b8a7eba92..10c665fba3 100644 --- a/build/install_mingw.bat +++ b/build/install_mingw.bat @@ -25,7 +25,7 @@ IF /I "%~1" == "i686" ( IF /I "%~1" == "llvm" ( SHIFT @rem for CI purpose only, the result binary is dynamic linked against api-ms-win-crt*.dll instead of msvcrt.dll - curl -fsSL -o "llvm-mingw-20231003-ucrt-x86_64.zip" "https://github.com/mstorsjo/llvm-mingw/releases/download/20231003/llvm-mingw-20231003-ucrt-x86_64.zip" - 7z x -y -o"C:\" "llvm-mingw-20231003-ucrt-x86_64.zip" >NUL - move /Y "C:\llvm-mingw-20231003-ucrt-x86_64" "C:\llvm-mingw" + curl -fsSL -o "llvm-mingw-20231114-ucrt-x86_64.zip" "https://github.com/mstorsjo/llvm-mingw/releases/download/20231114/llvm-mingw-20231114-ucrt-x86_64.zip" + 7z x -y -o"C:\" "llvm-mingw-20231114-ucrt-x86_64.zip" >NUL + move /Y "C:\llvm-mingw-20231114-ucrt-x86_64" "C:\llvm-mingw" ) diff --git a/metapath/res/metapath.exe.manifest b/metapath/res/metapath.exe.manifest index a253135bc6..7dcb1d5c26 100644 --- a/metapath/res/metapath.exe.manifest +++ b/metapath/res/metapath.exe.manifest @@ -1,6 +1,6 @@ - + metapath File Browser diff --git a/metapath/src/Dialogs.c b/metapath/src/Dialogs.c index 5c2d02ce7a..a43d9a63c0 100644 --- a/metapath/src/Dialogs.c +++ b/metapath/src/Dialogs.c @@ -363,12 +363,13 @@ INT_PTR CALLBACK GotoDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam) ComboBox_SetExtendedUI(hwndGoto, TRUE); for (int i = 0; i < HISTORY_ITEMS; i++) { - if (mHistory.psz[i]) { - const int iItem = ComboBox_FindStringExact(hwndGoto, -1, mHistory.psz[i]); + LPCWSTR path = mHistory.psz[i]; + if (path) { + const int iItem = ComboBox_FindStringExact(hwndGoto, -1, path); if (iItem != CB_ERR) { ComboBox_DeleteString(hwndGoto, iItem); } - ComboBox_InsertString(hwndGoto, 0, mHistory.psz[i]); + ComboBox_InsertString(hwndGoto, 0, path); } } @@ -1541,6 +1542,7 @@ bool GetFilterDlg(HWND hwnd) { typedef struct FILEOPDLGDATA { WCHAR szSource[MAX_PATH]; WCHAR szDestination[MAX_PATH]; + LPMRULIST pmru; UINT wFunc; } FILEOPDLGDATA, *LPFILEOPDLGDATA; @@ -1693,7 +1695,7 @@ INT_PTR CALLBACK CopyMoveDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lPa SetDlgItemText(hwnd, IDC_SOURCE, lpfod->szSource); HWND hwndDest = GetDlgItem(hwnd, IDC_DESTINATION); - MRU_LoadToCombobox(hwndDest, MRU_KEY_COPY_MOVE_HISTORY); + MRU_AddToCombobox(lpfod->pmru, hwndDest); ComboBox_SetCurSel(hwndDest, 0); ComboBox_LimitText(hwndDest, MAX_PATH - 1); ComboBox_SetExtendedUI(hwndDest, TRUE); @@ -1742,10 +1744,12 @@ INT_PTR CALLBACK CopyMoveDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lPa case WM_NOTIFY: { LPNMHDR pnmhdr = (LPNMHDR)lParam; if (pnmhdr->idFrom == IDC_EMPTY_MRU && (pnmhdr->code == NM_CLICK || pnmhdr->code == NM_RETURN)) { + const LPCFILEOPDLGDATA lpfod = (LPCFILEOPDLGDATA)lParam; WCHAR tch[MAX_PATH]; HWND hwndDest = GetDlgItem(hwnd, IDC_DESTINATION); ComboBox_GetText(hwndDest, tch, COUNTOF(tch)); - MRU_ClearCombobox(hwndDest, MRU_KEY_COPY_MOVE_HISTORY); + ComboBox_ResetContent(hwnd); + MRU_Empty(lpfod->pmru, true); ComboBox_SetText(hwndDest, tch); } } @@ -1807,10 +1811,12 @@ bool CopyMoveDlg(HWND hwnd, UINT *wFunc) { } FILEOPDLGDATA fod; + fod.pmru = MRU_Create(MRU_KEY_COPY_MOVE_HISTORY, MRUFlags_FilePath); fod.wFunc = *wFunc; lstrcpy(fod.szSource, PathFindFileName(dli.szFileName)); - if (IDOK == ThemedDialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_COPYMOVE), hwnd, CopyMoveDlgProc, (LPARAM)&fod)) { + const INT_PTR result = ThemedDialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_COPYMOVE), hwnd, CopyMoveDlgProc, (LPARAM)&fod); + if (IDOK == result) { WCHAR tchSource[MAX_PATH + 4]; WCHAR tchDestination[MAX_PATH + 4]; @@ -1826,7 +1832,8 @@ bool CopyMoveDlg(HWND hwnd, UINT *wFunc) { } // Save item - MRU_AddOneItem(MRU_KEY_COPY_MOVE_HISTORY, fod.szDestination); + MRU_Add(fod.pmru, fod.szDestination); + MRU_Save(fod.pmru); ExpandEnvironmentStringsEx(fod.szDestination, COUNTOF(fod.szDestination)); // Double null terminated strings are essential!!! @@ -1860,9 +1867,10 @@ bool CopyMoveDlg(HWND hwnd, UINT *wFunc) { } *wFunc = fod.wFunc; // save state for next call - return true; } - return false; + + MRU_Destroy(fod.pmru); + return result == IDOK; } extern WCHAR tchOpenWithDir[MAX_PATH]; diff --git a/metapath/src/Helpers.c b/metapath/src/Helpers.c index e44fd449a3..49ffb39aa0 100644 --- a/metapath/src/Helpers.c +++ b/metapath/src/Helpers.c @@ -1761,8 +1761,8 @@ void History_Uninit(PHISTORY ph) { for (int i = 0; i < HISTORY_ITEMS; i++) { if (ph->psz[i]) { LocalFree(ph->psz[i]); + ph->psz[i] = NULL; } - ph->psz[i] = NULL; } } @@ -1779,8 +1779,8 @@ bool History_Add(PHISTORY ph, LPCWSTR pszNew) { for (int i = ph->iCurItem; i < HISTORY_ITEMS; i++) { if (ph->psz[i]) { LocalFree(ph->psz[i]); + ph->psz[i] = NULL; } - ph->psz[i] = NULL; } } else { // Shift @@ -1858,19 +1858,17 @@ void History_UpdateToolbar(LCPHISTORY ph, HWND hwnd, int cmdBack, int cmdForward // // MRU functions // -LPMRULIST MRU_Create(LPCWSTR pszRegKey, int iFlags, int iSize) { +LPMRULIST MRU_Create(LPCWSTR pszRegKey, int iFlags) { LPMRULIST pmru = (LPMRULIST)NP2HeapAlloc(sizeof(MRULIST)); - pmru->szRegKey = pszRegKey; pmru->iFlags = iFlags; - pmru->iSize = min_i(iSize, MRU_MAXITEMS); + pmru->szRegKey = pszRegKey; + MRU_Load(pmru); return pmru; } void MRU_Destroy(LPMRULIST pmru) { for (int i = 0; i < pmru->iSize; i++) { - if (pmru->pszItems[i]) { - LocalFree(pmru->pszItems[i]); - } + LocalFree(pmru->pszItems[i]); } memset(pmru, 0, sizeof(MRULIST)); @@ -1885,69 +1883,62 @@ static inline bool MRU_Equal(int flags, LPCWSTR psz1, LPCWSTR psz2) { #endif } -bool MRU_Add(LPMRULIST pmru, LPCWSTR pszNew) { +void MRU_Add(LPMRULIST pmru, LPCWSTR pszNew) { const int flags = pmru->iFlags; + LPWSTR tchItem = NULL; int i; - for (i = 0; i < pmru->iSize; i++) { + for (i = 0; i < MRU_MAXITEMS; i++) { WCHAR * const item = pmru->pszItems[i]; if (item == NULL) { break; } if (MRU_Equal(flags, item, pszNew)) { - LocalFree(item); + tchItem = item; break; } } - i = min_i(i, pmru->iSize - 1); + if (i == MRU_MAXITEMS) { + --i; + LocalFree(pmru->pszItems[i]); + } else if (i == pmru->iSize) { + pmru->iSize += 1; + } for (; i > 0; i--) { pmru->pszItems[i] = pmru->pszItems[i - 1]; } - pmru->pszItems[0] = StrDup(pszNew); - return true; + if (tchItem == NULL) { + tchItem = StrDup(pszNew); + } + pmru->pszItems[0] = tchItem; } -bool MRU_Delete(LPMRULIST pmru, int iIndex) { +void MRU_Delete(LPMRULIST pmru, int iIndex) { if (iIndex < 0 || iIndex >= pmru->iSize) { - return false; - } - if (pmru->pszItems[iIndex]) { - LocalFree(pmru->pszItems[iIndex]); + return; } - for (int i = iIndex; i < pmru->iSize - 1; i++) { + LocalFree(pmru->pszItems[iIndex]); + pmru->pszItems[iIndex] = NULL; + pmru->iSize -= 1; + for (int i = iIndex; i < pmru->iSize; i++) { pmru->pszItems[i] = pmru->pszItems[i + 1]; pmru->pszItems[i + 1] = NULL; } - return true; } -void MRU_Empty(LPMRULIST pmru) { +void MRU_Empty(LPMRULIST pmru, bool save) { for (int i = 0; i < pmru->iSize; i++) { - if (pmru->pszItems[i]) { - LocalFree(pmru->pszItems[i]); - pmru->pszItems[i] = NULL; - } - } -} - -int MRU_Enum(LPCMRULIST pmru, int iIndex, LPWSTR pszItem, int cchItem) { - if (pszItem == NULL || cchItem == 0) { - int i = 0; - while (i < pmru->iSize && pmru->pszItems[i]) { - i++; - } - return i; + LocalFree(pmru->pszItems[i]); + pmru->pszItems[i] = NULL; } - - if (iIndex < 0 || iIndex >= pmru->iSize || pmru->pszItems[iIndex] == NULL) { - return -1; + pmru->iSize = 0; + if (save) { + MRU_Save(pmru); } - lstrcpyn(pszItem, pmru->pszItems[iIndex], cchItem); - return TRUE; } -bool MRU_Load(LPMRULIST pmru) { +void MRU_Load(LPMRULIST pmru) { if (StrIsEmpty(szIniFile)) { - return true; + return; } IniSection section; @@ -1955,15 +1946,15 @@ bool MRU_Load(LPMRULIST pmru) { const int cchIniSection = (int)(NP2HeapSize(pIniSectionBuf) / sizeof(WCHAR)); IniSection * const pIniSection = §ion; - MRU_Empty(pmru); + //MRU_Empty(pmru, false); IniSectionInit(pIniSection, MRU_MAXITEMS); LoadIniSection(pmru->szRegKey, pIniSectionBuf, cchIniSection); IniSectionParseArray(pIniSection, pIniSectionBuf); const UINT count = pIniSection->count; - const UINT size = pmru->iSize; + UINT n = 0; - for (UINT i = 0, n = 0; i < count && n < size; i++) { + for (UINT i = 0; i < count; i++) { const IniKeyValueNode *node = &pIniSection->nodeList[i]; LPCWSTR tchItem = node->value; if (StrNotEmpty(tchItem)) { @@ -1971,18 +1962,18 @@ bool MRU_Load(LPMRULIST pmru) { } } + pmru->iSize = n; IniSectionFree(pIniSection); NP2HeapFree(pIniSectionBuf); - return true; } -bool MRU_Save(LPCMRULIST pmru) { +void MRU_Save(LPCMRULIST pmru) { if (StrIsEmpty(szIniFile)) { - return true; + return; } - if (MRU_GetCount(pmru) == 0) { + if (pmru->iSize <= 0) { IniClearSection(pmru->szRegKey); - return true; + return; } WCHAR tchName[16]; @@ -1991,47 +1982,24 @@ bool MRU_Save(LPCMRULIST pmru) { IniSectionOnSave * const pIniSection = §ion; for (int i = 0; i < pmru->iSize; i++) { - if (StrNotEmpty(pmru->pszItems[i])) { + LPCWSTR tchItem = pmru->pszItems[i]; + if (StrNotEmpty(tchItem)) { wsprintf(tchName, L"%02i", i + 1); - IniSectionSetString(pIniSection, tchName, pmru->pszItems[i]); + IniSectionSetString(pIniSection, tchName, tchItem); } } SaveIniSection(pmru->szRegKey, pIniSectionBuf); NP2HeapFree(pIniSectionBuf); - return true; } -void MRU_LoadToCombobox(HWND hwnd, LPCWSTR pszKey) { - WCHAR tch[MAX_PATH]; - LPMRULIST pmru = MRU_Create(pszKey, MRUFlags_FilePath, MRU_MAX_COPY_MOVE_HISTORY); - MRU_Load(pmru); - for (int i = 0; i < MRU_GetCount(pmru); i++) { - MRU_Enum(pmru, i, tch, COUNTOF(tch)); - ComboBox_AddString(hwnd, tch); - } - MRU_Destroy(pmru); -} - -void MRU_AddOneItem(LPCWSTR pszKey, LPCWSTR pszNewItem) { - if (StrNotEmpty(pszNewItem)) { - LPMRULIST pmru = MRU_Create(pszKey, MRUFlags_FilePath, MRU_MAX_COPY_MOVE_HISTORY); - MRU_Load(pmru); - MRU_Add(pmru, pszNewItem); - MRU_Save(pmru); - MRU_Destroy(pmru); +void MRU_AddToCombobox(LPCMRULIST pmru, HWND hwnd) { + for (int i = 0; i < pmru->iSize; i++) { + LPCWSTR path = pmru->pszItems[i]; + ComboBox_AddString(hwnd, path); } } -void MRU_ClearCombobox(HWND hwnd, LPCWSTR pszKey) { - LPMRULIST pmru = MRU_Create(pszKey, MRUFlags_FilePath, MRU_MAX_COPY_MOVE_HISTORY); - MRU_Load(pmru); - MRU_Empty(pmru); - MRU_Save(pmru); - MRU_Destroy(pmru); - ComboBox_ResetContent(hwnd); -} - /* Themed Dialogs Modify dialog templates to use current theme font diff --git a/metapath/src/Helpers.h b/metapath/src/Helpers.h index 8a755e3949..302b9e713c 100644 --- a/metapath/src/Helpers.h +++ b/metapath/src/Helpers.h @@ -573,8 +573,8 @@ bool ExecDDECommand(LPCWSTR lpszCmdLine, LPCWSTR lpszDDEMsg, LPCWSTR lpszDDEApp, #define HISTORY_ITEMS 50 typedef struct HISTORY { - WCHAR *psz[HISTORY_ITEMS]; // Strings int iCurItem; // Current Item + WCHAR *psz[HISTORY_ITEMS]; // Strings } HISTORY, *PHISTORY, *LPHISTORY; typedef const HISTORY *LCPHISTORY; @@ -596,33 +596,26 @@ enum { MRUFlags_FilePath = 1, }; -#define MRU_MAX_COPY_MOVE_HISTORY 24 // MRU_MAXITEMS * (MAX_PATH + 4) #define MAX_INI_SECTION_SIZE_MRU (8 * 1024) typedef struct MRULIST { - LPCWSTR szRegKey; - int iFlags; int iSize; + int iFlags; + LPCWSTR szRegKey; LPWSTR pszItems[MRU_MAXITEMS]; } MRULIST, *PMRULIST, *LPMRULIST; typedef const MRULIST *LPCMRULIST; -LPMRULIST MRU_Create(LPCWSTR pszRegKey, int iFlags, int iSize); +LPMRULIST MRU_Create(LPCWSTR pszRegKey, int iFlags); void MRU_Destroy(LPMRULIST pmru); -bool MRU_Add(LPMRULIST pmru, LPCWSTR pszNew); -bool MRU_Delete(LPMRULIST pmru, int iIndex); -void MRU_Empty(LPMRULIST pmru); -int MRU_Enum(LPCMRULIST pmru, int iIndex, LPWSTR pszItem, int cchItem); -NP2_inline int MRU_GetCount(LPCMRULIST pmru) { - return MRU_Enum(pmru, 0, NULL, 0); -} -bool MRU_Load(LPMRULIST pmru); -bool MRU_Save(LPCMRULIST pmru); -void MRU_LoadToCombobox(HWND hwnd, LPCWSTR pszKey); -void MRU_AddOneItem(LPCWSTR pszKey, LPCWSTR pszNewItem); -void MRU_ClearCombobox(HWND hwnd, LPCWSTR pszKey); +void MRU_Add(LPMRULIST pmru, LPCWSTR pszNew); +void MRU_Delete(LPMRULIST pmru, int iIndex); +void MRU_Empty(LPMRULIST pmru, bool save); +void MRU_Load(LPMRULIST pmru); +void MRU_Save(LPCMRULIST pmru); +void MRU_AddToCombobox(LPCMRULIST pmru, HWND hwnd); //==== Themed Dialogs ========================================================= #ifndef DLGTEMPLATEEX diff --git a/metapath/src/VersionRev.h b/metapath/src/VersionRev.h index 648cff9886..d66bd52dff 100644 --- a/metapath/src/VersionRev.h +++ b/metapath/src/VersionRev.h @@ -1,6 +1,6 @@ #define VERSION_MINOR 23 -#define VERSION_BUILD_NUM 8 -#define VERSION_BUILD 08 -#define VERSION_HASH TEXT("2235065e") -#define VERSION_REV 4962 -#define VERSION_REV_FULL TEXT("r4962 (2235065e)") +#define VERSION_BUILD_NUM 11 +#define VERSION_BUILD 11 +#define VERSION_HASH TEXT("3084629c") +#define VERSION_REV 5052 +#define VERSION_REV_FULL TEXT("r5052 (3084629c)") diff --git a/metapath/src/metapath.c b/metapath/src/metapath.c index ce4bfb0680..5478f96465 100644 --- a/metapath/src/metapath.c +++ b/metapath/src/metapath.c @@ -2256,7 +2256,7 @@ LRESULT MsgNotify(HWND hwnd, WPARAM wParam, LPARAM lParam) { case TBN_GETBUTTONINFO: { LPTBNOTIFY lpTbNotify = (LPTBNOTIFY)lParam; if (lpTbNotify->iItem < (int)COUNTOF(tbbMainWnd)) { - WCHAR tch[256]; + WCHAR tch[128]; GetString(tbbMainWnd[lpTbNotify->iItem].idCommand, tch, COUNTOF(tch)); lstrcpyn(lpTbNotify->pszText, tch, lpTbNotify->cchText); memcpy(&lpTbNotify->tbButton, &tbbMainWnd[lpTbNotify->iItem], sizeof(TBBUTTON)); @@ -2278,7 +2278,7 @@ LRESULT MsgNotify(HWND hwnd, WPARAM wParam, LPARAM lParam) { if (pTTT->uFlags & TTF_IDISHWND) { PathCompactPathEx(pTTT->szText, szCurDir, COUNTOF(pTTT->szText), 0); } else { - WCHAR tch[256]; + WCHAR tch[128]; GetString((UINT)pnmh->idFrom, tch, COUNTOF(tch)); lstrcpyn(pTTT->szText, tch, COUNTOF(pTTT->szText)); } @@ -2394,8 +2394,7 @@ bool ChangeDirectory(HWND hwnd, LPCWSTR lpszNewDir, bool bUpdateHistory) { return true; } -static void GetWindowPositionSectionName(WCHAR sectionName[96]) { - HMONITOR hMonitor = MonitorFromWindow(hwndMain, MONITOR_DEFAULTTONEAREST); +static void GetWindowPositionSectionName(HMONITOR hMonitor, WCHAR sectionName[96]) { MONITORINFO mi; mi.cbSize = sizeof(mi); GetMonitorInfo(hMonitor, &mi); @@ -2509,35 +2508,9 @@ void LoadSettings(void) { IniSectionParse(pIniSection, pIniSectionBuf); bSaveSettings = IniSectionGetBool(pIniSection, L"SaveSettings", true); - bSingleClick = IniSectionGetBool(pIniSection, L"SingleClick", true); - bOpenFileInSameWindow = IniSectionGetBool(pIniSection, L"OpenFileInSameWindow", false); - iDefaultOpenMenu = bOpenFileInSameWindow ? IDM_FILE_OPENSAME : IDM_FILE_OPENNEW; - iShiftOpenMenu = bOpenFileInSameWindow ? IDM_FILE_OPENNEW : IDM_FILE_OPENSAME; - - bTrackSelect = IniSectionGetBool(pIniSection, L"TrackSelect", true); - bFullRowSelect = IniSectionGetBool(pIniSection, L"FullRowSelect", false); - fUseRecycleBin = IniSectionGetBool(pIniSection, L"UseRecycleBin", true); - fNoConfirmDelete = IniSectionGetBool(pIniSection, L"NoConfirmDelete", false); - bClearReadOnly = IniSectionGetBool(pIniSection, L"ClearReadOnly", true); - bRenameOnCollision = IniSectionGetBool(pIniSection, L"RenameOnCollision", false); - bFocusEdit = IniSectionGetBool(pIniSection, L"FocusEdit", true); - bAlwaysOnTop = IniSectionGetBool(pIniSection, L"AlwaysOnTop", false); - bMinimizeToTray = IniSectionGetBool(pIniSection, L"MinimizeToTray", false); - bTransparentMode = IniSectionGetBool(pIniSection, L"TransparentMode", false); - bWindowLayoutRTL = IniSectionGetBool(pIniSection, L"WindowLayoutRTL", false); - - int iValue = IniSectionGetInt(pIniSection, L"EscFunction", EscFunction_None); - iEscFunction = (EscFunction)clamp_i(iValue, EscFunction_None, EscFunction_Exit); - - if (IsVistaAndAbove()) { - bUseXPFileDialog = IniSectionGetBool(pIniSection, L"UseXPFileDialog", false); - } else { - bUseXPFileDialog = true; - } - - iValue = IniSectionGetInt(pIniSection, L"StartupDirectory", StartupDirectory_MRU); + // TODO: sort loading order by item frequency to reduce IniSectionUnsafeGetValue() calls + int iValue = IniSectionGetInt(pIniSection, L"StartupDirectory", StartupDirectory_MRU); iStartupDir = (StartupDirectory)clamp_i(iValue, StartupDirectory_None, StartupDirectory_Favorite); - IniSectionGetString(pIniSection, L"MRUDirectory", L"", szMRUDirectory, COUNTOF(szMRUDirectory)); LPCWSTR strValue = IniSectionGetValue(pIniSection, L"OpenWithDir"); @@ -2580,8 +2553,37 @@ void LoadSettings(void) { } bHasQuickview = PathIsFile(szQuickview); - IniSectionGetString(pIniSection, L"QuikviewParams", L"", - szQuickviewParams, COUNTOF(szQuickviewParams)); + IniSectionGetString(pIniSection, L"QuikviewParams", L"", szQuickviewParams, COUNTOF(szQuickviewParams)); + + POINT pt; + pt.x = IniSectionGetInt(pIniSection, L"WindowPosX", 0); + pt.y = IniSectionGetInt(pIniSection, L"WindowPosY", 0); + + bSingleClick = IniSectionGetBool(pIniSection, L"SingleClick", true); + bOpenFileInSameWindow = IniSectionGetBool(pIniSection, L"OpenFileInSameWindow", false); + iDefaultOpenMenu = bOpenFileInSameWindow ? IDM_FILE_OPENSAME : IDM_FILE_OPENNEW; + iShiftOpenMenu = bOpenFileInSameWindow ? IDM_FILE_OPENNEW : IDM_FILE_OPENSAME; + + bTrackSelect = IniSectionGetBool(pIniSection, L"TrackSelect", true); + bFullRowSelect = IniSectionGetBool(pIniSection, L"FullRowSelect", false); + fUseRecycleBin = IniSectionGetBool(pIniSection, L"UseRecycleBin", true); + fNoConfirmDelete = IniSectionGetBool(pIniSection, L"NoConfirmDelete", false); + bClearReadOnly = IniSectionGetBool(pIniSection, L"ClearReadOnly", true); + bRenameOnCollision = IniSectionGetBool(pIniSection, L"RenameOnCollision", false); + bFocusEdit = IniSectionGetBool(pIniSection, L"FocusEdit", true); + bAlwaysOnTop = IniSectionGetBool(pIniSection, L"AlwaysOnTop", false); + bMinimizeToTray = IniSectionGetBool(pIniSection, L"MinimizeToTray", false); + bTransparentMode = IniSectionGetBool(pIniSection, L"TransparentMode", false); + bWindowLayoutRTL = IniSectionGetBool(pIniSection, L"WindowLayoutRTL", false); + + iValue = IniSectionGetInt(pIniSection, L"EscFunction", EscFunction_None); + iEscFunction = (EscFunction)clamp_i(iValue, EscFunction_None, EscFunction_Exit); + + if (IsVistaAndAbove()) { + bUseXPFileDialog = IniSectionGetBool(pIniSection, L"UseXPFileDialog", false); + } else { + bUseXPFileDialog = true; + } dwFillMask = IniSectionGetInt(pIniSection, L"FillMask", DL_ALLOBJECTS); if (dwFillMask & ~DL_ALLOBJECTS) { @@ -2651,7 +2653,8 @@ void LoadSettings(void) { // window position section { WCHAR sectionName[96]; - GetWindowPositionSectionName(sectionName); + HMONITOR hMonitor = MonitorFromPoint(pt, MONITOR_DEFAULTTONEAREST); + GetWindowPositionSectionName(hMonitor, sectionName); LoadIniSection(sectionName, pIniSectionBuf, cchIniSection); IniSectionParse(pIniSection, pIniSectionBuf); @@ -2754,10 +2757,27 @@ void SaveSettings(bool bSaveSettingsNow) { WCHAR wchTmp[MAX_PATH]; WCHAR *pIniSectionBuf = (WCHAR *)NP2HeapAlloc(sizeof(WCHAR) * MAX_INI_SECTION_SIZE_SETTINGS); + SaveWindowPosition(pIniSectionBuf); + memset(pIniSectionBuf, 0, 2*sizeof(WCHAR)); + IniSectionOnSave section = { pIniSectionBuf }; IniSectionOnSave * const pIniSection = §ion; IniSectionSetBoolEx(pIniSection, L"SaveSettings", bSaveSettings, true); + IniSectionSetIntEx(pIniSection, L"StartupDirectory", (int)iStartupDir, StartupDirectory_MRU); + if (iStartupDir == StartupDirectory_MRU) { + IniSectionSetString(pIniSection, L"MRUDirectory", szCurDir); + } + PathRelativeToApp(tchFavoritesDir, wchTmp, FILE_ATTRIBUTE_DIRECTORY, true, flagPortableMyDocs); + IniSectionSetString(pIniSection, L"Favorites", wchTmp); + PathRelativeToApp(szQuickview, wchTmp, FILE_ATTRIBUTE_DIRECTORY, true, flagPortableMyDocs); + IniSectionSetString(pIniSection, L"Quikview.exe", wchTmp); + IniSectionSetStringEx(pIniSection, L"QuikviewParams", szQuickviewParams, L""); + PathRelativeToApp(tchOpenWithDir, wchTmp, FILE_ATTRIBUTE_DIRECTORY, true, flagPortableMyDocs); + IniSectionSetString(pIniSection, L"OpenWithDir", wchTmp); + IniSectionSetInt(pIniSection, L"WindowPosX", wi.x); + IniSectionSetInt(pIniSection, L"WindowPosY", wi.y); + IniSectionSetBoolEx(pIniSection, L"SingleClick", bSingleClick, true); IniSectionSetBoolEx(pIniSection, L"OpenFileInSameWindow", bOpenFileInSameWindow, false); IniSectionSetBoolEx(pIniSection, L"TrackSelect", bTrackSelect, true); @@ -2777,19 +2797,7 @@ void SaveSettings(bool bSaveSettingsNow) { IniSectionSetBoolEx(pIniSection, L"UseXPFileDialog", bUseXPFileDialog, false); } - IniSectionSetIntEx(pIniSection, L"StartupDirectory", (int)iStartupDir, StartupDirectory_MRU); - if (iStartupDir == StartupDirectory_MRU) { - IniSectionSetString(pIniSection, L"MRUDirectory", szCurDir); - } - PathRelativeToApp(tchFavoritesDir, wchTmp, FILE_ATTRIBUTE_DIRECTORY, true, flagPortableMyDocs); - IniSectionSetString(pIniSection, L"Favorites", wchTmp); - PathRelativeToApp(szQuickview, wchTmp, FILE_ATTRIBUTE_DIRECTORY, true, flagPortableMyDocs); - IniSectionSetString(pIniSection, L"Quikview.exe", wchTmp); - IniSectionSetStringEx(pIniSection, L"QuikviewParams", szQuickviewParams, L""); - PathRelativeToApp(tchOpenWithDir, wchTmp, FILE_ATTRIBUTE_DIRECTORY, true, flagPortableMyDocs); - IniSectionSetString(pIniSection, L"OpenWithDir", wchTmp); IniSectionSetIntEx(pIniSection, L"FillMask", dwFillMask, DL_ALLOBJECTS); - IniSectionSetIntEx(pIniSection, L"SortOptions", nSortFlags, DS_NAME); IniSectionSetBoolEx(pIniSection, L"SortReverse", fSortRev, false); IniSectionSetStringEx(pIniSection, L"FileFilter", tchFilter, L"*.*"); @@ -2807,17 +2815,16 @@ void SaveSettings(bool bSaveSettingsNow) { IniSectionSetBoolEx(pIniSection, L"ShowDriveBox", bShowDriveBox, true); SaveIniSection(INI_SECTION_NAME_SETTINGS, pIniSectionBuf); - SaveWindowPosition(pIniSectionBuf); NP2HeapFree(pIniSectionBuf); } void SaveWindowPosition(WCHAR *pIniSectionBuf) { - memset(pIniSectionBuf, 0, 2*sizeof(WCHAR)); IniSectionOnSave section = { pIniSectionBuf }; IniSectionOnSave * const pIniSection = §ion; WCHAR sectionName[96]; - GetWindowPositionSectionName(sectionName); + HMONITOR hMonitor = MonitorFromWindow(hwndMain, MONITOR_DEFAULTTONEAREST); + GetWindowPositionSectionName(hMonitor, sectionName); // query window dimensions when window is not minimized if (!IsIconic(hwndMain)) { diff --git a/readme.md b/readme.md index 9b55def18e..0441a5fa32 100644 --- a/readme.md +++ b/readme.md @@ -50,7 +50,7 @@ Latest development builds (artifacts in Release configuration for each compiler * Objective-C/C++, [Screenshots](https://github.com/zufuliu/notepad2/wiki/Screenshots#objective-cc) * [C Standard Library](tools/lang/C.c), up to C2x. * [C++ STL](tools/lang/CPP.cpp), up to C++20. - * [CSS Style Sheet](tools/lang/CSS.css), up to August 2023 snapshot. + * [CSS Style Sheet](tools/lang/CSS.css), up to November 2023 snapshot. * [SCSS Style Sheet](tools/lang/SCSS.scss), up to Dart Sass 1.50. * [Less Style Sheet](tools/lang/Less.less), up to Less 4.1. * [HSS Style Sheet](tools/lang/HSS.hss) @@ -73,7 +73,7 @@ Latest development builds (artifacts in Release configuration for each compiler * [Groovy](tools/lang/Groovy.groovy), up to Groovy 5.0. * [Haskell](tools/lang/Haskell.hs), up to GHC 9.6. * [Haxe](tools/lang/Haxe.hx), up to Haxe 4.3. - * [HTML](tools/lang/html.html), up to [WHATWG](https://html.spec.whatwg.org/multipage/) June 2023. [Screenshots](https://github.com/zufuliu/notepad2/wiki/Screenshots#html) + * [HTML](tools/lang/html.html), up to [WHATWG](https://html.spec.whatwg.org/multipage/) November 2023. [Screenshots](https://github.com/zufuliu/notepad2/wiki/Screenshots#html) * ASP * ASP.NET * JSP @@ -113,7 +113,7 @@ Latest development builds (artifacts in Release configuration for each compiler * [Perl](tools/lang/Perl.pl), up to Perl 5.36. [Screenshots](https://github.com/zufuliu/notepad2/wiki/Screenshots#perl) * [PowerShell](tools/lang/PowerShell.ps1), up to PowerShell 7.2. * [Python](tools/lang/Python.py), up to Python 3.12. [Screenshots](https://github.com/zufuliu/notepad2/wiki/Screenshots#python) - * [PHP Script](tools/lang/PHP.php), up to PHP 8.2. [Screenshots](https://github.com/zufuliu/notepad2/wiki/Screenshots#php) + * [PHP Script](tools/lang/PHP.php), up to PHP 8.3. [Screenshots](https://github.com/zufuliu/notepad2/wiki/Screenshots#php) * Windows Rescouce Script * [R](tools/lang/R.r), up to R 4.2. * [REBOL](tools/lang/Rebol.r) 3 and [Red](tools/lang/Red.red) @@ -127,7 +127,7 @@ Latest development builds (artifacts in Release configuration for each compiler * SQL Query * [SQL Standard](tools/lang/SQL.sql), up to SQL:2016. * [MySQL](tools/lang/MySQL.sql), up to MySQL 8.0, MariaDB 10.9. - * [SQLite3](tools/lang/SQLite3.sql), up to 3.41. + * [SQLite3](tools/lang/SQLite3.sql), up to 3.44. * [PostgreSQL](tools/lang/PostgreSQL.sql), PostgreSQL 14. * [Transact-SQL](tools/lang/Transact-SQL.sql), SQL Server 2019. * [Oracle](tools/lang/Oracle.sql), Oracle 20, incomplete. diff --git a/res/Notepad2.exe.manifest b/res/Notepad2.exe.manifest index 255108b4b5..d3ca4b9a1b 100644 --- a/res/Notepad2.exe.manifest +++ b/res/Notepad2.exe.manifest @@ -1,6 +1,6 @@ - + Notepad2 Text Editor diff --git a/scintilla/lexers/LexKotlin.cxx b/scintilla/lexers/LexKotlin.cxx index 74a1bee6da..c72802a427 100644 --- a/scintilla/lexers/LexKotlin.cxx +++ b/scintilla/lexers/LexKotlin.cxx @@ -53,9 +53,11 @@ enum { //KeywordIndex++Autogenerated -- start of section automatically generated enum { KeywordIndex_Keyword = 0, - KeywordIndex_Class = 1, - KeywordIndex_Interface = 2, - KeywordIndex_Enumeration = 3, + KeywordIndex_JavaClass = 1, + KeywordIndex_Class = 2, + KeywordIndex_JavaInterface = 3, + KeywordIndex_Interface = 4, + KeywordIndex_Enumeration = 5, }; //KeywordIndex--Autogenerated -- end of section automatically generated @@ -176,9 +178,9 @@ void ColouriseKotlinDoc(Sci_PositionU startPos, Sci_Position lengthDoc, int init } else if (sc.ch == '@') { sc.ChangeState(SCE_KOTLIN_LABEL); sc.Forward(); - } else if (keywordLists[KeywordIndex_Class].InList(s)) { + } else if (keywordLists[KeywordIndex_JavaClass].InList(s) || keywordLists[KeywordIndex_Class].InList(s)) { sc.ChangeState(SCE_KOTLIN_CLASS); - } else if (keywordLists[KeywordIndex_Interface].InList(s)) { + } else if (keywordLists[KeywordIndex_JavaInterface].InList(s) || keywordLists[KeywordIndex_Interface].InList(s)) { sc.ChangeState(SCE_KOTLIN_INTERFACE); } else if (keywordLists[KeywordIndex_Enumeration].InList(s)) { sc.ChangeState(SCE_KOTLIN_ENUM); diff --git a/scintilla/scripts/Face.py b/scintilla/scripts/Face.py index 94bb435dd4..6fa7e9364e 100644 --- a/scintilla/scripts/Face.py +++ b/scintilla/scripts/Face.py @@ -3,8 +3,6 @@ # Released to the public domain. def sanitiseLine(line): - if line[-1:] == '\n': - line = line[:-1] index = line.find("##") if index >= 0: line = line[:index] diff --git a/scintilla/src/CallTip.cxx b/scintilla/src/CallTip.cxx index c76ab7dd5c..99b7adeae6 100644 --- a/scintilla/src/CallTip.cxx +++ b/scintilla/src/CallTip.cxx @@ -36,6 +36,22 @@ size_t Chunk::Length() const noexcept { return end - start; } +namespace { + +#ifdef __APPLE__ +// Archaic macOS colours for the default: black on light yellow +constexpr ColourRGBA colourTextAndArrow(black); +constexpr ColourRGBA colourBackground(0xff, 0xff, 0xc6); +#else +// Grey on white +constexpr ColourRGBA colourTextAndArrow(0x80, 0x80, 0x80); +constexpr ColourRGBA colourBackground(white); +#endif + +constexpr ColourRGBA silver(0xc0, 0xc0, 0xc0); + +} + CallTip::CallTip() noexcept { wCallTip = nullptr; inCallTipMode = false; @@ -56,17 +72,11 @@ CallTip::CallTip() noexcept { innerMarginX = 12; innerMarginY = 10; -#ifdef __APPLE__ - // proper apple colours for the default - colourBG = ColourRGBA(0xff, 0xff, 0xc6); - colourUnSel = ColourRGBA(0, 0, 0); -#else - colourBG = ColourRGBA(0xff, 0xff, 0xff); - colourUnSel = ColourRGBA(0x80, 0x80, 0x80); -#endif + colourBG = colourBackground; + colourUnSel = colourTextAndArrow; colourSel = ColourRGBA(0, 0, 0x80); - colourShade = ColourRGBA(0, 0, 0); - colourLight = ColourRGBA(0xc0, 0xc0, 0xc0); + colourShade = black; + colourLight = silver; clickPlace = 0; } diff --git a/scintilla/src/CellBuffer.cxx b/scintilla/src/CellBuffer.cxx index 2f8ce58e20..7a92c9a59e 100644 --- a/scintilla/src/CellBuffer.cxx +++ b/scintilla/src/CellBuffer.cxx @@ -843,6 +843,31 @@ Sci::Position CellBuffer::LineStart(Sci::Line line) const noexcept { return plv->LineStart(line); } +Sci::Position CellBuffer::LineEnd(Sci::Line line) const noexcept { + Sci::Position position = LineStart(line + 1); + if (line < Lines() - 1) { + if (LineEndType::Unicode == GetLineEndTypes()) { + const unsigned char bytes[] = { + UCharAt(position - 3), + UCharAt(position - 2), + UCharAt(position - 1), + }; + if (UTF8IsSeparator(bytes)) { + return position - UTF8SeparatorLength; + } + if (UTF8IsNEL(bytes + 1)) { + return position - UTF8NELLength; + } + } + position--; // Back over CR or LF + // When line terminator is CR+LF, may need to go back one more + if ((position > LineStart(line)) && (CharAt(position - 1) == '\r')) { + position--; + } + } + return position; +} + Sci::Line CellBuffer::LineFromPosition(Sci::Position pos) const noexcept { return plv->LineFromPosition(pos); } diff --git a/scintilla/src/CellBuffer.h b/scintilla/src/CellBuffer.h index 7e4e54f904..13d180ab30 100644 --- a/scintilla/src/CellBuffer.h +++ b/scintilla/src/CellBuffer.h @@ -192,6 +192,7 @@ class CellBuffer { Sci::Line Lines() const noexcept; void AllocateLines(Sci::Line lines); Sci::Position LineStart(Sci::Line line) const noexcept; + Sci::Position LineEnd(Sci::Line line) const noexcept; Sci::Position IndexLineStart(Sci::Line line, Scintilla::LineCharacterIndexType lineCharacterIndex) const noexcept; Sci::Line LineFromPosition(Sci::Position pos) const noexcept; Sci::Line LineFromPositionIndex(Sci::Position pos, Scintilla::LineCharacterIndexType lineCharacterIndex) const noexcept; diff --git a/scintilla/src/Document.cxx b/scintilla/src/Document.cxx index 60559f2e03..67ffd30376 100644 --- a/scintilla/src/Document.cxx +++ b/scintilla/src/Document.cxx @@ -477,32 +477,11 @@ Range Document::LineRange(Sci::Line line) const noexcept { } bool Document::IsLineStartPosition(Sci::Position position) const noexcept { - return LineStart(SciLineFromPosition(position)) == position; + return LineStartPosition(position) == position; } Sci_Position SCI_METHOD Document::LineEnd(Sci_Line line) const noexcept { - Sci::Position position = LineStart(line + 1); - if (line < LinesTotal() - 1) { - if (cb.GetLineEndTypes() != LineEndType::Default) { - const unsigned char bytes[] = { - cb.UCharAt(position - 3), - cb.UCharAt(position - 2), - cb.UCharAt(position - 1), - }; - if (UTF8IsSeparator(bytes)) { - return position - UTF8SeparatorLength; - } - if (UTF8IsNEL(bytes + 1)) { - return position - UTF8NELLength; - } - } - position--; // Back over CR or LF - // When line terminator is CR+LF, may need to go back one more - if ((position > LineStart(line)) && (cb.CharAt(position - 1) == '\r')) { - position--; - } - } - return position; + return cb.LineEnd(line); } void SCI_METHOD Document::SetErrorStatus(int status) noexcept { @@ -521,16 +500,20 @@ Sci::Line Document::SciLineFromPosition(Sci::Position pos) const noexcept { return cb.LineFromPosition(pos); } +Sci::Position Document::LineStartPosition(Sci::Position position) const noexcept { + return cb.LineStart(cb.LineFromPosition(position)); +} + Sci::Position Document::LineEndPosition(Sci::Position position) const noexcept { - return LineEnd(SciLineFromPosition(position)); + return cb.LineEnd(cb.LineFromPosition(position)); } bool Document::IsLineEndPosition(Sci::Position position) const noexcept { - return LineEnd(SciLineFromPosition(position)) == position; + return LineEndPosition(position) == position; } bool Document::IsPositionInLineEnd(Sci::Position position) const noexcept { - return position >= LineEnd(SciLineFromPosition(position)); + return position >= LineEndPosition(position); } Sci::Position Document::VCHomePosition(Sci::Position position) const noexcept { @@ -828,7 +811,7 @@ Sci::Position Document::MovePositionOutsideChar(Sci::Position pos, Sci::Position } else { // Anchor DBCS calculations at start of line because start of line can // not be a DBCS trail byte. - const Sci::Position posStartLine = LineStart(cb.LineFromPosition(pos)); + const Sci::Position posStartLine = LineStartPosition(pos); if (pos == posStartLine) return pos; @@ -913,7 +896,7 @@ Sci::Position Document::NextPosition(Sci::Position pos, int moveDir) const noexc } else { // Anchor DBCS calculations at start of line because start of line can // not be a DBCS trail byte. - const Sci::Position posStartLine = cb.LineStart(cb.LineFromPosition(pos)); + const Sci::Position posStartLine = LineStartPosition(pos); // How to Go Backward in a DBCS String // https://msdn.microsoft.com/en-us/library/cc194792.aspx // DBCS-Enabled Programs vs. Non-DBCS-Enabled Programs @@ -2502,8 +2485,7 @@ void Document::EnsureStyledTo(Sci::Position pos) { if ((enteredStyling == 0) && (pos > GetEndStyled())) { IncrementStyleClock(); if (pli && !pli->UseContainerLexing()) { - const Sci::Line lineEndStyled = SciLineFromPosition(GetEndStyled()); - const Sci::Position endStyledTo = LineStart(lineEndStyled); + const Sci::Position endStyledTo = LineStartPosition(GetEndStyled()); pli->Colourise(endStyledTo, pos); } else { // Ask the watchers to style, and stop as soon as one responds. @@ -3534,8 +3516,7 @@ Sci::Position BuiltinRegex::FindText(const Document *doc, Sci::Position minPos, } const DocumentIndexer di(doc, endOfLine); - search.lineStartPos = lineStartPos; - search.lineEndPos = lineEndPos; + search.SetLineRange(lineStartPos, lineEndPos); int success = search.Execute(di, startOfLine, endOfLine); if (success) { pos = search.bopat[0]; diff --git a/scintilla/src/Document.h b/scintilla/src/Document.h index e4fa6004d5..1e8d96960e 100644 --- a/scintilla/src/Document.h +++ b/scintilla/src/Document.h @@ -528,6 +528,7 @@ class Document : PerLine, public Scintilla::IDocument, public Scintilla::ILoader [[nodiscard]] Range LineRange(Sci::Line line) const noexcept; bool IsLineStartPosition(Sci::Position position) const noexcept; Sci_Position SCI_METHOD LineEnd(Sci_Line line) const noexcept override; + Sci::Position LineStartPosition(Sci::Position position) const noexcept; Sci::Position LineEndPosition(Sci::Position position) const noexcept; bool IsLineEndPosition(Sci::Position position) const noexcept; bool IsPositionInLineEnd(Sci::Position position) const noexcept; diff --git a/scintilla/src/EditModel.cxx b/scintilla/src/EditModel.cxx index c197eedad2..027e3ccf7b 100644 --- a/scintilla/src/EditModel.cxx +++ b/scintilla/src/EditModel.cxx @@ -86,6 +86,7 @@ EditModel::EditModel() : durationWrapOneUnit(0.01 / 64), durationWrapOneThread(0 GetNativeSystemInfo(&info); hardwareConcurrency = info.dwNumberOfProcessors; idleTaskTimer = CreateWaitableTimer(nullptr, true, nullptr); + SetIdleTaskTime(IdleLineWrapTime); UpdateParallelLayoutThreshold(); } diff --git a/scintilla/src/EditModel.h b/scintilla/src/EditModel.h index 1fc7b67e24..44ba4d061c 100644 --- a/scintilla/src/EditModel.h +++ b/scintilla/src/EditModel.h @@ -58,7 +58,6 @@ class EditModel { ActionDuration durationWrapOneUnit; ActionDuration durationWrapOneThread; static constexpr uint32_t IdleLineWrapTime = 250; - static constexpr uint32_t ActiveLineWrapTime = 500; void *idleTaskTimer; EditModel(); diff --git a/scintilla/src/EditView.cxx b/scintilla/src/EditView.cxx index 651fadce6b..c953964e24 100644 --- a/scintilla/src/EditView.cxx +++ b/scintilla/src/EditView.cxx @@ -430,13 +430,16 @@ struct LayoutWorker { } } - uint32_t Start(Sci::Position posLineStart, uint32_t posInLine) { + uint32_t Start(Sci::Position posLineStart, uint32_t posInLine, LayoutLineOption option) { const int startPos = ll->lastSegmentEnd; const int endPos = ll->numCharsInLine; if (endPos - startPos > blockSize*2 && !model.BidirectionalEnabled()) { posInLine = std::max(posInLine, ll->caretPosition) + blockSize; if (posInLine > static_cast(endPos)) { posInLine = endPos; + } else if (option < LayoutLineOption::IdleUpdate) { + // layout as much as possible to avoid unexpected scrolling + model.SetIdleTaskTime(EditModel::IdleLineWrapTime); } } else { posInLine = endPos; @@ -663,7 +666,7 @@ uint64_t EditView::LayoutLine(const EditModel &model, Surface *surface, const Vi //const ElapsedPeriod period; //posInLine = ll->numCharsInLine; // whole line LayoutWorker worker{ ll, vstyle, surface, posCache, model, {}}; - const uint32_t threadCount = worker.Start(posLineStart, posInLine); + const uint32_t threadCount = worker.Start(posLineStart, posInLine, option); // Accumulate absolute positions from relative positions within segments and expand tabs const uint32_t finishedCount = worker.finishedCount.load(std::memory_order_relaxed); @@ -1000,13 +1003,13 @@ Sci::Position EditView::StartEndDisplayLine(Surface *surface, const EditModel &m namespace { -constexpr ColourRGBA bugColour = ColourRGBA(0xff, 0, 0xfe, 0xf0); +constexpr ColourRGBA colourBug(0xff, 0, 0xfe, 0xf0); // Selection background colours are always defined, the value_or is to show if bug ColourRGBA SelectionBackground(const EditModel &model, const ViewStyle &vsDraw, InSelection inSelection) { if (inSelection == InSelection::inNone) - return bugColour; // Not selected is a bug + return colourBug; // Not selected is a bug Element element = Element::SelectionBack; if (inSelection == InSelection::inAdditional) @@ -1019,7 +1022,7 @@ ColourRGBA SelectionBackground(const EditModel &model, const ViewStyle &vsDraw, return *colour; } } - return vsDraw.ElementColour(element).value_or(bugColour); + return vsDraw.ElementColour(element).value_or(colourBug); } ColourOptional SelectionForeground(const EditModel &model, const ViewStyle &vsDraw, InSelection inSelection) { @@ -1609,9 +1612,9 @@ void EditView::DrawAnnotation(Surface *surface, const EditModel &model, const Vi } } else { #ifndef NDEBUG - // No annotation to draw so show bug with bugColour + // No annotation to draw so show bug with colourBug if (FlagSet(phase, DrawPhase::back)) { - surface->FillRectangle(rcSegment, bugColour.Opaque()); + surface->FillRectangle(rcSegment, colourBug.Opaque()); } #endif } @@ -2266,17 +2269,11 @@ void DrawFoldLines(Surface *surface, const EditModel &model, const ViewStyle &vs vsDraw.markers[static_cast(MarkerOutline::Folder)].fore); // Paint the line above the fold // Paint the line above the fold - if ((subLine == 0) && - ((expanded && (FlagSet(model.foldFlags, FoldFlag::LineBeforeExpanded))) - || - (!expanded && (FlagSet(model.foldFlags, FoldFlag::LineBeforeContracted))))) { + if ((subLine == 0) && FlagSet(model.foldFlags, (expanded ? FoldFlag::LineBeforeContracted : FoldFlag::LineBeforeExpanded))) { surface->FillRectangleAligned(Side(rcLine, Edge::top, 1.0), foldLineColour); } // Paint the line below the fold - if (lastSubLine && - ((expanded && (FlagSet(model.foldFlags, FoldFlag::LineAfterExpanded))) - || - (!expanded && (FlagSet(model.foldFlags, FoldFlag::LineAfterContracted))))) { + if (lastSubLine && FlagSet(model.foldFlags, (expanded ? FoldFlag::LineAfterExpanded : FoldFlag::LineAfterContracted))) { surface->FillRectangleAligned(Side(rcLine, Edge::bottom, 1.0), foldLineColour); // If contracted fold line drawn then don't overwrite with hidden line // as fold lines are more specific then hidden lines. @@ -2300,7 +2297,7 @@ ColourRGBA InvertedLight(ColourRGBA orig) noexcept { const unsigned int l = (r + g + b) / 3; // There is a better calculation for this that matches human eye const unsigned int il = 0xff - l; if (l == 0) - return ColourRGBA(0xff, 0xff, 0xff); + return white; r = r * il / l; g = g * il / l; b = b * il / l; @@ -2945,15 +2942,15 @@ Sci::Position EditView::FormatRange(bool draw, CharacterRangeFull chrg, Scintill it->fore = InvertedLight(it->fore); it->back = InvertedLight(it->back); } else if (colourMode == PrintOption::BlackOnWhite) { - it->fore = ColourRGBA(0, 0, 0); - it->back = ColourRGBA(0xff, 0xff, 0xff); + it->fore = black; + it->back = white; } else if (colourMode == PrintOption::ColourOnWhite || colourMode == PrintOption::ColourOnWhiteDefaultBG) { - it->back = ColourRGBA(0xff, 0xff, 0xff); + it->back = white; } } // White background for the line numbers if PrintOption::ScreenColours isn't used if (colourMode != PrintOption::ScreenColours) { - vsPrint.styles[StyleLineNumber].back = ColourRGBA(0xff, 0xff, 0xff); + vsPrint.styles[StyleLineNumber].back = white; } // Printing uses different margins, so reset screen margins diff --git a/scintilla/src/EditView.h b/scintilla/src/EditView.h index 17bfeb147b..3c11dd2327 100644 --- a/scintilla/src/EditView.h +++ b/scintilla/src/EditView.h @@ -36,6 +36,7 @@ enum class DrawPhase { enum class LayoutLineOption { AutoUpdate, ManualUpdate, + IdleUpdate, KeepPosition, Printing, CallerMultiThreaded = 8, diff --git a/scintilla/src/Editor.cxx b/scintilla/src/Editor.cxx index 492f97e683..d910bfe721 100644 --- a/scintilla/src/Editor.cxx +++ b/scintilla/src/Editor.cxx @@ -92,11 +92,11 @@ constexpr bool CanEliminate(const DocModification &mh) noexcept { in a [possibly lengthy] multi-step Undo/Redo sequence */ constexpr bool IsLastStep(const DocModification &mh) noexcept { - return - FlagSet(mh.modificationType, (ModificationFlags::Undo | ModificationFlags::Redo)) - && FlagSet(mh.modificationType, ModificationFlags::MultiStepUndoRedo) - && FlagSet(mh.modificationType, ModificationFlags::LastStepInUndoRedo) - && FlagSet(mh.modificationType, ModificationFlags::MultilineUndoRedo); + constexpr ModificationFlags finalMask = ModificationFlags::MultiStepUndoRedo + | ModificationFlags::LastStepInUndoRedo + | ModificationFlags::MultilineUndoRedo; + return FlagSet(mh.modificationType, (ModificationFlags::Undo | ModificationFlags::Redo)) + && ((mh.modificationType & finalMask) == finalMask); } } @@ -623,14 +623,12 @@ void Editor::InvalidateWholeSelection() noexcept { at the beginning and end of the region lines. */ SelectionRange Editor::LineSelectionRange(SelectionPosition currentPos_, SelectionPosition anchor_, bool withEOL) const noexcept { if (currentPos_ >= anchor_) { - anchor_ = SelectionPosition( - pdoc->LineStart(pdoc->SciLineFromPosition(anchor_.Position()))); + anchor_ = SelectionPosition(pdoc->LineStartPosition(anchor_.Position())); const Sci::Line endLine = pdoc->SciLineFromPosition(currentPos_.Position()); currentPos_ = SelectionPosition( withEOL ? pdoc->LineStart(endLine + 1) : pdoc->LineEnd(endLine)); } else { - currentPos_ = SelectionPosition( - pdoc->LineStart(pdoc->SciLineFromPosition(currentPos_.Position()))); + currentPos_ = SelectionPosition(pdoc->LineStartPosition(currentPos_.Position())); const Sci::Line endLine = pdoc->SciLineFromPosition(anchor_.Position()); anchor_ = SelectionPosition( withEOL ? pdoc->LineStart(endLine + 1) : pdoc->LineEnd(endLine)); @@ -986,7 +984,10 @@ void Editor::VerticalCentreCaret() { void Editor::MoveSelectedLines(int lineDelta) { if (sel.IsRectangular()) { - return; + // Convert to stream selection + const SelectionRange rangeRectangular = sel.Rectangular(); + sel.Clear(); + sel.SetSelection(rangeRectangular); } // if selection doesn't start at the beginning of the line, set the new start @@ -1524,7 +1525,7 @@ bool Editor::WrapBlock(Surface *surface, Sci::Line lineToWrap, Sci::Line lineToW } else { ll->caretPosition = 0; } - const uint64_t wrappedBytes = view.LayoutLine(*this, surface, vs, ll, wrapWidth, LayoutLineOption::ManualUpdate); + const uint64_t wrappedBytes = view.LayoutLine(*this, surface, vs, ll, wrapWidth, LayoutLineOption::IdleUpdate); wrappedBytesAllThread += wrappedBytes & UINT32_MAX; wrappedBytesOneThread += wrappedBytes >> 32; linesAfterWrap[index] = ll->lines; @@ -2168,8 +2169,7 @@ void Editor::InsertPasteShape(const char *text, Sci::Position len, PasteShape sh PasteRectangular(sel.Start(), text, len); } else { if (shape == PasteShape::line) { - const Sci::Position insertPos = - pdoc->LineStart(pdoc->SciLineFromPosition(sel.MainCaret())); + const Sci::Position insertPos = pdoc->LineStartPosition(sel.MainCaret()); Sci::Position lengthInserted = pdoc->InsertString(insertPos, text, len); // add the newline if necessary if ((len > 0) && !IsEOLCharacter(text[len - 1])) { @@ -2653,18 +2653,25 @@ void Editor::NotifySavePoint(Document *, void *, bool atSavePoint) noexcept { NotifySavePoint(atSavePoint); } -void Editor::CheckModificationForWrap(DocModification mh) { - if (FlagSet(mh.modificationType, ModificationFlags::InsertText | ModificationFlags::DeleteText)) { - view.llc.Invalidate(LineLayout::ValidLevel::checkTextAndStyle); - const Sci::Line lineDoc = pdoc->SciLineFromPosition(mh.position); - const Sci::Line lines = std::max(0, mh.linesAdded); - if (Wrapping()) { - NeedWrapping(lineDoc, lineDoc + lines + 1); +void Editor::CheckModificationForShow(const DocModification &mh) { + const Sci::Line lineOfPos = pdoc->SciLineFromPosition(mh.position); + Sci::Position endNeedShown = mh.position; + if (FlagSet(mh.modificationType, ModificationFlags::BeforeInsert)) { + if (pdoc->ContainsLineEnd(mh.text, mh.length) && (mh.position != pdoc->LineStart(lineOfPos))) + endNeedShown = pdoc->LineStart(lineOfPos + 1); + } else { + // If the deletion includes any EOL then we extend the need shown area. + endNeedShown = mh.position + mh.length; + Sci::Line lineLast = pdoc->SciLineFromPosition(mh.position + mh.length); + for (Sci::Line line = lineOfPos + 1; line <= lineLast; line++) { + const Sci::Line lineMaxSubord = pdoc->GetLastChild(line); + if (lineLast < lineMaxSubord) { + lineLast = lineMaxSubord; + endNeedShown = pdoc->LineEnd(lineLast); + } } - RefreshStyleData(); - // Fix up annotation heights - SetAnnotationHeights(lineDoc, lineDoc + lines + 2); } + NeedShown(mh.position, endNeedShown - mh.position); } namespace { @@ -2750,24 +2757,7 @@ void Editor::NotifyModified(Document *, DocModification mh, void *) { } if (FlagSet(mh.modificationType, (ModificationFlags::BeforeInsert | ModificationFlags::BeforeDelete)) && pcs->HiddenLines()) { // Some lines are hidden so may need shown. - const Sci::Line lineOfPos = pdoc->SciLineFromPosition(mh.position); - Sci::Position endNeedShown = mh.position; - if (FlagSet(mh.modificationType, ModificationFlags::BeforeInsert)) { - if (pdoc->ContainsLineEnd(mh.text, mh.length) && (mh.position != pdoc->LineStart(lineOfPos))) - endNeedShown = pdoc->LineStart(lineOfPos + 1); - } else if (FlagSet(mh.modificationType, ModificationFlags::BeforeDelete)) { - // If the deletion includes any EOL then we extend the need shown area. - endNeedShown = mh.position + mh.length; - Sci::Line lineLast = pdoc->SciLineFromPosition(mh.position + mh.length); - for (Sci::Line line = lineOfPos + 1; line <= lineLast; line++) { - const Sci::Line lineMaxSubord = pdoc->GetLastChild(line); - if (lineLast < lineMaxSubord) { - lineLast = lineMaxSubord; - endNeedShown = pdoc->LineEnd(lineLast); - } - } - } - NeedShown(mh.position, endNeedShown - mh.position); + CheckModificationForShow(mh); } if (mh.linesAdded != 0) { // Update contraction state for inserted and removed lines @@ -2796,7 +2786,18 @@ void Editor::NotifyModified(Document *, DocModification mh, void *) { Redraw(); } } - CheckModificationForWrap(mh); + //CheckModificationForWrap(mh); + if (FlagSet(mh.modificationType, ModificationFlags::InsertText | ModificationFlags::DeleteText)) { + view.llc.Invalidate(LineLayout::ValidLevel::checkTextAndStyle); + const Sci::Line lineDoc = pdoc->SciLineFromPosition(mh.position); + const Sci::Line lines = std::max(0, mh.linesAdded); + if (Wrapping()) { + NeedWrapping(lineDoc, lineDoc + lines + 1); + } + RefreshStyleData(); + // Fix up annotation heights + SetAnnotationHeights(lineDoc, lineDoc + lines + 2); + } if (mh.linesAdded != 0) { // Avoid scrolling of display if change before current display if (mh.position < posTopLine && !CanDeferToLastStep(mh)) { @@ -2830,7 +2831,7 @@ void Editor::NotifyModified(Document *, DocModification mh, void *) { SetScrollBars(); } - if ((FlagSet(mh.modificationType, ModificationFlags::ChangeMarker)) || (FlagSet(mh.modificationType, ModificationFlags::ChangeMargin))) { + if (FlagSet(mh.modificationType, (ModificationFlags::ChangeMarker | ModificationFlags::ChangeMargin))) { if ((!willRedrawAll) && ((paintState == PaintState::notPainting) || !PaintContainsMargin())) { if (FlagSet(mh.modificationType, ModificationFlags::ChangeFold)) { // Fold changes can affect the drawing of following lines so redraw whole margin @@ -3013,8 +3014,6 @@ void Editor::NotifyMacroRecord(Message iMessage, uptr_t wParam, sptr_t lParam) n // Something has changed that the container should know about void Editor::ContainerNeedsUpdate(Update flags) noexcept { needUpdateUI = needUpdateUI | flags; - // layout as much as possible inside LayoutLine() to avoid unexpected scrolling - SetIdleTaskTime(ActiveLineWrapTime); } /** @@ -3482,6 +3481,14 @@ constexpr bool IsRectExtend(Message iMessage, bool isRectMoveExtends) noexcept { } +Sci::Position Editor::HomeWrapPosition(Sci::Position position) { + const Sci::Position viewLineStart = StartEndDisplayLine(position, true); + const Sci::Position homePos = MovePositionSoVisible(viewLineStart, -1).Position(); + if (position <= homePos) + return pdoc->LineStartPosition(position); + return homePos; +} + Sci::Position Editor::VCHomeDisplayPosition(Sci::Position position) { const Sci::Position homePos = pdoc->VCHomePosition(position); const Sci::Position viewLineStart = StartEndDisplayLine(position, true); @@ -3510,6 +3517,125 @@ Sci::Position Editor::LineEndWrapPosition(Sci::Position position) { return endPos; } +SelectionPosition Editor::PositionMove(Message iMessage, SelectionPosition spCaret) { + switch (iMessage) { + case Message::CharLeft: + case Message::CharLeftExtend: + if (spCaret.VirtualSpace()) { + spCaret.AddVirtualSpace(-1); + } else if (!FlagSet(virtualSpaceOptions, VirtualSpace::NoWrapLineStart) || pdoc->GetColumn(spCaret.Position()) > 0) { + spCaret.Add(-1); + } + return spCaret; + case Message::CharRight: + case Message::CharRightExtend: + if (FlagSet(virtualSpaceOptions, VirtualSpace::UserAccessible) && pdoc->IsLineEndPosition(spCaret.Position())) { + spCaret.AddVirtualSpace(1); + } else { + spCaret.Add(1); + } + return spCaret; + case Message::WordLeft: + case Message::WordLeftExtend: + return SelectionPosition(pdoc->NextWordStart(spCaret.Position(), -1)); + case Message::WordRight: + case Message::WordRightExtend: + return SelectionPosition(pdoc->NextWordStart(spCaret.Position(), 1)); + case Message::WordLeftEnd: + case Message::WordLeftEndExtend: + return SelectionPosition(pdoc->NextWordEnd(spCaret.Position(), -1)); + case Message::WordRightEnd: + case Message::WordRightEndExtend: + return SelectionPosition(pdoc->NextWordEnd(spCaret.Position(), 1)); + case Message::WordPartLeft: + case Message::WordPartLeftExtend: + return SelectionPosition(pdoc->WordPartLeft(spCaret.Position())); + case Message::WordPartRight: + case Message::WordPartRightExtend: + return SelectionPosition(pdoc->WordPartRight(spCaret.Position())); + case Message::Home: + case Message::HomeExtend: + return SelectionPosition(pdoc->LineStartPosition(spCaret.Position())); + case Message::HomeDisplay: + case Message::HomeDisplayExtend: + return SelectionPosition(StartEndDisplayLine(spCaret.Position(), true)); + case Message::HomeWrap: + case Message::HomeWrapExtend: + return SelectionPosition(HomeWrapPosition(spCaret.Position())); + case Message::VCHome: + case Message::VCHomeExtend: + // VCHome alternates between beginning of line and beginning of text so may move back or forwards + return SelectionPosition(pdoc->VCHomePosition(spCaret.Position())); + case Message::VCHomeDisplay: + case Message::VCHomeDisplayExtend: + return SelectionPosition(VCHomeDisplayPosition(spCaret.Position())); + case Message::VCHomeWrap: + case Message::VCHomeWrapExtend: + return SelectionPosition(VCHomeWrapPosition(spCaret.Position())); + case Message::LineEnd: + case Message::LineEndExtend: + return SelectionPosition(pdoc->LineEndPosition(spCaret.Position())); + case Message::LineEndDisplay: + case Message::LineEndDisplayExtend: + return SelectionPosition(StartEndDisplayLine(spCaret.Position(), false)); + case Message::LineEndWrap: + case Message::LineEndWrapExtend: + return SelectionPosition(LineEndWrapPosition(spCaret.Position())); + + default: + break; + } + // Above switch should be exhaustive so this will never be reached. + PLATFORM_ASSERT(false); + return spCaret; +} + +SelectionRange Editor::SelectionMove(Scintilla::Message iMessage, size_t r) { + const SelectionPosition spCaretStart = sel.Range(r).caret; + const SelectionPosition spCaretMoved = PositionMove(iMessage, spCaretStart); + + const int directionMove = (spCaretMoved < spCaretStart) ? -1 : 1; + const SelectionPosition spCaret = MovePositionSoVisible(spCaretMoved, directionMove); + + // Handle move versus extend, and special behaviour for non-empty left/right + switch (iMessage) { + case Message::CharLeft: + case Message::CharRight: + if (sel.Range(r).Empty()) { + return SelectionRange(spCaret); + } + if (iMessage == Message::CharLeft) { + return SelectionRange(sel.Range(r).Start()); + } + return SelectionRange(sel.Range(r).End()); + + case Message::WordLeft: + case Message::WordRight: + case Message::WordLeftEnd: + case Message::WordRightEnd: + case Message::WordPartLeft: + case Message::WordPartRight: + case Message::Home: + case Message::HomeDisplay: + case Message::HomeWrap: + case Message::VCHome: + case Message::VCHomeDisplay: + case Message::VCHomeWrap: + case Message::LineEnd: + case Message::LineEndDisplay: + case Message::LineEndWrap: + return SelectionRange(spCaret); + + default: + break; + } + + // All remaining cases are *Extend + const SelectionRange rangeNew = SelectionRange(spCaret, sel.Range(r).anchor); + sel.TrimOtherSelections(r, rangeNew); + return rangeNew; +} + int Editor::HorizontalMove(Message iMessage) { if (sel.selType == Selection::SelTypes::lines) { return 0; // horizontal moves with line selection have no effect @@ -3552,8 +3678,7 @@ int Editor::HorizontalMove(Message iMessage) { break; case Message::HomeRectExtend: case Message::HomeExtend: // only when sel.IsRectangular() && sel.MoveExtends() - spCaret = SelectionPosition( - pdoc->LineStart(pdoc->SciLineFromPosition(spCaret.Position()))); + spCaret = SelectionPosition(pdoc->LineStartPosition(spCaret.Position())); break; case Message::VCHomeRectExtend: case Message::VCHomeExtend: // only when sel.IsRectangular() && sel.MoveExtends() @@ -3576,8 +3701,7 @@ int Editor::HorizontalMove(Message iMessage) { SelectionPosition selAtLimit = (NaturalDirection(iMessage) > 0) ? sel.Limits().end : sel.Limits().start; switch (iMessage) { case Message::Home: - selAtLimit = SelectionPosition( - pdoc->LineStart(pdoc->SciLineFromPosition(selAtLimit.Position()))); + selAtLimit = SelectionPosition(pdoc->LineStartPosition(selAtLimit.Position())); break; case Message::VCHome: selAtLimit = SelectionPosition(pdoc->VCHomePosition(selAtLimit.Position())); @@ -3596,154 +3720,7 @@ int Editor::HorizontalMove(Message iMessage) { sel.DropAdditionalRanges(); } for (size_t r = 0; r < sel.Count(); r++) { - const SelectionPosition spCaretNow = sel.Range(r).caret; - SelectionPosition spCaret = spCaretNow; - switch (iMessage) { - case Message::CharLeft: - case Message::CharLeftExtend: - if (spCaret.VirtualSpace()) { - spCaret.SetVirtualSpace(spCaret.VirtualSpace() - 1); - } else if (!FlagSet(virtualSpaceOptions, VirtualSpace::NoWrapLineStart) || pdoc->GetColumn(spCaret.Position()) > 0) { - spCaret = SelectionPosition(spCaret.Position() - 1); - } - break; - case Message::CharRight: - case Message::CharRightExtend: - if (FlagSet(virtualSpaceOptions, VirtualSpace::UserAccessible) && pdoc->IsLineEndPosition(spCaret.Position())) { - spCaret.SetVirtualSpace(spCaret.VirtualSpace() + 1); - } else { - spCaret = SelectionPosition(spCaret.Position() + 1); - } - break; - case Message::WordLeft: - case Message::WordLeftExtend: - spCaret = SelectionPosition(pdoc->NextWordStart(spCaret.Position(), -1)); - break; - case Message::WordRight: - case Message::WordRightExtend: - spCaret = SelectionPosition(pdoc->NextWordStart(spCaret.Position(), 1)); - break; - case Message::WordLeftEnd: - case Message::WordLeftEndExtend: - spCaret = SelectionPosition(pdoc->NextWordEnd(spCaret.Position(), -1)); - break; - case Message::WordRightEnd: - case Message::WordRightEndExtend: - spCaret = SelectionPosition(pdoc->NextWordEnd(spCaret.Position(), 1)); - break; - case Message::WordPartLeft: - case Message::WordPartLeftExtend: - spCaret = SelectionPosition(pdoc->WordPartLeft(spCaret.Position())); - break; - case Message::WordPartRight: - case Message::WordPartRightExtend: - spCaret = SelectionPosition(pdoc->WordPartRight(spCaret.Position())); - break; - case Message::Home: - case Message::HomeExtend: - spCaret = SelectionPosition( - pdoc->LineStart(pdoc->SciLineFromPosition(spCaret.Position()))); - break; - case Message::HomeDisplay: - case Message::HomeDisplayExtend: - spCaret = SelectionPosition(StartEndDisplayLine(spCaret.Position(), true)); - break; - case Message::HomeWrap: - case Message::HomeWrapExtend: - spCaret = MovePositionSoVisible(StartEndDisplayLine(spCaret.Position(), true), -1); - if (spCaretNow <= spCaret) - spCaret = SelectionPosition( - pdoc->LineStart(pdoc->SciLineFromPosition(spCaret.Position()))); - break; - case Message::VCHome: - case Message::VCHomeExtend: - // VCHome alternates between beginning of line and beginning of text so may move back or forwards - spCaret = SelectionPosition(pdoc->VCHomePosition(spCaret.Position())); - break; - case Message::VCHomeDisplay: - case Message::VCHomeDisplayExtend: - spCaret = SelectionPosition(VCHomeDisplayPosition(spCaret.Position())); - break; - case Message::VCHomeWrap: - case Message::VCHomeWrapExtend: - spCaret = SelectionPosition(VCHomeWrapPosition(spCaret.Position())); - break; - case Message::LineEnd: - case Message::LineEndExtend: - spCaret = SelectionPosition(pdoc->LineEndPosition(spCaret.Position())); - break; - case Message::LineEndDisplay: - case Message::LineEndDisplayExtend: - spCaret = SelectionPosition(StartEndDisplayLine(spCaret.Position(), false)); - break; - case Message::LineEndWrap: - case Message::LineEndWrapExtend: - spCaret = SelectionPosition(LineEndWrapPosition(spCaret.Position())); - break; - - default: - PLATFORM_ASSERT(false); - } - - const int directionMove = (spCaret < spCaretNow) ? -1 : 1; - spCaret = MovePositionSoVisible(spCaret, directionMove); - - // Handle move versus extend, and special behaviour for non-empty left/right - switch (iMessage) { - case Message::CharLeft: - case Message::CharRight: - if (sel.Range(r).Empty()) { - sel.Range(r) = SelectionRange(spCaret); - } else { - sel.Range(r) = SelectionRange( - (iMessage == Message::CharLeft) ? sel.Range(r).Start() : sel.Range(r).End()); - } - break; - - case Message::WordLeft: - case Message::WordRight: - case Message::WordLeftEnd: - case Message::WordRightEnd: - case Message::WordPartLeft: - case Message::WordPartRight: - case Message::Home: - case Message::HomeDisplay: - case Message::HomeWrap: - case Message::VCHome: - case Message::VCHomeDisplay: - case Message::VCHomeWrap: - case Message::LineEnd: - case Message::LineEndDisplay: - case Message::LineEndWrap: - sel.Range(r) = SelectionRange(spCaret); - break; - - case Message::CharLeftExtend: - case Message::CharRightExtend: - case Message::WordLeftExtend: - case Message::WordRightExtend: - case Message::WordLeftEndExtend: - case Message::WordRightEndExtend: - case Message::WordPartLeftExtend: - case Message::WordPartRightExtend: - case Message::HomeExtend: - case Message::HomeDisplayExtend: - case Message::HomeWrapExtend: - case Message::VCHomeExtend: - case Message::VCHomeDisplayExtend: - case Message::VCHomeWrapExtend: - case Message::LineEndExtend: - case Message::LineEndDisplayExtend: - case Message::LineEndWrapExtend: { - const SelectionRange rangeNew = SelectionRange(spCaret, sel.Range(r).anchor); - sel.TrimOtherSelections(r, SelectionRange(rangeNew)); - sel.Range(r) = rangeNew; - } - break; - - default: - PLATFORM_ASSERT(false); - } + sel.Range(r) = SelectionMove(iMessage, r); } } @@ -3797,10 +3774,10 @@ int Editor::DelWordOrLine(Message iMessage) { rangeDelete = Range(caretPosition, pdoc->NextWordEnd(caretPosition, 1)); break; case Message::DelLineLeft: - rangeDelete = Range(pdoc->LineStart(pdoc->SciLineFromPosition(caretPosition)), caretPosition); + rangeDelete = Range(pdoc->LineStartPosition(caretPosition), caretPosition); break; case Message::DelLineRight: - rangeDelete = Range(caretPosition, pdoc->LineEnd(pdoc->SciLineFromPosition(caretPosition))); + rangeDelete = Range(caretPosition, pdoc->LineEndPosition(caretPosition)); break; default: break; @@ -4620,7 +4597,7 @@ void Editor::WordSelection(Sci::Position pos) { // Extend forward to the word containing the character to the left of pos. // Skip ExtendWordSelect if the line is empty or if pos is the first position on the line. // This ensures that a series of empty lines isn't counted as a single "word". - if (pos > pdoc->LineStart(pdoc->SciLineFromPosition(pos))) + if (pos > pdoc->LineStartPosition(pos)) pos = pdoc->ExtendWordSelect(pdoc->MovePositionOutsideChar(pos - 1, -1), 1); TrimAndSetSelection(pos, wordSelectAnchorStartPos); } else { @@ -4654,8 +4631,7 @@ void Editor::MouseLeave() { } static constexpr bool AllowVirtualSpace(VirtualSpace virtualSpaceOptions, bool rectangular) noexcept { - return (!rectangular && (FlagSet(virtualSpaceOptions, VirtualSpace::UserAccessible))) - || (rectangular && (FlagSet(virtualSpaceOptions, VirtualSpace::RectangularSelection))); + return FlagSet(virtualSpaceOptions, (rectangular ? VirtualSpace::RectangularSelection : VirtualSpace::UserAccessible)); } void Editor::ButtonDownWithModifiers(Point pt, unsigned int curTime, KeyMod modifiers) { @@ -4734,7 +4710,7 @@ void Editor::ButtonDownWithModifiers(Point pt, unsigned int curTime, KeyMod modi } else { // Selecting backwards, or anchor beyond last character on line. In these cases, // we select the word containing the character to the *left* of the anchor. - if (charPos > pdoc->LineStart(pdoc->SciLineFromPosition(charPos))) { + if (charPos > pdoc->LineStartPosition(charPos)) { startWord = pdoc->ExtendWordSelect(charPos, -1); endWord = pdoc->ExtendWordSelect(startWord, 1); } else { @@ -5771,9 +5747,10 @@ Sci::Position Editor::GetTag(char *tagValue, int tagNumber) { return length; } -Sci::Position Editor::ReplaceTarget(ReplaceType replaceType, std::string_view text) { +Sci::Position Editor::ReplaceTarget(Message iMessage, uptr_t wParam, sptr_t lParam) { + std::string_view text = ViewFromParams(lParam, wParam); const UndoGroup ug(pdoc); - if (replaceType == ReplaceType::patterns) { + if (iMessage == Message::ReplaceTargetRE) { Sci::Position length = text.length(); const char *p = pdoc->SubstituteByPosition(text.data(), &length); if (!p) { @@ -5782,7 +5759,7 @@ Sci::Position Editor::ReplaceTarget(ReplaceType replaceType, std::string_view te text = std::string_view(p, length); } - if (replaceType == ReplaceType::minimal) { + if (iMessage == Message::ReplaceTargetMinimal) { // Check for prefix and suffix and reduce text and target to match. // This is performed with Range which doesn't support virtual space. Range range(targetRange.start.Position(), targetRange.end.Position()); @@ -6333,16 +6310,10 @@ sptr_t Editor::WndProc(Message iMessage, uptr_t wParam, sptr_t lParam) { } case Message::ReplaceTarget: - PLATFORM_ASSERT(lParam); - return ReplaceTarget(ReplaceType::basic, ViewFromParams(lParam, wParam)); - case Message::ReplaceTargetRE: - PLATFORM_ASSERT(lParam); - return ReplaceTarget(ReplaceType::patterns, ViewFromParams(lParam, wParam)); - case Message::ReplaceTargetMinimal: PLATFORM_ASSERT(lParam); - return ReplaceTarget(ReplaceType::minimal, ViewFromParams(lParam, wParam)); + return ReplaceTarget(iMessage, wParam, lParam); case Message::SearchInTarget: PLATFORM_ASSERT(lParam); diff --git a/scintilla/src/Editor.h b/scintilla/src/Editor.h index 70348cf42e..27c24a070e 100644 --- a/scintilla/src/Editor.h +++ b/scintilla/src/Editor.h @@ -483,7 +483,7 @@ class Editor : public EditModel, public DocWatcher { void NotifyModifyAttempt(Document *document, void *userData) noexcept override; void NotifySavePoint(Document *document, void *userData, bool atSavePoint) noexcept override; - void CheckModificationForWrap(DocModification mh); + void CheckModificationForShow(const DocModification &mh); void NotifyModified(Document *document, DocModification mh, void *userData) override; void NotifyDeleted(Document *document, void *userData) noexcept override; void NotifyStyleNeeded(Document *doc, void *userData, Sci::Position endStyleNeeded) override; @@ -507,9 +507,12 @@ class Editor : public EditModel, public DocWatcher { void ParaUpOrDown(int direction, Selection::SelTypes selt); Range RangeDisplayLine(Sci::Line lineVisible); Sci::Position StartEndDisplayLine(Sci::Position pos, bool start); + Sci::Position HomeWrapPosition(Sci::Position position); Sci::Position VCHomeDisplayPosition(Sci::Position position); Sci::Position VCHomeWrapPosition(Sci::Position position); Sci::Position LineEndWrapPosition(Sci::Position position); + SelectionPosition PositionMove(Scintilla::Message iMessage, SelectionPosition spCaretNow); + SelectionRange SelectionMove(Scintilla::Message iMessage, size_t r); int HorizontalMove(Scintilla::Message iMessage); int DelWordOrLine(Scintilla::Message iMessage); virtual int KeyCommand(Scintilla::Message iMessage); @@ -602,8 +605,7 @@ class Editor : public EditModel, public DocWatcher { void FoldAll(Scintilla::FoldAction action); Sci::Position GetTag(char *tagValue, int tagNumber); - enum class ReplaceType {basic, patterns, minimal}; - Sci::Position ReplaceTarget(ReplaceType replaceType, std::string_view text); + Sci::Position ReplaceTarget(Scintilla::Message iMessage, Scintilla::uptr_t wParam, Scintilla::sptr_t lParam); bool PositionIsHotspot(Sci::Position position) const noexcept; bool SCICALL PointIsHotspot(Point pt); diff --git a/scintilla/src/Geometry.h b/scintilla/src/Geometry.h index 5e119de3af..2d5769775c 100644 --- a/scintilla/src/Geometry.h +++ b/scintilla/src/Geometry.h @@ -208,13 +208,18 @@ PRectangle PixelAlignOutside(PRectangle rc, int pixelDivisions) noexcept; /** * Holds an RGBA colour with 8 bits for each component. */ -constexpr float componentMaximum = 255.0f; +constexpr float componentMaximum = 255.0F; +constexpr unsigned int maximumByte = 0xffU; class ColourRGBA final { unsigned int co; + static constexpr float ComponentAsFloat(int component) noexcept { + return component / componentMaximum; + } + static constexpr int rgbMask = 0xffffff; public: constexpr explicit ColourRGBA(unsigned int co_ = 0) noexcept : co(co_) {} - constexpr ColourRGBA(unsigned int red, unsigned int green, unsigned int blue, unsigned int alpha = 0xff) noexcept : + constexpr ColourRGBA(unsigned int red, unsigned int green, unsigned int blue, unsigned int alpha = maximumByte) noexcept : ColourRGBA(red | (green << 8) | (blue << 16) | (alpha << 24)) { } @@ -223,19 +228,19 @@ class ColourRGBA final { } static constexpr ColourRGBA FromRGB(unsigned int co_) noexcept { - return ColourRGBA(co_ | (0xffu << 24)); + return ColourRGBA(co_ | (maximumByte << 24)); } static constexpr ColourRGBA FromIpRGB(intptr_t co_) noexcept { - return ColourRGBA(static_cast(co_) | (0xffu << 24)); + return ColourRGBA(static_cast(co_) | (maximumByte << 24)); } constexpr ColourRGBA WithoutAlpha() const noexcept { - return ColourRGBA(co & 0xffffff); + return ColourRGBA(co & rgbMask); } constexpr ColourRGBA Opaque() const noexcept { - return ColourRGBA(co | (0xffu << 24)); + return ColourRGBA(co | (maximumByte << 24)); } constexpr unsigned int AsInteger() const noexcept { @@ -243,18 +248,18 @@ class ColourRGBA final { } constexpr unsigned int OpaqueRGB() const noexcept { - return co & 0xffffff; + return co & rgbMask; } // Red, green, blue and alpha values as bytes 0..255 constexpr unsigned char GetRed() const noexcept { - return co & 0xffu; + return co & maximumByte; } constexpr unsigned char GetGreen() const noexcept { - return (co >> 8) & 0xffu; + return (co >> 8) & maximumByte; } constexpr unsigned char GetBlue() const noexcept { - return (co >> 16) & 0xffu; + return (co >> 16) & maximumByte; } constexpr unsigned char GetAlpha() const noexcept { return co >> 24; @@ -262,16 +267,16 @@ class ColourRGBA final { // Red, green, blue, and alpha values as float 0..1.0 constexpr float GetRedComponent() const noexcept { - return GetRed() / componentMaximum; + return ComponentAsFloat(GetRed()); } constexpr float GetGreenComponent() const noexcept { - return GetGreen() / componentMaximum; + return ComponentAsFloat(GetGreen()); } constexpr float GetBlueComponent() const noexcept { - return GetBlue() / componentMaximum; + return ComponentAsFloat(GetBlue()); } constexpr float GetAlphaComponent() const noexcept { - return GetAlpha() / componentMaximum; + return ComponentAsFloat(GetAlpha()); } constexpr bool operator==(const ColourRGBA &other) const noexcept { @@ -321,6 +326,9 @@ class ColourRGBA final { } }; +constexpr ColourRGBA white(maximumByte, maximumByte, maximumByte); +constexpr ColourRGBA black(0x0, 0x0, 0x0); + /** * Holds an RGBA colour and stroke width to stroke a shape. */ diff --git a/scintilla/src/Indicator.h b/scintilla/src/Indicator.h index 83e012d456..7600093aa8 100644 --- a/scintilla/src/Indicator.h +++ b/scintilla/src/Indicator.h @@ -11,8 +11,8 @@ namespace Scintilla::Internal { struct StyleAndColour { Scintilla::IndicatorStyle style; ColourRGBA fore; - constexpr StyleAndColour() noexcept : style(Scintilla::IndicatorStyle::Plain), fore(0, 0, 0) {} - constexpr StyleAndColour(Scintilla::IndicatorStyle style_, ColourRGBA fore_ = ColourRGBA(0, 0, 0)) noexcept : style(style_), fore(fore_) {} + constexpr StyleAndColour() noexcept : style(Scintilla::IndicatorStyle::Plain), fore(black) {} + constexpr StyleAndColour(Scintilla::IndicatorStyle style_, ColourRGBA fore_ = black) noexcept : style(style_), fore(fore_) {} bool operator==(const StyleAndColour &other) const noexcept { return (style == other.style) && (fore == other.fore); } @@ -33,7 +33,7 @@ class Indicator { Scintilla::IndicFlag attributes; XYPOSITION strokeWidth = 1.0f; constexpr Indicator() noexcept : under(false), fillAlpha(30), outlineAlpha(50), attributes(Scintilla::IndicFlag::None) {} - constexpr Indicator(Scintilla::IndicatorStyle style_, ColourRGBA fore_ = ColourRGBA(0, 0, 0), bool under_ = false, int fillAlpha_ = 30, int outlineAlpha_ = 50) noexcept : + constexpr Indicator(Scintilla::IndicatorStyle style_, ColourRGBA fore_ = black, bool under_ = false, int fillAlpha_ = 30, int outlineAlpha_ = 50) noexcept : sacNormal(style_, fore_), sacHover(style_, fore_), under(under_), fillAlpha(fillAlpha_), outlineAlpha(outlineAlpha_), attributes(Scintilla::IndicFlag::None) {} void SCICALL Draw(Surface *surface, PRectangle rc, PRectangle rcLine, PRectangle rcCharacter, State state, int value) const; bool IsDynamic() const noexcept { diff --git a/scintilla/src/LineMarker.h b/scintilla/src/LineMarker.h index beb957b297..5a419d428c 100644 --- a/scintilla/src/LineMarker.h +++ b/scintilla/src/LineMarker.h @@ -15,8 +15,8 @@ typedef void (*DrawLineMarkerFn)(Surface *surface, PRectangle rcWhole, const Fon struct LineMarkerPod { Scintilla::MarkerSymbol markType = Scintilla::MarkerSymbol::Circle; - ColourRGBA fore = ColourRGBA(0, 0, 0); - ColourRGBA back = ColourRGBA(0xff, 0xff, 0xff); + ColourRGBA fore = black; + ColourRGBA back = white; ColourRGBA backSelected = ColourRGBA(0xff, 0x00, 0x00); Scintilla::Layer layer = Scintilla::Layer::Base; XYPOSITION strokeWidth = 1.0f; diff --git a/scintilla/src/MarginView.cxx b/scintilla/src/MarginView.cxx index 11f8da2dad..afa6c84501 100644 --- a/scintilla/src/MarginView.cxx +++ b/scintilla/src/MarginView.cxx @@ -137,7 +137,7 @@ void MarginView::RefreshPixMaps(Surface *surfaceWindow, const ViewStyle &vsDraw) ColourRGBA colourFMFill = vsDraw.selbar; ColourRGBA colourFMStripes = vsDraw.selbarlight; - if (!(vsDraw.selbarlight == ColourRGBA(0xff, 0xff, 0xff))) { + if (!(vsDraw.selbarlight == white)) { // User has chosen an unusual chrome colour scheme so just use the highlight edge colour. // (Typically, the highlight colour is white.) colourFMFill = vsDraw.selbarlight; diff --git a/scintilla/src/PositionCache.cxx b/scintilla/src/PositionCache.cxx index 6f9eef03e7..45aa17e46e 100644 --- a/scintilla/src/PositionCache.cxx +++ b/scintilla/src/PositionCache.cxx @@ -562,7 +562,7 @@ bool SignificantLines::LineMayCache(Sci::Line line) const noexcept { LineLayoutCache::LineLayoutCache() noexcept: lastCaretSlot(SIZE_MAX), level(LineCache::None), - allInvalidated(false), styleClock(-1) { + maxValidity(LineLayout::ValidLevel::invalid), styleClock(-1) { } LineLayoutCache::~LineLayoutCache() = default; @@ -703,7 +703,7 @@ void LineLayoutCache::AllocateForLevel(Sci::Line linesOnScreen, Sci::Line linesI lengthForLevel = NP2_align_up(linesInDoc, 64); } if (lengthForLevel != shortCache.size()) { - allInvalidated = false; + maxValidity = LineLayout::ValidLevel::lines; shortCache.resize(lengthForLevel); //printf("%s level=%d, size=%zu/%zu, LineLayout=%zu/%zu, BidiData=%zu, XYPOSITION=%zu\n", // __func__, level, shortCache.size(), shortCache.capacity(), sizeof(LineLayout), @@ -713,13 +713,15 @@ void LineLayoutCache::AllocateForLevel(Sci::Line linesOnScreen, Sci::Line linesI } void LineLayoutCache::Deallocate() noexcept { + maxValidity = LineLayout::ValidLevel::invalid; + lastCaretSlot = SIZE_MAX; shortCache.clear(); longCache.clear(); - lastCaretSlot = SIZE_MAX; } void LineLayoutCache::Invalidate(LineLayout::ValidLevel validity_) noexcept { - if (!allInvalidated) { + if (maxValidity > validity_) { + maxValidity = validity_; for (const auto &ll : shortCache) { if (ll) { ll->Invalidate(validity_); @@ -730,19 +732,16 @@ void LineLayoutCache::Invalidate(LineLayout::ValidLevel validity_) noexcept { ll->Invalidate(validity_); } } - if (validity_ == LineLayout::ValidLevel::invalid) { - allInvalidated = true; - } } } void LineLayoutCache::SetLevel(LineCache level_) noexcept { if (level != level_) { level = level_; - allInvalidated = false; + maxValidity = LineLayout::ValidLevel::invalid; + lastCaretSlot = SIZE_MAX; shortCache.clear(); longCache.clear(); - lastCaretSlot = SIZE_MAX; } } @@ -753,7 +752,7 @@ LineLayout *LineLayoutCache::Retrieve(Sci::Line lineNumber, Sci::Line lineCaret, Invalidate(LineLayout::ValidLevel::checkTextAndStyle); styleClock = styleClock_; } - allInvalidated = false; + maxValidity = LineLayout::ValidLevel::lines; size_t pos = 0; LineLayout *ret = nullptr; diff --git a/scintilla/src/PositionCache.h b/scintilla/src/PositionCache.h index fec0e37539..4f5aeb9cb2 100644 --- a/scintilla/src/PositionCache.h +++ b/scintilla/src/PositionCache.h @@ -168,7 +168,7 @@ class LineLayoutCache final { std::vector> longCache; size_t lastCaretSlot; Scintilla::LineCache level; - bool allInvalidated; + LineLayout::ValidLevel maxValidity; int styleClock; void AllocateForLevel(Sci::Line linesOnScreen, Sci::Line linesInDoc); public: diff --git a/scintilla/src/RESearch.cxx b/scintilla/src/RESearch.cxx index 7ae77df65d..74656b09e2 100644 --- a/scintilla/src/RESearch.cxx +++ b/scintilla/src/RESearch.cxx @@ -223,6 +223,7 @@ using namespace Scintilla::Internal; #define OKP 1 #define NOP 0 +#define END 0 #define CHR 1 #define ANY 2 #define CCL 3 @@ -237,8 +238,6 @@ using namespace Scintilla::Internal; #define CLQ 12 /* 0 to 1 closure */ #define LCLO 13 /* lazy closure */ -#define END 0 - /* * The following defines are not meant to be changeable. * They are for readability only. @@ -265,10 +264,8 @@ RESearch::RESearch(const CharClassify *charClassTable) { lineEndPos = 0; sta = NOP; /* status of lastpat */ previousFlags = FindOption::None; - constexpr unsigned char nul = 0; - std::fill(bittab, std::end(bittab), nul); - std::fill(tagstk, std::end(tagstk), 0); - std::fill(nfa, std::end(nfa), '\0'); + memset(nfa, 0, 4); + memset(bittab, 0, BITBLK); Clear(); } @@ -437,12 +434,15 @@ const char *RESearch::Compile(const char *pattern, size_t length, FindOption fla } const char *RESearch::DoCompile(const char *pattern, size_t length, FindOption flags) noexcept { + memset(nfa, 0, 4); + memset(bittab, 0, BITBLK); const bool caseSensitive = FlagSet(flags, FindOption::MatchCase); const bool posix = FlagSet(flags, FindOption::Posix); char *mp = nfa; /* nfa pointer */ - char *sp = nfa; /* another one */ - const char *mpMax = mp + MAXNFA - BITBLK - 10; + char *sp = nfa; /* another saved pointer */ + const char * const mpMax = mp + MAXNFA - BITBLK - 10; + int tagstk[MAXTAG]{}; /* subpat tag stack */ int tagi = 0; /* tag stack index */ int tagc = 1; /* actual tag count */ @@ -469,7 +469,7 @@ const char *RESearch::DoCompile(const char *pattern, size_t length, FindOption f break; case '$': /* match endofline */ - if (!*(p + 1)) { + if (!p[1]) { *mp++ = EOL; } else { *mp++ = CHR; @@ -478,13 +478,13 @@ const char *RESearch::DoCompile(const char *pattern, size_t length, FindOption f break; case '[': { /* match char class */ - *mp++ = CCL; int prevChar = 0; - char mask = 0; /* xor mask -CCL/NCL */ + bool negative = false; /* xor mask -CCL/NCL */ i++; - if (*++p == '^') { - mask = '\377'; + ++p; + if (*p == '^') { + negative = true; i++; p++; } @@ -507,13 +507,14 @@ const char *RESearch::DoCompile(const char *pattern, size_t length, FindOption f // Previous def. was a char class like \d, take dash literally prevChar = '-'; ChSet('-'); - } else if (*(p + 1)) { - if (*(p + 1) != ']') { + } else if (p[1]) { + if (p[1] != ']') { int c1 = prevChar + 1; i++; - int c2 = static_cast(*++p); + ++p; + int c2 = static_cast(*p); if (c2 == '\\') { - if (!*(p + 1)) { // End of RE + if (!p[1]) { // End of RE return badpat("Missing ]"); } else { i++; @@ -550,7 +551,7 @@ const char *RESearch::DoCompile(const char *pattern, size_t length, FindOption f } else { return badpat("Missing ]"); } - } else if (*p == '\\' && *(p + 1)) { + } else if (*p == '\\' && p[1]) { i++; p++; int incr; @@ -575,30 +576,30 @@ const char *RESearch::DoCompile(const char *pattern, size_t length, FindOption f if (!*p) return badpat("Missing ]"); - for (int n = 0; n < BITBLK; bittab[n++] = 0) { - *mp++ = static_cast(mask ^ bittab[n]); + if (negative) { + size_t * const ptr = reinterpret_cast(bittab); + for (unsigned n = 0; n < BITBLK / sizeof(size_t); n++) { + ptr[n] = ~ptr[n]; + } } + + *mp++ = CCL; + memcpy(mp, bittab, BITBLK); + memset(bittab, 0, BITBLK); + mp += BITBLK; } break; case '*': /* match 0 or more... */ case '+': /* match 1 or more... */ - case '?': + case '?': { if (p == pattern) return badpat("Empty closure"); lp = sp; /* previous opcode */ - if (*lp == CLO || *lp == LCLO) /* equivalence... */ + const uint8_t opcode = *sp; + if (opcode == CLO || opcode == LCLO) /* equivalence... */ break; - switch (*lp) { - - case BOL: - case BOT: - case EOT: - case BOW: - case EOW: - case REF: + if ((opcode >= BOL && opcode <= REF) && opcode != EOL) { return badpat("Illegal closure"); - default: - break; } if (*p == '+') { @@ -614,15 +615,16 @@ const char *RESearch::DoCompile(const char *pattern, size_t length, FindOption f *mp = mp[-1]; } if (*p == '?') *mp = CLQ; - else if (*(p + 1) == '?') *mp = LCLO; + else if (p[1] == '?') *mp = LCLO; else *mp = CLO; mp = sp; - break; + } break; case '\\': /* tags, backrefs... */ i++; - switch (*++p) { + ++p; + switch (*p) { case '<': *mp++ = BOW; break; @@ -678,10 +680,9 @@ const char *RESearch::DoCompile(const char *pattern, size_t length, FindOption f *mp++ = static_cast(c); } else { *mp++ = CCL; - constexpr char mask = 0; - for (int n = 0; n < BITBLK; bittab[n++] = 0) { - *mp++ = static_cast(mask ^ bittab[n]); - } + memcpy(mp, bittab, BITBLK); + memset(bittab, 0, BITBLK); + mp += BITBLK; } } } @@ -713,12 +714,11 @@ const char *RESearch::DoCompile(const char *pattern, size_t length, FindOption f *mp++ = CHR; *mp++ = static_cast(c); } else { - *mp++ = CCL; ChSetWithCase(c, false); - constexpr char mask = 0; - for (int n = 0; n < BITBLK; bittab[n++] = 0) { - *mp++ = static_cast(mask ^ bittab[n]); - } + *mp++ = CCL; + memcpy(mp, bittab, BITBLK); + memset(bittab, 0, BITBLK); + mp += BITBLK; } } break; diff --git a/scintilla/src/RESearch.h b/scintilla/src/RESearch.h index 0a8359b145..2518427738 100644 --- a/scintilla/src/RESearch.h +++ b/scintilla/src/RESearch.h @@ -22,6 +22,10 @@ class RESearch { void Clear() noexcept; const char *Compile(const char *pattern, size_t length, Scintilla::FindOption flags); int Execute(const CharacterIndexer &ci, Sci::Position lp, Sci::Position endp); + void SetLineRange(Sci::Position startPos, Sci::Position endPos) noexcept { + lineStartPos = startPos; + lineEndPos = endPos; + } static constexpr int MAXTAG = 10; static constexpr int NOTFOUND = -1; @@ -30,10 +34,6 @@ class RESearch { MatchPositions bopat; MatchPositions eopat; - // positions to match line start and line end - Sci::Position lineStartPos; - Sci::Position lineEndPos; - private: static constexpr int MAXNFA = 4096; // The following constants are not meant to be changeable. @@ -48,7 +48,9 @@ class RESearch { const char *DoCompile(const char *pattern, size_t length, Scintilla::FindOption flags) noexcept; Sci::Position PMatch(const CharacterIndexer &ci, Sci::Position lp, Sci::Position endp, const char *ap); - Sci::Position tagstk[MAXTAG]; /* subpat tag stack */ + // positions to match line start and line end + Sci::Position lineStartPos; + Sci::Position lineEndPos; char nfa[MAXNFA]; /* automaton */ int sta; diff --git a/scintilla/src/ScintillaBase.cxx b/scintilla/src/ScintillaBase.cxx index fb351434be..5f91d74895 100644 --- a/scintilla/src/ScintillaBase.cxx +++ b/scintilla/src/ScintillaBase.cxx @@ -863,10 +863,7 @@ const char *LexState::DescriptionOfStyle(int style) const noexcept { void ScintillaBase::NotifyStyleToNeeded(Sci::Position endStyleNeeded) { if (!DocumentLexState()->UseContainerLexing()) { - const Sci::Line lineEndStyled = - pdoc->SciLineFromPosition(pdoc->GetEndStyled()); - const Sci::Position endStyled = - pdoc->LineStart(lineEndStyled); + const Sci::Line endStyled = pdoc->LineStartPosition(pdoc->GetEndStyled()); DocumentLexState()->Colourise(endStyled, endStyleNeeded); return; } diff --git a/scintilla/src/ScintillaBase.h b/scintilla/src/ScintillaBase.h index 7b7113870d..3c36f10cc9 100644 --- a/scintilla/src/ScintillaBase.h +++ b/scintilla/src/ScintillaBase.h @@ -10,6 +10,10 @@ namespace Scintilla::Internal { #define SCI_EnablePopupMenu 0 +// For most platforms (not Cocoa) all IME indicators are drawn in same colour, +// blue, with different patterns. +constexpr ColourRGBA colourIME(0x0, 0x0, 0xffU); + class LexState; /** diff --git a/scintilla/src/Selection.h b/scintilla/src/Selection.h index b74f96e47a..0358bd9f43 100644 --- a/scintilla/src/Selection.h +++ b/scintilla/src/Selection.h @@ -47,6 +47,9 @@ class SelectionPosition { void Add(Sci::Position increment) noexcept { position = position + increment; } + void AddVirtualSpace(Sci::Position increment) noexcept { + SetVirtualSpace(virtualSpace + increment); + } bool IsValid() const noexcept { return position >= 0; } diff --git a/scintilla/src/Style.h b/scintilla/src/Style.h index c674646a2b..6f3420b330 100644 --- a/scintilla/src/Style.h +++ b/scintilla/src/Style.h @@ -38,8 +38,8 @@ constexpr size_t maxInvisibleStyleRepresentationLength = 6; // used to optimize style copy. struct StylePod { - ColourRGBA fore = ColourRGBA(0, 0, 0); - ColourRGBA back = ColourRGBA(0xff, 0xff, 0xff); + ColourRGBA fore = black; + ColourRGBA back = white; bool eolFilled = false; bool underline = false; bool strike = false; diff --git a/scintilla/src/ViewStyle.cxx b/scintilla/src/ViewStyle.cxx index 528f0928d1..c11e7d84d9 100644 --- a/scintilla/src/ViewStyle.cxx +++ b/scintilla/src/ViewStyle.cxx @@ -164,10 +164,10 @@ ViewStyle::ViewStyle(size_t stylesSize_): controlCharWidth = 0; selbar = Platform::Chrome(); selbarlight = Platform::ChromeHighlight(); - styles[StyleLineNumber].fore = ColourRGBA(0, 0, 0); + styles[StyleLineNumber].fore = black; styles[StyleLineNumber].back = Platform::Chrome(); - elementBaseColours[Element::Caret] = ColourRGBA(0, 0, 0); + elementBaseColours[Element::Caret] = black; elementBaseColours[Element::CaretAdditional] = ColourRGBA(0x7f, 0x7f, 0x7f); elementColours.erase(Element::CaretLineBack); @@ -448,7 +448,7 @@ void ViewStyle::ClearStyles() noexcept { styles[StyleLineNumber].back = Platform::Chrome(); // Set call tip fore/back to match the values previously set for call tips - styles[StyleCallTip].back = ColourRGBA(0xff, 0xff, 0xff); + styles[StyleCallTip].back = white; styles[StyleCallTip].fore = ColourRGBA(0x80, 0x80, 0x80); } @@ -631,8 +631,7 @@ ColourRGBA ViewStyle::ElementColourForced(Element element) const { // This method avoids warnings for unwrapping potentially empty optionals from // Visual C++ Code Analysis const ColourOptional colour = ElementColour(element); - constexpr ColourRGBA opaqueBlack(0, 0, 0, 0xff); - return colour.value_or(opaqueBlack); + return colour.value_or(black); } bool ViewStyle::ResetElement(Element element) { @@ -700,8 +699,7 @@ bool ViewStyle::SetWrapIndentMode(WrapIndentMode wrapIndentMode_) noexcept { bool ViewStyle::IsBlockCaretStyle() const noexcept { return ((caret.style & CaretStyle::InsMask) == CaretStyle::Block) || - FlagSet(caret.style, CaretStyle::OverstrikeBlock) || - FlagSet(caret.style, CaretStyle::Curses); + FlagSet(caret.style, (CaretStyle::OverstrikeBlock | CaretStyle::Curses)); } bool ViewStyle::IsCaretVisible(bool isMainSelection) const noexcept { diff --git a/scintilla/src/XPM.cxx b/scintilla/src/XPM.cxx index d6203d4689..118b997916 100644 --- a/scintilla/src/XPM.cxx +++ b/scintilla/src/XPM.cxx @@ -118,7 +118,7 @@ void XPM::Init(const char *const *linesForm) { if (!linesForm) return; - std::fill(colourCodeTable, std::end(colourCodeTable), ColourRGBA(0, 0, 0, 0)); + std::fill(colourCodeTable, std::end(colourCodeTable), black); const char *line0 = linesForm[0]; width = atoi(line0); line0 = NextField(line0); diff --git a/scintilla/win32/ScintillaWin.cxx b/scintilla/win32/ScintillaWin.cxx index ae296c4260..66d1dfffc6 100644 --- a/scintilla/win32/ScintillaWin.cxx +++ b/scintilla/win32/ScintillaWin.cxx @@ -713,10 +713,10 @@ ScintillaWin::ScintillaWin(HWND hwnd) noexcept { SetCoalescableTimerFn = DLLFunctionEx(L"user32.dll", "SetCoalescableTimer"); #endif - vs.indicators[IndicatorUnknown] = Indicator(IndicatorStyle::Hidden, ColourRGBA(0, 0, 0xff)); - vs.indicators[IndicatorInput] = Indicator(IndicatorStyle::Dots, ColourRGBA(0, 0, 0xff)); - vs.indicators[IndicatorConverted] = Indicator(IndicatorStyle::CompositionThick, ColourRGBA(0, 0, 0xff)); - vs.indicators[IndicatorTarget] = Indicator(IndicatorStyle::StraightBox, ColourRGBA(0, 0, 0xff)); + vs.indicators[IndicatorUnknown] = Indicator(IndicatorStyle::Hidden, colourIME); + vs.indicators[IndicatorInput] = Indicator(IndicatorStyle::Dots, colourIME); + vs.indicators[IndicatorConverted] = Indicator(IndicatorStyle::CompositionThick, colourIME); + vs.indicators[IndicatorTarget] = Indicator(IndicatorStyle::StraightBox, colourIME); } ScintillaWin::~ScintillaWin() { @@ -1433,7 +1433,7 @@ bool ScintillaWin::HandleLaTeXTabCompletion() { targetRange.start.SetPosition(pos); targetRange.end.SetPosition(main); - ReplaceTarget(ReplaceType::basic, std::string_view(buffer, len)); + ReplaceTarget(Message::ReplaceTarget, len, reinterpret_cast(buffer)); // move caret after character SetEmptySelection(pos + len); return true; @@ -2351,6 +2351,7 @@ sptr_t ScintillaWin::WndProc(Message iMessage, uptr_t wParam, sptr_t lParam) { case WM_SETREDRAW: ::DefWindowProc(MainHWND(), msg, wParam, lParam); if (wParam) { + SetIdleTaskTime(IdleLineWrapTime); SetScrollBars(); SetVerticalScrollPos(); SetHorizontalScrollPos(); @@ -3389,7 +3390,7 @@ LRESULT ScintillaWin::ImeOnReconvert(LPARAM lParam) { } else { // Ensure docCompStart+docCompLen be not beyond lineEnd. // since docCompLen by byte might break eol. - const Sci::Position lineEnd = pdoc->LineEnd(pdoc->SciLineFromPosition(rBase)); + const Sci::Position lineEnd = pdoc->LineEndPosition(rBase); const Sci::Position overflow = (docCompStart + docCompLen) - lineEnd; if (overflow > 0) { pdoc->DeleteChars(docCompStart, docCompLen - overflow); diff --git a/src/Dialogs.c b/src/Dialogs.c index 407ea7e486..d4109ff124 100644 --- a/src/Dialogs.c +++ b/src/Dialogs.c @@ -1208,7 +1208,7 @@ static INT_PTR CALLBACK FileMRUDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPAR } } else if (pnmhdr->idFrom == IDC_EMPTY_MRU) { if ((pnmhdr->code == NM_CLICK || pnmhdr->code == NM_RETURN)) { - MRU_Empty(pFileMRU); + MRU_Empty(pFileMRU, false); if (StrNotEmpty(szCurFile)) { MRU_Add(pFileMRU, szCurFile); } @@ -1237,12 +1237,10 @@ static INT_PTR CALLBACK FileMRUDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPAR SHGFI_USEFILEATTRIBUTES | SHGFI_SMALLICON | SHGFI_SYSICONINDEX); lvi.iImage = shfi.iIcon; - WCHAR tch[MAX_PATH]; - for (int i = 0; i < MRU_GetCount(pFileMRU); i++) { - MRU_Enum(pFileMRU, i, tch, COUNTOF(tch)); - PathAbsoluteFromApp(tch, tch, true); + for (int i = 0; i < pFileMRU->iSize; i++) { + LPWSTR path = pFileMRU->pszItems[i]; lvi.iItem = i; - lvi.pszText = tch; + lvi.pszText = path; ListView_InsertItem(hwndLV, &lvi); } diff --git a/src/Edit.c b/src/Edit.c index 4d73736219..15e3a39f7c 100644 --- a/src/Edit.c +++ b/src/Edit.c @@ -4776,10 +4776,7 @@ static INT_PTR CALLBACK EditFindReplaceDlgProc(HWND hwnd, UINT umsg, WPARAM wPar AddBackslashComboBoxSetup(hwnd, IDC_FINDTEXT); // Load MRUs - for (int i = 0; i < MRU_GetCount(mruFind); i++) { - MRU_Enum(mruFind, i, tch, COUNTOF(tch)); - ComboBox_AddString(hwndFind, tch); - } + MRU_AddToCombobox(mruFind, hwndFind); LPEDITFINDREPLACE lpefr = (LPEDITFINDREPLACE)lParam; // don't copy selection after toggle find & replace on this window. @@ -4797,11 +4794,7 @@ static INT_PTR CALLBACK EditFindReplaceDlgProc(HWND hwnd, UINT umsg, WPARAM wPar HWND hwndRepl = GetDlgItem(hwnd, IDC_REPLACETEXT); if (hwndRepl) { AddBackslashComboBoxSetup(hwnd, IDC_REPLACETEXT); - for (int i = 0; i < MRU_GetCount(mruReplace); i++) { - MRU_Enum(mruReplace, i, tch, COUNTOF(tch)); - ComboBox_AddString(hwndRepl, tch); - } - + MRU_AddToCombobox(mruReplace, hwndRepl); ComboBox_LimitText(hwndRepl, NP2_FIND_REPLACE_LIMIT); ComboBox_SetExtendedUI(hwndRepl, TRUE); SetDlgItemTextA2W(CP_UTF8, hwnd, IDC_REPLACETEXT, lpefr->szReplaceUTF8); @@ -5077,16 +5070,8 @@ static INT_PTR CALLBACK EditFindReplaceDlgProc(HWND hwnd, UINT umsg, WPARAM wPar // Reload MRUs ComboBox_ResetContent(hwndFind); ComboBox_ResetContent(hwndRepl); - - for (int i = 0; i < MRU_GetCount(mruFind); i++) { - MRU_Enum(mruFind, i, tch, COUNTOF(tch)); - ComboBox_AddString(hwndFind, tch); - } - - for (int i = 0; i < MRU_GetCount(mruReplace); i++) { - MRU_Enum(mruReplace, i, tch, COUNTOF(tch)); - ComboBox_AddString(hwndRepl, tch); - } + MRU_AddToCombobox(mruFind, hwndFind); + MRU_AddToCombobox(mruReplace, hwndRepl); SetDlgItemTextA2W(CP_UTF8, hwnd, IDC_FINDTEXT, lpefr->szFindUTF8); SetDlgItemTextA2W(CP_UTF8, hwnd, IDC_REPLACETEXT, lpefr->szReplaceUTF8); @@ -5227,26 +5212,16 @@ static INT_PTR CALLBACK EditFindReplaceDlgProc(HWND hwnd, UINT umsg, WPARAM wPar //ShowNotificationMessage(SC_NOTIFICATIONPOSITION_CENTER, IDS_WILDCARDHELP); break; - case IDC_CLEAR_FIND: { - HWND hwndFind = GetDlgItem(hwnd, IDC_FINDTEXT); + case IDC_CLEAR_FIND: + case IDC_CLEAR_REPLACE: { + HWND hwndFind = GetDlgItem(hwnd, (pnmhdr->idFrom == IDC_CLEAR_FIND) ? IDC_FINDTEXT : IDC_REPLACETEXT); ComboBox_GetText(hwndFind, tch, COUNTOF(tch)); ComboBox_ResetContent(hwndFind); - MRU_Empty(mruFind); - MRU_Save(mruFind); + MRU_Empty((pnmhdr->idFrom == IDC_CLEAR_FIND) ? mruFind : mruReplace, true); ComboBox_SetText(hwndFind, tch); } break; - case IDC_CLEAR_REPLACE: { - HWND hwndRepl = GetDlgItem(hwnd, IDC_REPLACETEXT); - ComboBox_GetText(hwndRepl, tch, COUNTOF(tch)); - ComboBox_ResetContent(hwndRepl); - MRU_Empty(mruReplace); - MRU_Save(mruReplace); - ComboBox_SetText(hwndRepl, tch); - } - break; - case IDC_SAVEPOSITION: GetDlgPos(hwnd, &xFindReplaceDlg, &yFindReplaceDlg); break; @@ -5867,6 +5842,10 @@ bool EditReplaceAll(HWND hwnd, LPCEDITFINDREPLACE lpefr, bool bShowInfo) { // Show wait cursor... BeginWaitCursor(); SendMessage(hwnd, WM_SETREDRAW, FALSE, 0); +#if 0 + StopWatch watch; + StopWatch_Start(watch); +#endif const bool bRegexStartOfLine = bReplaceRE && (szFind2[0] == '^'); struct Sci_TextToFindFull ttf = { { 0, SciCall_GetLength() }, szFind2, { 0, 0 } }; @@ -5880,7 +5859,8 @@ bool EditReplaceAll(HWND hwnd, LPCEDITFINDREPLACE lpefr, bool bShowInfo) { const Sci_Position iReplacedLen = SciCall_ReplaceTargetEx(bReplaceRE, -1, pszReplace2); ttf.chrg.cpMin = (ttf.chrgText.cpMin + iReplacedLen); - ttf.chrg.cpMax = SciCall_GetLength(); + // document length change: iReplacedLen - (ttf.chrgText.cpMax - ttf.chrgText.cpMin) + ttf.chrg.cpMax += ttf.chrg.cpMin - ttf.chrgText.cpMax; if (ttf.chrg.cpMin == ttf.chrg.cpMax) { break; @@ -5904,6 +5884,10 @@ bool EditReplaceAll(HWND hwnd, LPCEDITFINDREPLACE lpefr, bool bShowInfo) { } } +#if 0 + StopWatch_Stop(watch); + StopWatch_ShowLog(&watch, "EditReplaceAll() time"); +#endif SendMessage(hwnd, WM_SETREDRAW, TRUE, 0); if (iCount) { EditEnsureSelectionVisible(); @@ -5947,9 +5931,8 @@ bool EditReplaceAllInSelection(HWND hwnd, LPCEDITFINDREPLACE lpefr, bool bShowIn const bool bRegexStartOfLine = bReplaceRE && (szFind2[0] == '^'); struct Sci_TextToFindFull ttf = { { SciCall_GetSelectionStart(), SciCall_GetLength() }, szFind2, { 0, 0 } }; Sci_Position iCount = 0; - bool fCancel = false; - while (!fCancel && SciCall_FindTextFull(searchFlags, &ttf) >= 0) { - if (ttf.chrgText.cpMin >= SciCall_GetSelectionStart() && ttf.chrgText.cpMax <= SciCall_GetSelectionEnd()) { + while (SciCall_FindTextFull(searchFlags, &ttf) >= 0) { + if (ttf.chrgText.cpMax <= SciCall_GetSelectionEnd()) { if (++iCount == 1) { SciCall_BeginUndoAction(); } @@ -5958,10 +5941,11 @@ bool EditReplaceAllInSelection(HWND hwnd, LPCEDITFINDREPLACE lpefr, bool bShowIn const Sci_Position iReplacedLen = SciCall_ReplaceTargetEx(bReplaceRE, -1, pszReplace2); ttf.chrg.cpMin = (ttf.chrgText.cpMin + iReplacedLen); - ttf.chrg.cpMax = SciCall_GetLength(); + // document length change: iReplacedLen - (ttf.chrgText.cpMax - ttf.chrgText.cpMin) + ttf.chrg.cpMax += ttf.chrg.cpMin - ttf.chrgText.cpMax; if (ttf.chrg.cpMin == ttf.chrg.cpMax) { - fCancel = true; + break; } if (ttf.chrgText.cpMin == ttf.chrgText.cpMax && !bRegexStartOfLine) { @@ -5981,14 +5965,14 @@ bool EditReplaceAllInSelection(HWND hwnd, LPCEDITFINDREPLACE lpefr, bool bShowIn } } } else { // gone across selection, cancel - fCancel = true; + break; } } SendMessage(hwnd, WM_SETREDRAW, TRUE, 0); if (iCount) { const Sci_Position iPos = SciCall_GetTargetEnd(); - if (SciCall_GetSelectionEnd() < iPos) { + if (SciCall_GetSelectionEnd() < iPos) { Sci_Position iAnchorPos = SciCall_GetAnchor(); Sci_Position iCurrentPos = SciCall_GetCurrentPos(); diff --git a/src/EditAutoC.c b/src/EditAutoC.c index 2b8ca8df46..44e40842b9 100644 --- a/src/EditAutoC.c +++ b/src/EditAutoC.c @@ -17,7 +17,7 @@ #include "EditAutoC_Data0.h" #include "LaTeXInput.h" -#define NP2_AUTOC_USE_STRING_ORDER 1 +#define NP2_AUTOC_CACHE_SORT_KEY 1 #define NP2_AUTOC_USE_WORD_POINTER 0 // used for debug // scintilla/src/AutoComplete.h AutoComplete::maxItemLen #define NP2_AUTOC_MAX_WORD_LENGTH (1024 - 3 - 1 - 16) // SP + '(' + ')' + '\0' @@ -34,15 +34,15 @@ struct WordNode; struct WordList { int (__cdecl *WL_strcmp)(LPCSTR, LPCSTR); int (__cdecl *WL_strncmp)(LPCSTR, LPCSTR, size_t); -#if NP2_AUTOC_USE_STRING_ORDER - uint32_t (*WL_OrderFunc)(const void *, uint32_t); +#if NP2_AUTOC_CACHE_SORT_KEY + uint32_t (*WL_SortKeyFunc)(const void *, uint32_t); #endif struct WordNode *pListHead; LPCSTR pWordStart; UINT iStartLen; -#if NP2_AUTOC_USE_STRING_ORDER - UINT orderStart; +#if NP2_AUTOC_CACHE_SORT_KEY + UINT sortKey; bool bIgnoreCase; #endif UINT nWordCount; @@ -56,25 +56,25 @@ struct WordList { // TODO: replace _stricmp() and _strnicmp() with other functions // which correctly case insensitively compares UTF-8 string and ANSI string. -#if NP2_AUTOC_USE_STRING_ORDER -#define NP2_AUTOC_ORDER_LENGTH 4 +#if NP2_AUTOC_CACHE_SORT_KEY +#define NP2_AUTOC_SORT_KEY_LENGTH 4 -uint32_t WordList_Order(const void *pWord, uint32_t len) { +uint32_t WordList_SortKey(const void *pWord, uint32_t len) { #if 0 uint32_t high = 0; const uint8_t *ptr = (const uint8_t *)pWord; - len = min_u(len, NP2_AUTOC_ORDER_LENGTH); + len = min_u(len, NP2_AUTOC_SORT_KEY_LENGTH); for (uint32_t i = 0; i < len; i++) { high = (high << 8) | *ptr++; } - if (len < NP2_AUTOC_ORDER_LENGTH) { + if (len < NP2_AUTOC_SORT_KEY_LENGTH) { NP2_assume(len != 0); // suppress [clang-analyzer-core.uninitialized.Assign] - high <<= (NP2_AUTOC_ORDER_LENGTH - len)*8; + high <<= (NP2_AUTOC_SORT_KEY_LENGTH - len)*8; } #else uint32_t high = loadle_u32(pWord); - if (len < NP2_AUTOC_ORDER_LENGTH) { + if (len < NP2_AUTOC_SORT_KEY_LENGTH) { high = bit_zero_high_u32(high, len*8); } high = bswap32(high); @@ -82,11 +82,11 @@ uint32_t WordList_Order(const void *pWord, uint32_t len) { return high; } -uint32_t WordList_OrderCase(const void *pWord, uint32_t len) { +uint32_t WordList_SortKeyCase(const void *pWord, uint32_t len) { #if 1 uint32_t high = 0; const uint8_t *ptr = (const uint8_t *)pWord; - len = min_u(len, NP2_AUTOC_ORDER_LENGTH); + len = min_u(len, NP2_AUTOC_SORT_KEY_LENGTH); for (uint32_t i = 0; i < len; i++) { const uint8_t ch = *ptr++; high = (high << 8) | ch; @@ -95,15 +95,15 @@ uint32_t WordList_OrderCase(const void *pWord, uint32_t len) { high += 'a' - 'A'; } } - if (len < NP2_AUTOC_ORDER_LENGTH) { + if (len < NP2_AUTOC_SORT_KEY_LENGTH) { NP2_assume(len != 0); // suppress [clang-analyzer-core.uninitialized.Assign] - high <<= (NP2_AUTOC_ORDER_LENGTH - len)*8; + high <<= (NP2_AUTOC_SORT_KEY_LENGTH - len)*8; } #else uint32_t high = loadle_u32(pWord); high |= 0x20202020U; // only works for ASCII letters - if (len < NP2_AUTOC_ORDER_LENGTH) { + if (len < NP2_AUTOC_SORT_KEY_LENGTH) { high = bit_zero_high_u32(high, len*8); } high = bswap32(high); @@ -124,8 +124,8 @@ struct WordNode { #if NP2_AUTOC_USE_WORD_POINTER char *word; #endif -#if NP2_AUTOC_USE_STRING_ORDER - UINT order; +#if NP2_AUTOC_CACHE_SORT_KEY + UINT sortKey; #endif UINT len; UINT level; @@ -165,8 +165,8 @@ static inline void WordList_AddBuffer(struct WordList *pWList) { void WordList_AddWord(struct WordList *pWList, LPCSTR pWord, UINT len) { struct WordNode *root = pWList->pListHead; -#if NP2_AUTOC_USE_STRING_ORDER - const UINT order = (pWList->iStartLen > NP2_AUTOC_ORDER_LENGTH) ? 0 : pWList->WL_OrderFunc(pWord, len); +#if NP2_AUTOC_CACHE_SORT_KEY + const UINT sortKey = (pWList->iStartLen > NP2_AUTOC_SORT_KEY_LENGTH) ? 0 : pWList->WL_SortKeyFunc(pWord, len); #endif if (root == NULL) { struct WordNode *node = WordList_AddNode(pWList); @@ -175,8 +175,8 @@ void WordList_AddWord(struct WordList *pWList, LPCSTR pWord, UINT len) { #if NP2_AUTOC_USE_WORD_POINTER node->word = word; #endif -#if NP2_AUTOC_USE_STRING_ORDER - node->order = order; +#if NP2_AUTOC_CACHE_SORT_KEY + node->sortKey = sortKey; #endif node->len = len; node->level = 1; @@ -190,9 +190,9 @@ void WordList_AddWord(struct WordList *pWList, LPCSTR pWord, UINT len) { // find a spot and save the path for (;;) { path[top++] = iter; -#if NP2_AUTOC_USE_STRING_ORDER - dir = (int)(iter->order - order); - if (dir == 0 && (len > NP2_AUTOC_ORDER_LENGTH || iter->len > NP2_AUTOC_ORDER_LENGTH || pWList->bIgnoreCase)) { +#if NP2_AUTOC_CACHE_SORT_KEY + dir = (int)(iter->sortKey - sortKey); + if (dir == 0 && (len > NP2_AUTOC_SORT_KEY_LENGTH || iter->len > NP2_AUTOC_SORT_KEY_LENGTH || pWList->bIgnoreCase)) { dir = pWList->WL_strcmp(WordNode_GetWord(iter), pWord); } #else @@ -219,8 +219,8 @@ void WordList_AddWord(struct WordList *pWList, LPCSTR pWord, UINT len) { #if NP2_AUTOC_USE_WORD_POINTER node->word = word; #endif -#if NP2_AUTOC_USE_STRING_ORDER - node->order = order; +#if NP2_AUTOC_CACHE_SORT_KEY + node->sortKey = sortKey; #endif node->len = len; node->level = 1; @@ -292,18 +292,18 @@ void WordList_Init(struct WordList *pWList, LPCSTR pRoot, UINT iRootLen, bool bI if (bIgnoreCase) { pWList->WL_strcmp = strcmp; pWList->WL_strncmp = _strnicmp; -#if NP2_AUTOC_USE_STRING_ORDER - pWList->WL_OrderFunc = WordList_OrderCase; +#if NP2_AUTOC_CACHE_SORT_KEY + pWList->WL_SortKeyFunc = WordList_SortKeyCase; #endif } else { pWList->WL_strcmp = strcmp; pWList->WL_strncmp = strncmp; -#if NP2_AUTOC_USE_STRING_ORDER - pWList->WL_OrderFunc = WordList_Order; +#if NP2_AUTOC_CACHE_SORT_KEY + pWList->WL_SortKeyFunc = WordList_SortKey; #endif } -#if NP2_AUTOC_USE_STRING_ORDER - pWList->orderStart = pWList->WL_OrderFunc(pRoot, iRootLen); +#if NP2_AUTOC_CACHE_SORT_KEY + pWList->sortKey = pWList->WL_SortKeyFunc(pRoot, iRootLen); pWList->bIgnoreCase = bIgnoreCase; #endif @@ -314,15 +314,15 @@ void WordList_Init(struct WordList *pWList, LPCSTR pRoot, UINT iRootLen, bool bI static inline void WordList_UpdateRoot(struct WordList *pWList, LPCSTR pRoot, UINT iRootLen) { pWList->pWordStart = pRoot; pWList->iStartLen = iRootLen; -#if NP2_AUTOC_USE_STRING_ORDER - pWList->orderStart = pWList->WL_OrderFunc(pRoot, iRootLen); +#if NP2_AUTOC_CACHE_SORT_KEY + pWList->sortKey = pWList->WL_SortKeyFunc(pRoot, iRootLen); #endif } static inline bool WordList_StartsWith(const struct WordList *pWList, LPCSTR pWord) { -#if NP2_AUTOC_USE_STRING_ORDER - if (pWList->iStartLen <= NP2_AUTOC_ORDER_LENGTH) { - return pWList->orderStart == pWList->WL_OrderFunc(pWord, pWList->iStartLen); +#if NP2_AUTOC_CACHE_SORT_KEY + if (pWList->iStartLen <= NP2_AUTOC_SORT_KEY_LENGTH) { + return pWList->sortKey == pWList->WL_SortKeyFunc(pWord, pWList->iStartLen); } #endif return pWList->WL_strncmp(pWList->pWordStart, pWord, pWList->iStartLen) == 0; @@ -682,8 +682,8 @@ enum { JavaScriptKeywordIndex_JSDoc = 10, JuliaKeywordIndex_CodeFolding = 1, JuliaKeywordIndex_Macro = 6, - KotlinKeywordIndex_Annotation = 4, - KotlinKeywordIndex_KDoc = 6, + KotlinKeywordIndex_Annotation = 6, + KotlinKeywordIndex_KDoc = 8, NSISKeywordIndex_PredefinedVariable = 5, PHPKeywordIndex_PredefinedVariable = 4, PHPKeywordIndex_Phpdoc = 11, diff --git a/src/EditLexers/stlCSS.c b/src/EditLexers/stlCSS.c index af36935f83..17d8726764 100644 --- a/src/EditLexers/stlCSS.c +++ b/src/EditLexers/stlCSS.c @@ -114,7 +114,7 @@ static KEYWORDLIST Keywords_CSS = {{ "text-emphasis text-emphasis-color text-emphasis-position text-emphasis-skip text-emphasis-style text-group-align " "text-indent text-justify text-orientation text-overflow text-rendering " "text-shadow text-size-adjust text-spacing text-spacing-trim text-transform " -"text-underline-offset text-underline-position text-wrap timeline-scope top touch-action " +"text-underline-offset text-underline-position text-wrap text-wrap-mode text-wrap-style timeline-scope top touch-action " "transform transform-box transform-origin transform-style " "transition transition-delay transition-duration transition-property transition-timing-function translate " "unicode-bidi unicode-range update user-select user-zoom " @@ -122,7 +122,7 @@ static KEYWORDLIST Keywords_CSS = {{ "view-timeline view-timeline-axis view-timeline-inset view-timeline-name view-transition-name viewport-fit visibility " "voice-balance voice-duration voice-family voice-pitch voice-range voice-rate voice-stress voice-volume volume " "white-space white-space-collapse white-space-trim widows width will-change " -"word-boundary-detection word-boundary-expansion word-break word-spacing word-wrap " +"word-boundary-detection word-boundary-expansion word-break word-space-transform word-spacing word-wrap " "wrap-after wrap-before wrap-flow wrap-inside wrap-through writing-mode " "z-index zoom " @@ -182,7 +182,7 @@ static KEYWORDLIST Keywords_CSS = {{ "above abs( absolute absolute-colorimetric accumulate acos( add additive adjust( alias " "all-petite-caps all-scroll all-small-caps allow-end alpha alpha( alphabetic alphamix( alternate alternate-reverse " "always anchor( anchor-size( and annotation( anywhere append( arcs argb( arguments armenian as asin( " -"at atan( atan2( attr( audio aural auto auto( auto-flow auto-same " +"at atan( atan2( attr( audio aural auto auto( auto-flow auto-phrase auto-same " "average( avoid avoid-column avoid-flex avoid-line avoid-page avoid-region " "back backwards balance balance-all bar baseline behind below bevel bidi-override bitmap " "blackness( blink block block-end block-start blue( blur( bold bolder boolean( border-box both both-edges bounding-box " @@ -265,7 +265,7 @@ static KEYWORDLIST Keywords_CSS = {{ "table-row table-row-group tabular-nums tactile tan( target-counter( target-counters( target-text( " "techn( text text-bottom text-top textarea textfield thick thin through tint( titling-caps " "to to-lower-case( to-upper-case( traditional translate( translate3d( translateX( translateY( translateZ( " -"triangle trim-adjacent trim-auto trim-end trim-inner trim-start true truetype tty tv type( type-of( " +"triangle trim-adjacent trim-all trim-auto trim-end trim-inner trim-start true truetype tty tv type( type-of( " "ui-monospace ui-rounded ui-sans-serif ui-serif ultra-condensed ultra-expanded " "under underline underscore unicase unicode unify( unique-id( unit( unquote( unsafe unset " "up upper-alpha upper-latin upper-roman uppercase upright url( url-prefix( " diff --git a/src/EditLexers/stlHTML.c b/src/EditLexers/stlHTML.c index a2c215922c..a0a4b8b384 100644 --- a/src/EditLexers/stlHTML.c +++ b/src/EditLexers/stlHTML.c @@ -60,7 +60,7 @@ NULL "pattern placeholder playsinline poster preload popover popovertarget popovertargetaction " "radiogroup readonly referrerpolicy rel required " "rev reversed rows rowspan sandbox sizes spellcheck scope scoped seamless selected shape size slot span " -"src srcdoc srclang srcset start step style tabindex target title translate type " +"shadowrootmode shadowrootdelegatesfocus src srcdoc srclang srcset start step style tabindex target title translate type " "typemustmatch usemap value width wrap " // Other Attribute diff --git a/src/EditLexers/stlKotlin.c b/src/EditLexers/stlKotlin.c index 83d9c4342c..857215980a 100644 --- a/src/EditLexers/stlKotlin.c +++ b/src/EditLexers/stlKotlin.c @@ -9,77 +9,78 @@ static KEYWORDLIST Keywords_Kotlin = {{ "package param private property protected public receiver reified return sealed set setparam super suspend " "tailrec this throw true try typealias typeof val value var vararg when where while " -, // 1 class -"AbstractCollection AbstractIterator AbstractList " -"AbstractMap AbstractMutableCollection AbstractMutableList AbstractMutableMap AbstractMutableSet AbstractQueue " -"AbstractSequentialList AbstractSet ActionBar Activity AdapterView AlertDialog Any Application " -"Array ArrayAdapter ArrayBlockingQueue ArrayDeque ArrayList Arrays " +, // 1 Java class +"AbstractCollection AbstractList AbstractMap AbstractQueue AbstractSequentialList AbstractSet ActionBar Activity " +"AdapterView AlertDialog Application Array ArrayAdapter ArrayBlockingQueue ArrayDeque ArrayList Arrays " "AtomicBoolean AtomicInteger AtomicLong AtomicReference AudioFormat AudioManager AudioRecord AudioTrack " -"Base64 BaseAdapter BigDecimal BigInteger Binder BitSet Bitmap Boolean BooleanArray " +"Base64 BaseAdapter BigDecimal BigInteger Binder BitSet Bitmap Boolean " "Buffer BufferedInputStream BufferedOutputStream BufferedReader BufferedWriter Build Bundle Button " -"Byte ByteArray ByteArrayInputStream ByteArrayOutputStream ByteBuffer ByteOrder " -"Calendar Canvas Char CharArray CharArrayReader CharArrayWriter CharBuffer Character Charset CheckBox ChoiceFormat " -"Class ClassLoader Collections Collectors Color " +"Byte ByteArrayInputStream ByteArrayOutputStream ByteBuffer ByteOrder " +"Calendar Canvas CharArrayReader CharArrayWriter CharBuffer Character Charset CheckBox ChoiceFormat Class ClassLoader " +"Collections Collectors Color " "ConcurrentHashMap ConcurrentLinkedDeque ConcurrentLinkedQueue Console Constructor Context ContextWrapper Copy " "CountDownLatch Currency " "DataInputStream DataOutputStream DatagramPacket DatagramSocket Date DateFormat DecimalFormat DeflaterOutputStream " -"Dialog Dictionary Display Double DoubleArray DoubleBuffer Drawable " +"Dialog Dictionary Display Double DoubleBuffer Drawable " "EOFException EditText Enum EnumMap EnumSet Environment Error EventObject Exception " "Field File FileDescriptor FileInputStream FileOutputStream FilePermission FileReader FileSystem FileWriter " -"FilterInputStream FilterOutputStream FilterReader FilterWriter Float FloatArray FloatBuffer Format Formatter " +"FilterInputStream FilterOutputStream FilterReader FilterWriter Float FloatBuffer Format Formatter " "GZIPInputStream GZIPOutputStream Gradle GregorianCalendar GridView " "Handler HashMap HashSet Hashtable HttpClient HttpCookie HttpRequest HttpURLConnection " -"IOError IOException Image ImageButton ImageView IndexedValue Inet4Address Inet6Address InetAddress InetSocketAddress " -"InflaterInputStream InputStream InputStreamReader Int IntArray IntBuffer Integer Intent IntentFilter " +"IOError IOException Image ImageButton ImageView Inet4Address Inet6Address InetAddress InetSocketAddress " +"InflaterInputStream InputStream InputStreamReader IntBuffer Integer Intent IntentFilter " "JarEntry JarException JarFile JarInputStream JarOutputStream JavaCompile KeyEvent " -"LayoutInflater LinearLayout LinkedHashMap LinkedHashSet LinkedList ListView Locale Long LongArray LongBuffer Looper " -"MappedByteBuffer MatchGroup Matcher Math Matrix Message MessageFormat Method Modifier Module MotionEvent " -"MulticastSocket " -"Nothing Notification Number NumberFormat " -"Object ObjectInputStream ObjectOutputStream Optional OutputStream OutputStreamWriter " -"Package Paint Pair Parcel Pattern PendingIntent PhantomReference " -"PipedInputStream PipedOutputStream PipedReader PipedWriter Point PointF " -"PrintStream PrintWriter PriorityQueue Process ProcessBuilder ProgressBar Project Properties " -"RadioButton RadioGroup Random " -"Reader Record Rect RectF Reference ReferenceQueue Regex Region RelativeLayout RemoteException Result " +"LayoutInflater LinearLayout LinkedHashMap LinkedHashSet LinkedList ListView Locale Long LongBuffer Looper " +"MappedByteBuffer Matcher Math Matrix Message MessageFormat Method Modifier Module MotionEvent MulticastSocket " +"Notification Number NumberFormat Object ObjectInputStream ObjectOutputStream Optional OutputStream OutputStreamWriter " +"Package Paint Parcel Pattern PendingIntent PhantomReference PipedInputStream PipedOutputStream PipedReader PipedWriter " +"Point PointF PrintStream PrintWriter PriorityQueue Process ProcessBuilder ProgressBar Project Properties " +"RadioButton RadioGroup Random Reader Record Rect RectF Reference ReferenceQueue Region RelativeLayout RemoteException " "Runtime RuntimeException " "Scanner Script ScrollView SearchView SecurityManager SeekBar Semaphore ServerSocket Service ServiceLoader Settings " -"Short ShortArray ShortBuffer SimpleDateFormat Socket SocketAddress SoftReference SourceSet Spinner " +"Short ShortBuffer SimpleDateFormat Socket SocketAddress SoftReference SourceSet Spinner " "Stack StackView String StringBuffer StringBuilder StringJoiner StringReader StringTokenizer StringWriter System " "TableLayout Task TextView Thread ThreadGroup ThreadLocal ThreadPoolExecutor Throwable TimeZone Timer TimerTask " -"Toast ToggleButton TreeMap TreeSet Triple " -"UByte UByteArray UInt UIntArray ULong ULongArray URI URL URLConnection URLDecoder URLEncoder UShort UShortArray UUID " -"Unit " -"Vector View ViewGroup Void WeakHashMap WeakReference Window Writer " +"Toast ToggleButton TreeMap TreeSet " +"URI URL URLConnection URLDecoder URLEncoder UUID Vector View ViewGroup Void WeakHashMap WeakReference Window Writer " "ZipEntry ZipException ZipFile ZipInputStream ZipOutputStream " -, // 2 interface +, // 2 class +"AbstractIterator AbstractMutableCollection AbstractMutableList AbstractMutableMap AbstractMutableSet Any " +"BooleanArray ByteArray Char CharArray DoubleArray FloatArray IndexedValue Int IntArray LongArray MatchGroup Nothing " +"Pair Regex Result ShortArray Triple UByte UByteArray UInt UIntArray ULong ULongArray UShort UShortArray Unit " + +, // 3 Java interface "Adapter Annotation Appendable AutoCloseable BaseStream BlockingDeque BlockingQueue ByteChannel " "Callable Channel CharSequence Cloneable Closeable Collection Collector Comparable Comparator ConcurrentMap Condition " "DataInput DataOutput Deque DoubleStream Enumeration EventListener Executor Flushable Formattable Function Future " -"Grouping HttpResponse IBinder IInterface IntStream Iterable Iterator Lazy List ListAdapter ListIterator Lock LongStream " -"Map MatchGroupCollection MatchResult Menu MenuItem " +"HttpResponse IBinder IInterface IntStream Iterable Iterator List ListAdapter ListIterator Lock LongStream " +"Map MatchResult Menu MenuItem NavigableMap NavigableSet ObjectInput ObjectOutput OnClickListener " +"Parcelable Path Predicate Queue RandomAccess ReadWriteLock Readable Runnable " +"Serializable Set SortedMap SortedSet Spliterator Stream WebSocket " + +, // 4 interface +"Grouping Lazy " +"MatchGroupCollection " "MutableCollection MutableIterable MutableIterator MutableList MutableListIterator MutableMap MutableSet " -"NavigableMap NavigableSet ObjectInput ObjectOutput OnClickListener Parcelable Path Predicate Queue " -"RandomAccess ReadWriteLock Readable Runnable Serializable Set SortedMap SortedSet Spliterator Stream WebSocket " -, // 3 enumeration +, // 5 enumeration "AnnotationRetention AnnotationTarget DeprecationLevel ElementType LazyThreadSafetyMode RegexOption RetentionPolicy " "TimeUnit " -, // 4 annotation +, // 6 annotation "Basic Column Delegate DelegatesTo Deprecated Documented Entity FunctionalInterface Generated Id Inherited " "ManagedBean Metadata MustBeDocumented Native NonEmpty NonNull OrderBy OrderColumn Override " "PostConstruct PreDestroy Priority Readonly Repeatable ReplaceWith Resource Resources Retention " "SafeVarargs Serial Suppress SuppressWarnings Table Target Transient Version " -, // 5 function +, // 7 function "assert( check( error( print( println( readLine( require( " -, // 6 KDoc +, // 8 KDoc "author constructor exception param property receiver return sample see since suppress throws " -, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL +, NULL, NULL, NULL, NULL, NULL, NULL, NULL //--Autogenerated -- end of section automatically generated }}; @@ -118,12 +119,14 @@ EDITLEXER lexKotlin = { SCE_KOTLIN_CHARACTER, 0, SCE_KOTLIN_OPERATOR, SCE_KOTLIN_OPERATOR2 , KeywordAttr32(0, KeywordAttr_PreSorted) // keywords - | KeywordAttr32(1, KeywordAttr_PreSorted) // class - | KeywordAttr32(2, KeywordAttr_PreSorted) // interface - | KeywordAttr32(3, KeywordAttr_PreSorted) // enumeration - | KeywordAttr32(4, KeywordAttr_NoLexer) // annotation - | KeywordAttr32(5, KeywordAttr_NoLexer) // function - | KeywordAttr32(6, KeywordAttr_NoLexer | KeywordAttr_NoAutoComp) // KDoc + | KeywordAttr32(1, KeywordAttr_PreSorted) // Java class + | KeywordAttr32(2, KeywordAttr_PreSorted) // class + | KeywordAttr32(3, KeywordAttr_PreSorted) // Java interface + | KeywordAttr32(4, KeywordAttr_PreSorted) // interface + | KeywordAttr32(5, KeywordAttr_PreSorted) // enumeration + | KeywordAttr32(6, KeywordAttr_NoLexer) // annotation + | KeywordAttr64(7, KeywordAttr_NoLexer) // function + | KeywordAttr64(8, KeywordAttr_NoLexer | KeywordAttr_NoAutoComp) // KDoc , SCE_KOTLIN_TASKMARKER, SCE_KOTLIN_CHARACTER, SCE_KOTLIN_ESCAPECHAR, //Settings--Autogenerated -- end of section automatically generated diff --git a/src/EditLexers/stlPHP.c b/src/EditLexers/stlPHP.c index 7d916dcb05..ec51a4b157 100644 --- a/src/EditLexers/stlPHP.c +++ b/src/EditLexers/stlPHP.c @@ -292,7 +292,7 @@ static KEYWORDLIST Keywords_PHP = {{ "is_infinite( is_int( is_integer( is_iterable( is_link( is_long( is_nan( is_null( is_numeric( is_object( " "is_readable( is_resource( is_scalar( is_string( is_subclass_of( is_uploaded_file( is_writable( is_writeable( " "iterator_apply( iterator_count( iterator_to_array( " -"join( jsonSerialize( json_decode( json_encode( json_last_error( json_last_error_msg( " +"join( jsonSerialize( json_decode( json_encode( json_last_error( json_last_error_msg( json_validate( " "key( key_exists( kill( krsort( ksort( " "lastErrorCode( lastErrorMsg( lastInsertId( lastInsertRowID( lcfirst( lcg_value( lchgrp( lchown( levenshtein( " "link( linkinfo( listAbbreviations( listIdentifiers( loadExtension( localeconv( localtime( log( log10( log1p( long2ip( " @@ -304,7 +304,7 @@ static KEYWORDLIST Keywords_PHP = {{ "mb_ereg_search_init( mb_ereg_search_pos( mb_ereg_search_regs( mb_ereg_search_setpos( mb_eregi( mb_eregi_replace( " "mb_get_info( mb_http_input( mb_http_output( mb_internal_encoding( mb_language( mb_list_encodings( " "mb_ord( mb_output_handler( mb_parse_str( mb_preferred_mime_name( mb_regex_encoding( mb_regex_set_options( mb_send_mail( " -"mb_split( mb_str_split( mb_strcut( mb_strimwidth( mb_stripos( mb_stristr( mb_strlen( mb_strpos( " +"mb_split( mb_str_pad( mb_str_split( mb_strcut( mb_strimwidth( mb_stripos( mb_stristr( mb_strlen( mb_strpos( " "mb_strrchr( mb_strrichr( mb_strripos( mb_strrpos( mb_strstr( mb_strtolower( mb_strtoupper( mb_strwidth( " "mb_substitute_character( mb_substr( mb_substr_count( md5( md5_file( " "memory_get_peak_usage( memory_get_usage( memory_reset_peak_usage( metaphone( method_exists( microtime( min( " diff --git a/src/EditLexers/stlSQL.c b/src/EditLexers/stlSQL.c index aba47840ae..058967e5e2 100644 --- a/src/EditLexers/stlSQL.c +++ b/src/EditLexers/stlSQL.c @@ -233,8 +233,8 @@ static KEYWORDLIST Keywords_SQL = {{ "st_pointfromgeohash( st_pointfromtext( st_pointfromwkb( st_pointn( st_pointonsurface( " "st_polyfromtext( st_polyfromwkb( st_polygonfromtext( st_polygonfromwkb( st_relate( " "st_simplify( st_srid( st_startpoint( st_swapxy( st_symdifference( st_touches( st_transform( st_union( st_validate( " -"st_within( st_x( st_y( startpoint( statement_digest( statement_digest_text( std( stddev( str_to_date( strcmp( strftime( " -"subdate( substr( substring_index( subtime( " +"st_within( st_x( st_y( startpoint( statement_digest( statement_digest_text( std( stddev( " +"str_to_date( strcmp( strftime( string_agg( subdate( substr( substring_index( subtime( " "time_format( time_to_sec( timediff( to_base64( to_days( to_seconds( total( total_changes( touches( typeof( " "ucase( uncompress( uncompressed_length( unhex( unix_timestamp( unixepoch( unlikely( updatexml( uuid_short( uuid_to_bin( " "validate_password_strength( variance( " @@ -466,7 +466,7 @@ static KEYWORDLIST Keywords_SQL = {{ "SPACE( SPIDER_BG_DIRECT_SQL( SPIDER_COPY_TABLES( SPIDER_DIRECT_SQL( SPIDER_FLUSH_TABLE_MON_CACHE( " "SQLITE_COMPILEOPTION_GET( SQLITE_COMPILEOPTION_USED( SQLITE_OFFSET( SQLITE_SOURCE_ID( SQLITE_VERSION( " "SQL_THREAD_WAIT_AFTER_GTIDS( SQRT( SRID( STATEMENT_DIGEST( STATEMENT_DIGEST_TEXT( STD( STDDEV( STDDEV_POP( STDDEV_SAMP( " -"STRCMP( STRFTIME( STR_TO_DATE( ST_Area( ST_AsBinary( ST_AsGeoJSON( ST_AsText( ST_AsWKB( ST_AsWKT( " +"STRCMP( STRFTIME( STRING_AGG( STR_TO_DATE( ST_Area( ST_AsBinary( ST_AsGeoJSON( ST_AsText( ST_AsWKB( ST_AsWKT( " "ST_Boundary( ST_Buffer( ST_Buffer_Strategy( ST_Centroid( ST_Contains( ST_ConvexHull( ST_Crosses( " "ST_Difference( ST_Dimension( ST_Disjoint( ST_Distance( ST_Distance_Sphere( " "ST_EndPoint( ST_Envelope( ST_Equals( ST_ExteriorRing( ST_GeoHash( " diff --git a/src/EditLexers/stlVB.c b/src/EditLexers/stlVB.c index a51ced87f5..dfbe1c83f1 100644 --- a/src/EditLexers/stlVB.c +++ b/src/EditLexers/stlVB.c @@ -26,10 +26,11 @@ static KEYWORDLIST Keywords_VB = {{ , // 1 Type Keyword "Boolean Byte CBool CByte CChar CDate CDbl CDec Char CInt CLng CObj CSByte CShort CSng CStr CType CUInt " -"CULng CUShort Date Decimal Double Integer Long Object SByte Short Single String UInteger ULong UShort" +"CULng CUShort Date Decimal Double Integer Long Object SByte Short Single String UInteger ULong UShort " +"Currency LongLong LongPtr Variant Empty Null CCur CLngLng CLngPtr CVar CVDate CVErr " , // 2 not used keyword, used in VBScript -"EndIf GoSub Variant Wend " +"EndIf GoSub Wend " , // 3 Preprocessor "If Else ElseIf End Const Region ExternalChecksum ExternalSource " diff --git a/src/EditLexers/stlVBS.c b/src/EditLexers/stlVBS.c index d73327a02c..28e847eae9 100644 --- a/src/EditLexers/stlVBS.c +++ b/src/EditLexers/stlVBS.c @@ -14,7 +14,7 @@ static KEYWORDLIST Keywords_VBS = {{ "Static Stop Sub Then To True Type Unload Until Wend While With WithEvents Xor" , // 1 Type Keyword -"Boolean Byte Currency Date Double Integer Long Object Single String Variant " +"Boolean Byte Char Currency Date Decimal Double Integer Long LongLong LongPtr Object Single String Variant " "RegExp " , // 2 not used keyword diff --git a/src/Helpers.c b/src/Helpers.c index ac0c5f38a8..88c5b137e9 100644 --- a/src/Helpers.c +++ b/src/Helpers.c @@ -2344,19 +2344,17 @@ void ComboBox_AddStringA2W(UINT uCP, HWND hwnd, LPCSTR lpString) { // // MRU functions // -LPMRULIST MRU_Create(LPCWSTR pszRegKey, int iFlags, int iSize) { +LPMRULIST MRU_Create(LPCWSTR pszRegKey, int iFlags) { LPMRULIST pmru = (LPMRULIST)NP2HeapAlloc(sizeof(MRULIST)); - pmru->szRegKey = pszRegKey; pmru->iFlags = iFlags; - pmru->iSize = min_i(iSize, MRU_MAXITEMS); + pmru->szRegKey = pszRegKey; + MRU_Load(pmru); return pmru; } void MRU_Destroy(LPMRULIST pmru) { for (int i = 0; i < pmru->iSize; i++) { - if (pmru->pszItems[i]) { - LocalFree(pmru->pszItems[i]); - } + LocalFree(pmru->pszItems[i]); } memset(pmru, 0, sizeof(MRULIST)); @@ -2371,217 +2369,187 @@ static inline bool MRU_Equal(int flags, LPCWSTR psz1, LPCWSTR psz2) { #endif } -bool MRU_Add(LPMRULIST pmru, LPCWSTR pszNew) { +void MRU_Add(LPMRULIST pmru, LPCWSTR pszNew) { const int flags = pmru->iFlags; + LPWSTR tchItem = NULL; int i; - for (i = 0; i < pmru->iSize; i++) { + for (i = 0; i < MRU_MAXITEMS; i++) { WCHAR * const item = pmru->pszItems[i]; if (item == NULL) { break; } if (MRU_Equal(flags, item, pszNew)) { - LocalFree(item); + tchItem = item; break; } } - i = min_i(i, pmru->iSize - 1); + if (i == MRU_MAXITEMS) { + --i; + LocalFree(pmru->pszItems[i]); + } else if (i == pmru->iSize) { + pmru->iSize += 1; + } for (; i > 0; i--) { pmru->pszItems[i] = pmru->pszItems[i - 1]; } - pmru->pszItems[0] = StrDup(pszNew); - return true; + if (tchItem == NULL) { + tchItem = StrDup(pszNew); + } + pmru->pszItems[0] = tchItem; } -bool MRU_AddMultiline(LPMRULIST pmru, LPCWSTR pszNew) { +void MRU_AddMultiline(LPMRULIST pmru, LPCWSTR pszNew) { const int len = lstrlen(pszNew); LPWSTR lpszEsc = (LPWSTR)NP2HeapAlloc((2*len + 1)*sizeof(WCHAR)); AddBackslashW(lpszEsc, pszNew); MRU_Add(pmru, lpszEsc); NP2HeapFree(lpszEsc); - return true; } -bool MRU_AddFile(LPMRULIST pmru, LPCWSTR pszFile, bool bRelativePath, bool bUnexpandMyDocs) { - int i; - for (i = 0; i < pmru->iSize; i++) { - WCHAR * const item = pmru->pszItems[i]; - if (item == NULL) { - break; - } - if (PathEqual(item, pszFile)) { - LocalFree(item); - break; - } - { - WCHAR wchItem[MAX_PATH]; - PathAbsoluteFromApp(item, wchItem, true); - if (PathEqual(wchItem, pszFile)) { - LocalFree(item); - break; - } - } - } - i = min_i(i, pmru->iSize - 1); - for (; i > 0; i--) { - pmru->pszItems[i] = pmru->pszItems[i - 1]; - } - - if (bRelativePath) { - WCHAR wchFile[MAX_PATH]; - PathRelativeToApp(pszFile, wchFile, 0, true, bUnexpandMyDocs); - pmru->pszItems[0] = StrDup(wchFile); - } else { - pmru->pszItems[0] = StrDup(pszFile); - } - - return true; -} - -bool MRU_Delete(LPMRULIST pmru, int iIndex) { +void MRU_Delete(LPMRULIST pmru, int iIndex) { if (iIndex < 0 || iIndex >= pmru->iSize) { - return false; - } - if (pmru->pszItems[iIndex]) { - LocalFree(pmru->pszItems[iIndex]); + return; } - for (int i = iIndex; i < pmru->iSize - 1; i++) { + LocalFree(pmru->pszItems[iIndex]); + pmru->pszItems[iIndex] = NULL; + pmru->iSize -= 1; + for (int i = iIndex; i < pmru->iSize; i++) { pmru->pszItems[i] = pmru->pszItems[i + 1]; pmru->pszItems[i + 1] = NULL; } - return true; } -bool MRU_DeleteFileFromStore(LPCMRULIST pmru, LPCWSTR pszFile) { - int i = 0; - WCHAR wchItem[MAX_PATH]; - - LPMRULIST pmruStore = MRU_Create(pmru->szRegKey, pmru->iFlags, pmru->iSize); - MRU_Load(pmruStore); +void MRU_DeleteFileFromStore(LPCMRULIST pmru, LPCWSTR pszFile) { + LPMRULIST pmruStore = MRU_Create(pmru->szRegKey, pmru->iFlags); + int deleted = 0; - while (MRU_Enum(pmruStore, i, wchItem, COUNTOF(wchItem)) >= 0) { - PathAbsoluteFromApp(wchItem, wchItem, true); - if (PathEqual(wchItem, pszFile)) { - MRU_Delete(pmruStore, i); + for (int index = 0; index < pmruStore->iSize; ) { + LPCWSTR path = pmruStore->pszItems[index]; + if (PathEqual(path, pszFile)) { + deleted += 1; + LocalFree(pmruStore->pszItems[index]); + pmruStore->pszItems[index] = NULL; + for (int i = index; i < pmruStore->iSize - 1; i++) { + pmruStore->pszItems[i] = pmruStore->pszItems[i + 1]; + pmruStore->pszItems[i + 1] = NULL; + } } else { - i++; + index++; } } + pmruStore->iSize -= deleted; MRU_Save(pmruStore); MRU_Destroy(pmruStore); - return true; } -void MRU_Empty(LPMRULIST pmru) { +void MRU_Empty(LPMRULIST pmru, bool save) { for (int i = 0; i < pmru->iSize; i++) { - if (pmru->pszItems[i]) { - LocalFree(pmru->pszItems[i]); - pmru->pszItems[i] = NULL; - } + LocalFree(pmru->pszItems[i]); + pmru->pszItems[i] = NULL; } -} - -int MRU_Enum(LPCMRULIST pmru, int iIndex, LPWSTR pszItem, int cchItem) { - if (pszItem == NULL || cchItem == 0) { - int i = 0; - while (i < pmru->iSize && pmru->pszItems[i]) { - i++; - } - return i; + pmru->iSize = 0; + if (save) { + MRU_Save(pmru); } - - if (iIndex < 0 || iIndex >= pmru->iSize || pmru->pszItems[iIndex] == NULL) { - return -1; - } - lstrcpyn(pszItem, pmru->pszItems[iIndex], cchItem); - return TRUE; } -bool MRU_Load(LPMRULIST pmru) { +void MRU_Load(LPMRULIST pmru) { if (StrIsEmpty(szIniFile)) { - return true; + return; } IniSection section; WCHAR *pIniSectionBuf = (WCHAR *)NP2HeapAlloc(sizeof(WCHAR) * MAX_INI_SECTION_SIZE_MRU); const int cchIniSection = (int)(NP2HeapSize(pIniSectionBuf) / sizeof(WCHAR)); IniSection * const pIniSection = §ion; + const int iFlags = pmru->iFlags; - MRU_Empty(pmru); + //MRU_Empty(pmru, false); IniSectionInit(pIniSection, MRU_MAXITEMS); LoadIniSection(pmru->szRegKey, pIniSectionBuf, cchIniSection); - IniSectionParseArray(pIniSection, pIniSectionBuf, pmru->iFlags & MRUFlags_QuoteValue); + IniSectionParseArray(pIniSection, pIniSectionBuf, iFlags & MRUFlags_QuoteValue); const UINT count = pIniSection->count; - const UINT size = pmru->iSize; + UINT n = 0; - for (UINT i = 0, n = 0; i < count && n < size; i++) { + for (UINT i = 0; i < count; i++) { const IniKeyValueNode *node = &pIniSection->nodeList[i]; LPCWSTR tchItem = node->value; if (StrNotEmpty(tchItem)) { + WCHAR tchPath[MAX_PATH]; + if ((iFlags & MRUFlags_FilePath) != 0 && PathIsRelative(tchItem)) { + PathAbsoluteFromApp(tchItem, tchPath, true); + tchItem = tchPath; + } pmru->pszItems[n++] = StrDup(tchItem); } } + pmru->iSize = n; IniSectionFree(pIniSection); NP2HeapFree(pIniSectionBuf); - return true; } -bool MRU_Save(LPCMRULIST pmru) { +void MRU_Save(LPCMRULIST pmru) { if (StrIsEmpty(szIniFile)) { - return true; + return; } - if (MRU_GetCount(pmru) == 0) { + if (pmru->iSize <= 0) { IniClearSection(pmru->szRegKey); - return true; + return; } WCHAR tchName[16]; WCHAR *pIniSectionBuf = (WCHAR *)NP2HeapAlloc(sizeof(WCHAR) * MAX_INI_SECTION_SIZE_MRU); IniSectionOnSave section = { pIniSectionBuf }; IniSectionOnSave * const pIniSection = §ion; - const BOOL quoted = pmru->iFlags & MRUFlags_QuoteValue; + const int iFlags = pmru->iFlags; for (int i = 0; i < pmru->iSize; i++) { - if (StrNotEmpty(pmru->pszItems[i])) { + LPCWSTR tchItem = pmru->pszItems[i]; + if (StrNotEmpty(tchItem)) { wsprintf(tchName, L"%02i", i + 1); - if (quoted) { - IniSectionSetQuotedString(pIniSection, tchName, pmru->pszItems[i]); + if (iFlags & MRUFlags_QuoteValue) { + IniSectionSetQuotedString(pIniSection, tchName, tchItem); } else { - IniSectionSetString(pIniSection, tchName, pmru->pszItems[i]); + WCHAR tchPath[MAX_PATH]; + if (iFlags & MRUFlags_RelativePath) { + PathRelativeToApp(tchItem, tchPath, 0, true, iFlags & MRUFlags_PortableMyDocs); + tchItem = tchPath; + } + IniSectionSetString(pIniSection, tchName, tchItem); } } } SaveIniSection(pmru->szRegKey, pIniSectionBuf); NP2HeapFree(pIniSectionBuf); - return true; } -bool MRU_MergeSave(LPCMRULIST pmru, bool bAddFiles, bool bRelativePath, bool bUnexpandMyDocs) { - LPMRULIST pmruBase = MRU_Create(pmru->szRegKey, pmru->iFlags, pmru->iSize); - MRU_Load(pmruBase); +void MRU_MergeSave(LPMRULIST pmru, bool keep) { + if (!keep) { + MRU_Empty(pmru, true); + return; + } + if (pmru->iSize <= 0) { + return; + } + LPMRULIST pmruBase = MRU_Create(pmru->szRegKey, pmru->iFlags); - if (bAddFiles) { - for (int i = pmru->iSize - 1; i >= 0; i--) { - if (pmru->pszItems[i]) { - WCHAR wchItem[MAX_PATH]; - PathAbsoluteFromApp(pmru->pszItems[i], wchItem, true); - MRU_AddFile(pmruBase, wchItem, bRelativePath, bUnexpandMyDocs); - } - } - } else { - for (int i = pmru->iSize - 1; i >= 0; i--) { - if (pmru->pszItems[i]) { - MRU_Add(pmruBase, pmru->pszItems[i]); - } - } + for (int i = pmru->iSize - 1; i >= 0; i--) { + MRU_Add(pmruBase, pmru->pszItems[i]); } MRU_Save(pmruBase); MRU_Destroy(pmruBase); - return true; +} + +void MRU_AddToCombobox(LPCMRULIST pmru, HWND hwnd) { + for (int i = 0; i < pmru->iSize; i++) { + LPCWSTR str = pmru->pszItems[i]; + ComboBox_AddString(hwnd, str); + } } /* @@ -2943,57 +2911,24 @@ bool AddBackslashA(char *pszOut, const char *pszInput) { char *lpszEsc = pszOut; const char *lpsz = pszInput; while (*lpsz) { - switch (*lpsz) { - case '\n': - *lpszEsc++ = '\\'; - *lpszEsc++ = 'n'; - hasEscapeChar = true; - break; - case '\r': - *lpszEsc++ = '\\'; - *lpszEsc++ = 'r'; + char ch = *lpsz++; + const uint8_t index = ch - '\a'; + if (index <= '\r' - '\a') { + ch = "abtnvfr"[index]; hasEscapeChar = true; - break; - case '\t': *lpszEsc++ = '\\'; - *lpszEsc++ = 't'; + *lpszEsc++ = ch; + } else if (ch == '\x1B') { hasEscapeChar = true; - break; - case '\\': - *lpszEsc++ = '\\'; - *lpszEsc++ = '\\'; - hasSlash = true; - break; - case '\f': - *lpszEsc++ = '\\'; - *lpszEsc++ = 'f'; - hasEscapeChar = true; - break; - case '\v': - *lpszEsc++ = '\\'; - *lpszEsc++ = 'v'; - hasEscapeChar = true; - break; - case '\a': - *lpszEsc++ = '\\'; - *lpszEsc++ = 'b'; - hasEscapeChar = true; - break; - case '\b': - *lpszEsc++ = '\\'; - *lpszEsc++ = 'a'; - hasEscapeChar = true; - break; - case '\x1B': *lpszEsc++ = '\\'; *lpszEsc++ = 'e'; - hasEscapeChar = true; - break; - default: - *lpszEsc++ = *lpsz; - break; + } else { + *lpszEsc++ = ch; + if (ch == '\\') { + hasSlash = true; + *lpszEsc++ = ch; + } } - lpsz++; } if (hasSlash && !hasEscapeChar) { @@ -3008,57 +2943,24 @@ bool AddBackslashW(LPWSTR pszOut, LPCWSTR pszInput) { LPWSTR lpszEsc = pszOut; LPCWSTR lpsz = pszInput; while (*lpsz) { - switch (*lpsz) { - case '\n': - *lpszEsc++ = '\\'; - *lpszEsc++ = 'n'; - hasEscapeChar = true; - break; - case '\r': - *lpszEsc++ = '\\'; - *lpszEsc++ = 'r'; - hasEscapeChar = true; - break; - case '\t': - *lpszEsc++ = '\\'; - *lpszEsc++ = 't'; - hasEscapeChar = true; - break; - case '\\': - *lpszEsc++ = '\\'; - *lpszEsc++ = '\\'; - hasSlash = true; - break; - case '\f': - *lpszEsc++ = '\\'; - *lpszEsc++ = 'f'; - hasEscapeChar = true; - break; - case '\v': - *lpszEsc++ = '\\'; - *lpszEsc++ = 'v'; + WCHAR ch = *lpsz++; + const WCHAR index = ch - '\a'; + if (index <= '\r' - '\a') { + ch = (uint8_t)("abtnvfr"[index]); hasEscapeChar = true; - break; - case '\a': *lpszEsc++ = '\\'; - *lpszEsc++ = 'b'; + *lpszEsc++ = ch; + } else if (ch == '\x1B') { hasEscapeChar = true; - break; - case '\b': - *lpszEsc++ = '\\'; - *lpszEsc++ = 'a'; - hasEscapeChar = true; - break; - case '\x1B': *lpszEsc++ = '\\'; *lpszEsc++ = 'e'; - hasEscapeChar = true; - break; - default: - *lpszEsc++ = *lpsz; - break; + } else { + *lpszEsc++ = ch; + if (ch == '\\') { + hasSlash = true; + *lpszEsc++ = ch; + } } - lpsz++; } if (hasSlash && !hasEscapeChar) { diff --git a/src/Helpers.h b/src/Helpers.h index ccced934fe..a6320f75dc 100644 --- a/src/Helpers.h +++ b/src/Helpers.h @@ -874,35 +874,33 @@ enum { MRUFlags_Default = 0, MRUFlags_FilePath = 1, MRUFlags_QuoteValue = 2, + MRUFlags_RelativePath = 4, + MRUFlags_PortableMyDocs = 8, }; // MRU_MAXITEMS * (MAX_PATH + 4) #define MAX_INI_SECTION_SIZE_MRU (8 * 1024) typedef struct MRULIST { - LPCWSTR szRegKey; - int iFlags; int iSize; + int iFlags; + LPCWSTR szRegKey; LPWSTR pszItems[MRU_MAXITEMS]; } MRULIST, *PMRULIST, *LPMRULIST; typedef const MRULIST * LPCMRULIST; -LPMRULIST MRU_Create(LPCWSTR pszRegKey, int iFlags, int iSize); +LPMRULIST MRU_Create(LPCWSTR pszRegKey, int iFlags); void MRU_Destroy(LPMRULIST pmru); -bool MRU_Add(LPMRULIST pmru, LPCWSTR pszNew); -bool MRU_AddMultiline(LPMRULIST pmru, LPCWSTR pszNew); -bool MRU_AddFile(LPMRULIST pmru, LPCWSTR pszFile, bool bRelativePath, bool bUnexpandMyDocs); -bool MRU_Delete(LPMRULIST pmru, int iIndex); -bool MRU_DeleteFileFromStore(LPCMRULIST pmru, LPCWSTR pszFile); -void MRU_Empty(LPMRULIST pmru); -int MRU_Enum(LPCMRULIST pmru, int iIndex, LPWSTR pszItem, int cchItem); -NP2_inline int MRU_GetCount(LPCMRULIST pmru) { - return MRU_Enum(pmru, 0, NULL, 0); -} -bool MRU_Load(LPMRULIST pmru); -bool MRU_Save(LPCMRULIST pmru); -bool MRU_MergeSave(LPCMRULIST pmru, bool bAddFiles, bool bRelativePath, bool bUnexpandMyDocs); +void MRU_Add(LPMRULIST pmru, LPCWSTR pszNew); +void MRU_AddMultiline(LPMRULIST pmru, LPCWSTR pszNew); +void MRU_Delete(LPMRULIST pmru, int iIndex); +void MRU_DeleteFileFromStore(LPCMRULIST pmru, LPCWSTR pszFile); +void MRU_Empty(LPMRULIST pmru, bool save); +void MRU_Load(LPMRULIST pmru); +void MRU_Save(LPCMRULIST pmru); +void MRU_MergeSave(LPMRULIST pmru, bool keep); +void MRU_AddToCombobox(LPCMRULIST pmru, HWND hwnd); //==== Themed Dialogs ========================================================= #ifndef DLGTEMPLATEEX diff --git a/src/Notepad2.c b/src/Notepad2.c index 26a7daca4a..50effddf1c 100644 --- a/src/Notepad2.c +++ b/src/Notepad2.c @@ -75,7 +75,7 @@ static UINT uTrayIconDPI = 0; static TBBUTTON tbbMainWnd[] = { {0, 0, 0, TBSTYLE_SEP, {0}, 0, 0}, {0, IDT_FILE_NEW, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0}, 0, 0}, - {1, IDT_FILE_OPEN, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0}, 0, 0}, + {1, IDT_FILE_OPEN, TBSTATE_ENABLED, BTNS_DROPDOWN, {0}, 0, 0}, {2, IDT_FILE_BROWSE, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0}, 0, 0}, {3, IDT_FILE_SAVE, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0}, 0, 0}, {4, IDT_EDIT_UNDO, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0}, 0, 0}, @@ -1152,26 +1152,12 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam) SaveSettings(false); if (StrNotEmpty(szIniFile)) { - // Cleanup unwanted MRU's - if (!bSaveRecentFiles) { - MRU_Empty(pFileMRU); - MRU_Save(pFileMRU); - } else { - MRU_MergeSave(pFileMRU, true, flagRelativeFileMRU, flagPortableMyDocs); - } + MRU_MergeSave(pFileMRU, bSaveRecentFiles); MRU_Destroy(pFileMRU); - - if (!bSaveFindReplace) { - MRU_Empty(mruFind); - MRU_Empty(mruReplace); - MRU_Save(mruFind); - MRU_Save(mruReplace); - } else { - MRU_MergeSave(mruFind, false, false, false); - MRU_MergeSave(mruReplace, false, false, false); - } + MRU_MergeSave(mruFind, bSaveFindReplace); MRU_Destroy(mruFind); + MRU_MergeSave(mruReplace, bSaveFindReplace); MRU_Destroy(mruReplace); } @@ -1965,12 +1951,10 @@ LRESULT MsgCreate(HWND hwnd, WPARAM wParam, LPARAM lParam) { DragAcceptFiles(hwnd, TRUE); // File MRU - pFileMRU = MRU_Create(MRU_KEY_RECENT_FILES, MRUFlags_FilePath, MRU_MAX_RECENT_FILES); - MRU_Load(pFileMRU); - mruFind = MRU_Create(MRU_KEY_RECENT_FIND, MRUFlags_QuoteValue, MRU_MAX_RECENT_FIND); - MRU_Load(mruFind); - mruReplace = MRU_Create(MRU_KEY_RECENT_REPLACE, MRUFlags_QuoteValue, MRU_MAX_RECENT_REPLACE); - MRU_Load(mruReplace); + int flags = MRUFlags_FilePath | (((int)flagRelativeFileMRU) * MRUFlags_RelativePath) | (((int)flagPortableMyDocs) * MRUFlags_PortableMyDocs); + pFileMRU = MRU_Create(MRU_KEY_RECENT_FILES, flags); + mruFind = MRU_Create(MRU_KEY_RECENT_FIND, MRUFlags_QuoteValue); + mruReplace = MRU_Create(MRU_KEY_RECENT_REPLACE, MRUFlags_QuoteValue); return 0; } @@ -2465,7 +2449,7 @@ void MsgInitMenu(HWND hwnd, WPARAM wParam, LPARAM lParam) { i = IDM_LINEENDINGS_CRLF + iCurrentEOLMode; CheckMenuRadioItem(hmenu, IDM_LINEENDINGS_CRLF, IDM_LINEENDINGS_LF, i, MF_BYCOMMAND); - EnableCmd(hmenu, IDM_FILE_RECENT, (MRU_GetCount(pFileMRU) > 0)); + EnableCmd(hmenu, IDM_FILE_RECENT, (pFileMRU->iSize > 0)); EnableCmd(hmenu, IDM_EDIT_UNDO, SciCall_CanUndo()); EnableCmd(hmenu, IDM_EDIT_REDO, SciCall_CanRedo()); @@ -3038,7 +3022,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam) { break; case IDM_FILE_RECENT: - if (MRU_GetCount(pFileMRU) > 0) { + if (pFileMRU->iSize > 0) { if (FileSave(FileSaveFlag_Ask)) { WCHAR tchFile[MAX_PATH]; if (FileMRUDlg(hwnd, tchFile)) { @@ -5017,6 +5001,18 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam) { case IDT_VIEW_ALWAYSONTOP: SendWMCommandOrBeep(hwnd, IDM_VIEW_ALWAYSONTOP); break; + + default: { + const UINT index = LOWORD(wParam) - IDM_RECENT_HISTORY_START; + if (index < MRU_MAXITEMS) { + LPCWSTR path = pFileMRU->pszItems[index]; + if (path) { + if (FileSave(FileSaveFlag_Ask)) { + FileLoad(FileLoadFlag_DontSave, path); + } + } + } + } break; } return 0; @@ -5324,8 +5320,8 @@ LRESULT MsgNotify(HWND hwnd, WPARAM wParam, LPARAM lParam) { case TBN_GETBUTTONINFO: { LPTBNOTIFY lpTbNotify = (LPTBNOTIFY)lParam; - if (lpTbNotify->iItem < (int)COUNTOF(tbbMainWnd)) { - WCHAR tch[256]; + if ((UINT)lpTbNotify->iItem < COUNTOF(tbbMainWnd)) { + WCHAR tch[128]; GetString(tbbMainWnd[lpTbNotify->iItem].idCommand, tch, COUNTOF(tch)); lstrcpyn(lpTbNotify->pszText, tch, lpTbNotify->cchText); memcpy(&lpTbNotify->tbButton, &tbbMainWnd[lpTbNotify->iItem], sizeof(TBBUTTON)); @@ -5340,16 +5336,30 @@ LRESULT MsgNotify(HWND hwnd, WPARAM wParam, LPARAM lParam) { case TBN_DROPDOWN: { LPTBNOTIFY lpTbNotify = (LPTBNOTIFY)lParam; - RECT rc; - SendMessage(hwndToolbar, TB_GETRECT, lpTbNotify->iItem, (LPARAM)&rc); - MapWindowPoints(hwndToolbar, HWND_DESKTOP, (LPPOINT)&rc, 2); - HMENU hmenu = LoadMenu(g_hInstance, MAKEINTRESOURCE(IDR_POPUPMENU)); + HMENU hmenu = NULL; + HMENU subMenu = NULL; + if (lpTbNotify->iItem == IDT_FILE_OPEN) { + NP2_static_assert(IDM_RECENT_HISTORY_START + MRU_MAXITEMS == IDM_RECENT_HISTORY_END); + const int count = pFileMRU->iSize; + if (count <= 0) { + return TBDDRET_TREATPRESSED; + } + hmenu = subMenu = CreatePopupMenu(); + for (int i = 0; i < count; i++) { + LPCWSTR path = pFileMRU->pszItems[i]; + AppendMenu(subMenu, MF_STRING, i + IDM_RECENT_HISTORY_START, path); + } + } else { + hmenu = LoadMenu(g_hInstance, MAKEINTRESOURCE(IDR_POPUPMENU)); + subMenu = GetSubMenu(hmenu, IDP_POPUP_SUBMENU_FOLD); + } TPMPARAMS tpm; tpm.cbSize = sizeof(TPMPARAMS); - tpm.rcExclude = rc; - TrackPopupMenuEx(GetSubMenu(hmenu, IDP_POPUP_SUBMENU_FOLD), + SendMessage(hwndToolbar, TB_GETRECT, lpTbNotify->iItem, (LPARAM)&tpm.rcExclude); + MapWindowPoints(hwndToolbar, HWND_DESKTOP, (LPPOINT)&tpm.rcExclude, 2); + TrackPopupMenuEx(subMenu, TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_VERTICAL, - rc.left, rc.bottom, hwnd, &tpm); + tpm.rcExclude.left, tpm.rcExclude.bottom, hwnd, &tpm); DestroyMenu(hmenu); } return FALSE; @@ -5420,7 +5430,7 @@ LRESULT MsgNotify(HWND hwnd, WPARAM wParam, LPARAM lParam) { if (pTTT->uFlags & TTF_IDISHWND) { //nop; } else { - WCHAR tch[256]; + WCHAR tch[128]; GetString((UINT)pnmh->idFrom, tch, COUNTOF(tch)); lstrcpyn(pTTT->szText, tch, COUNTOF(pTTT->szText)); } @@ -5462,34 +5472,7 @@ void LoadSettings(void) { //const int iSettingsVersion = IniSectionGetInt(pIniSection, L"SettingsVersion", NP2SettingsVersion_Current); bSaveSettings = IniSectionGetBool(pIniSection, L"SaveSettings", true); - bSaveRecentFiles = IniSectionGetBool(pIniSection, L"SaveRecentFiles", false); - bSaveFindReplace = IniSectionGetBool(pIniSection, L"SaveFindReplace", false); - bFindReplaceTransparentMode = IniSectionGetBool(pIniSection, L"FindReplaceTransparentMode", true); - bFindReplaceUseMonospacedFont = IniSectionGetBool(pIniSection, L"FindReplaceUseMonospacedFont", false); - bFindReplaceFindAllBookmark = IniSectionGetBool(pIniSection, L"FindReplaceFindAllBookmark", false); - - efrData.bFindClose = IniSectionGetBool(pIniSection, L"CloseFind", false); - efrData.bReplaceClose = IniSectionGetBool(pIniSection, L"CloseReplace", false); - efrData.bNoFindWrap = IniSectionGetBool(pIniSection, L"NoFindWrap", false); - - if (bSaveFindReplace) { - efrData.fuFlags = 0; - if (IniSectionGetBool(pIniSection, L"FindReplaceMatchCase", false)) { - efrData.fuFlags |= SCFIND_MATCHCASE; - } - if (IniSectionGetBool(pIniSection, L"FindReplaceMatchWholeWorldOnly", false)) { - efrData.fuFlags |= SCFIND_WHOLEWORD; - } - if (IniSectionGetBool(pIniSection, L"FindReplaceMatchBeginingWordOnly", false)) { - efrData.fuFlags |= SCFIND_WORDSTART; - } - if (IniSectionGetBool(pIniSection, L"FindReplaceRegExpSearch", false)) { - efrData.fuFlags |= NP2_RegexDefaultFlags; - } - efrData.bTransformBS = IniSectionGetBool(pIniSection, L"FindReplaceTransformBackslash", false); - efrData.bWildcardSearch = IniSectionGetBool(pIniSection, L"FindReplaceWildcardSearch", false); - } - + // TODO: sort loading order by item frequency to reduce IniSectionUnsafeGetValue() calls LPCWSTR strValue = IniSectionGetValue(pIniSection, L"OpenWithDir"); if (StrIsEmpty(strValue)) { #if _WIN32_WINNT >= _WIN32_WINNT_VISTA @@ -5523,8 +5506,39 @@ void LoadSettings(void) { int iValue = IniSectionGetInt(pIniSection, L"PathNameFormat", TitlePathNameFormat_NameFirst); iPathNameFormat = (TitlePathNameFormat)clamp_i(iValue, TitlePathNameFormat_NameOnly, TitlePathNameFormat_FullPath); - fWordWrapG = IniSectionGetBool(pIniSection, L"WordWrap", true); + POINT pt; + pt.x = IniSectionGetInt(pIniSection, L"WindowPosX", 0); + pt.y = IniSectionGetInt(pIniSection, L"WindowPosY", 0); + + bSaveRecentFiles = IniSectionGetBool(pIniSection, L"SaveRecentFiles", false); + bSaveFindReplace = IniSectionGetBool(pIniSection, L"SaveFindReplace", false); + bFindReplaceTransparentMode = IniSectionGetBool(pIniSection, L"FindReplaceTransparentMode", true); + bFindReplaceUseMonospacedFont = IniSectionGetBool(pIniSection, L"FindReplaceUseMonospacedFont", false); + bFindReplaceFindAllBookmark = IniSectionGetBool(pIniSection, L"FindReplaceFindAllBookmark", false); + + efrData.bFindClose = IniSectionGetBool(pIniSection, L"CloseFind", false); + efrData.bReplaceClose = IniSectionGetBool(pIniSection, L"CloseReplace", false); + efrData.bNoFindWrap = IniSectionGetBool(pIniSection, L"NoFindWrap", false); + + if (bSaveFindReplace) { + efrData.fuFlags = 0; + if (IniSectionGetBool(pIniSection, L"FindReplaceMatchCase", false)) { + efrData.fuFlags |= SCFIND_MATCHCASE; + } + if (IniSectionGetBool(pIniSection, L"FindReplaceMatchWholeWorldOnly", false)) { + efrData.fuFlags |= SCFIND_WHOLEWORD; + } + if (IniSectionGetBool(pIniSection, L"FindReplaceMatchBeginingWordOnly", false)) { + efrData.fuFlags |= SCFIND_WORDSTART; + } + if (IniSectionGetBool(pIniSection, L"FindReplaceRegExpSearch", false)) { + efrData.fuFlags |= NP2_RegexDefaultFlags; + } + efrData.bTransformBS = IniSectionGetBool(pIniSection, L"FindReplaceTransformBackslash", false); + efrData.bWildcardSearch = IniSectionGetBool(pIniSection, L"FindReplaceWildcardSearch", false); + } + fWordWrapG = IniSectionGetBool(pIniSection, L"WordWrap", true); iValue = IniSectionGetInt(pIniSection, L"WordWrapMode", SC_WRAP_AUTO); iWordWrapMode = clamp_i(iValue, SC_WRAP_WORD, SC_WRAP_AUTO); @@ -5731,7 +5745,7 @@ void LoadSettings(void) { // window position section { WCHAR sectionName[96]; - HMONITOR hMonitor = MonitorFromWindow(NULL, MONITOR_DEFAULTTONEAREST); + HMONITOR hMonitor = MonitorFromPoint(pt, MONITOR_DEFAULTTONEAREST); GetWindowPositionSectionName(hMonitor, sectionName); LoadIniSection(sectionName, pIniSectionBuf, cchIniSection); IniSectionParse(pIniSection, pIniSectionBuf); @@ -5846,14 +5860,29 @@ void SaveSettings(bool bSaveSettingsNow) { WCHAR wchTmp[MAX_PATH]; WCHAR *pIniSectionBuf = (WCHAR *)NP2HeapAlloc(sizeof(WCHAR) * MAX_INI_SECTION_SIZE_SETTINGS); + if (!bStickyWindowPosition) { + SaveWindowPosition(pIniSectionBuf); + memset(pIniSectionBuf, 0, 2*sizeof(WCHAR)); + } + IniSectionOnSave section = { pIniSectionBuf }; IniSectionOnSave * const pIniSection = §ion; //IniSectionSetInt(pIniSection, L"SettingsVersion", NP2SettingsVersion_Current); IniSectionSetBoolEx(pIniSection, L"SaveSettings", bSaveSettings, true); + + PathRelativeToApp(tchOpenWithDir, wchTmp, FILE_ATTRIBUTE_DIRECTORY, true, flagPortableMyDocs); + IniSectionSetString(pIniSection, L"OpenWithDir", wchTmp); + PathRelativeToApp(tchFavoritesDir, wchTmp, FILE_ATTRIBUTE_DIRECTORY, true, flagPortableMyDocs); + IniSectionSetString(pIniSection, L"Favorites", wchTmp); + IniSectionSetIntEx(pIniSection, L"PathNameFormat", (int)iPathNameFormat, TitlePathNameFormat_NameFirst); + if (!bStickyWindowPosition) { + IniSectionSetInt(pIniSection, L"WindowPosX", wi.x); + IniSectionSetInt(pIniSection, L"WindowPosY", wi.y); + } + IniSectionSetBoolEx(pIniSection, L"SaveRecentFiles", bSaveRecentFiles, false); IniSectionSetBoolEx(pIniSection, L"SaveFindReplace", bSaveFindReplace, false); - IniSectionSetBoolEx(pIniSection, L"CloseFind", efrData.bFindClose, false); IniSectionSetBoolEx(pIniSection, L"CloseReplace", efrData.bReplaceClose, false); IniSectionSetBoolEx(pIniSection, L"NoFindWrap", efrData.bNoFindWrap, false); @@ -5869,12 +5898,6 @@ void SaveSettings(bool bSaveSettingsNow) { IniSectionSetBoolEx(pIniSection, L"FindReplaceWildcardSearch", efrData.bWildcardSearch, false); } - PathRelativeToApp(tchOpenWithDir, wchTmp, FILE_ATTRIBUTE_DIRECTORY, true, flagPortableMyDocs); - IniSectionSetString(pIniSection, L"OpenWithDir", wchTmp); - PathRelativeToApp(tchFavoritesDir, wchTmp, FILE_ATTRIBUTE_DIRECTORY, true, flagPortableMyDocs); - IniSectionSetString(pIniSection, L"Favorites", wchTmp); - IniSectionSetIntEx(pIniSection, L"PathNameFormat", (int)iPathNameFormat, TitlePathNameFormat_NameFirst); - IniSectionSetBoolEx(pIniSection, L"WordWrap", fWordWrapG, true); IniSectionSetIntEx(pIniSection, L"WordWrapMode", iWordWrapMode, SC_WRAP_AUTO); IniSectionSetIntEx(pIniSection, L"WordWrapIndent", iWordWrapIndent, EditWrapIndent_None); @@ -5985,16 +6008,12 @@ void SaveSettings(bool bSaveSettingsNow) { IniSectionSetIntEx(pIniSection, L"FullScreenMode", iFullScreenMode, FullScreenMode_Default); SaveIniSection(INI_SECTION_NAME_SETTINGS, pIniSectionBuf); - if (!bStickyWindowPosition) { - SaveWindowPosition(pIniSectionBuf); - } NP2HeapFree(pIniSectionBuf); // Scintilla Styles Style_Save(); } void SaveWindowPosition(WCHAR *pIniSectionBuf) { - memset(pIniSectionBuf, 0, 2*sizeof(WCHAR)); IniSectionOnSave section = { pIniSectionBuf }; IniSectionOnSave *const pIniSection = §ion; @@ -7550,7 +7569,7 @@ bool FileLoad(FileLoadFlag loadFlag, LPCWSTR lpszFile) { UpdateLineNumberWidth(); } - MRU_AddFile(pFileMRU, szFileName, flagRelativeFileMRU, flagPortableMyDocs); + MRU_Add(pFileMRU, szFileName); if (flagUseSystemMRU == TripleBoolean_True) { SHAddToRecentDocs(SHARD_PATHW, szFileName); } @@ -7760,7 +7779,7 @@ bool FileSave(FileSaveFlag saveFlag) { if (!(saveFlag & FileSaveFlag_SaveCopy)) { bDocumentModified = false; iOriginalEncoding = iCurrentEncoding; - MRU_AddFile(pFileMRU, szCurFile, flagRelativeFileMRU, flagPortableMyDocs); + MRU_Add(pFileMRU, szCurFile); if (flagUseSystemMRU == TripleBoolean_True) { SHAddToRecentDocs(SHARD_PATHW, szCurFile); } diff --git a/src/Version.h b/src/Version.h index 8344d945a5..60dd4ab2f1 100644 --- a/src/Version.h +++ b/src/Version.h @@ -39,7 +39,7 @@ #define HELP_LINK_FEATURE_REQUEST L"https://github.com/zufuliu/notepad2/issues" #define HELP_LINK_ONLINE_WIKI L"https://github.com/zufuliu/notepad2/wiki" -#define VERSION_BUILD_INFO_LIB L",\nScintilla 5.3.7." +#define VERSION_BUILD_INFO_LIB L",\nScintilla 5.4.0." #define VERSION_BUILD_INFO_FORMAT L"Compiled on " __DATE__ L" with %s %d.%d.%d" VERSION_BUILD_INFO_LIB #if defined(__clang__) #define VERSION_BUILD_TOOL_NAME L"Clang" diff --git a/src/VersionRev.h b/src/VersionRev.h index 648cff9886..d66bd52dff 100644 --- a/src/VersionRev.h +++ b/src/VersionRev.h @@ -1,6 +1,6 @@ #define VERSION_MINOR 23 -#define VERSION_BUILD_NUM 8 -#define VERSION_BUILD 08 -#define VERSION_HASH TEXT("2235065e") -#define VERSION_REV 4962 -#define VERSION_REV_FULL TEXT("r4962 (2235065e)") +#define VERSION_BUILD_NUM 11 +#define VERSION_BUILD 11 +#define VERSION_HASH TEXT("3084629c") +#define VERSION_REV 5052 +#define VERSION_REV_FULL TEXT("r5052 (3084629c)") diff --git a/src/resource.h b/src/resource.h index d279a513bd..b370c12f40 100644 --- a/src/resource.h +++ b/src/resource.h @@ -767,6 +767,8 @@ #define IDM_HELP_FEATURE_REQUEST 40505 #define IDM_HELP_ONLINE_WIKI 40506 #define IDM_HELP_LATEST_BUILD 40507 +#define IDM_RECENT_HISTORY_START 40508 +#define IDM_RECENT_HISTORY_END (IDM_RECENT_HISTORY_START + 32) #define IDM_TRAY_RESTORE 40600 #define IDM_TRAY_EXIT 40601 diff --git a/tools/KeywordCore.py b/tools/KeywordCore.py index 1f1ba4d021..e19b098234 100644 --- a/tools/KeywordCore.py +++ b/tools/KeywordCore.py @@ -1598,13 +1598,15 @@ def parse_kotlin_api_file(path): if True: # for JVM target - keywordMap['class'].update(JavaKeywordMap['class']) - keywordMap['interface'].extend(JavaKeywordMap['interface']) + keywordMap['Java class'] = JavaKeywordMap['class'] + keywordMap['Java interface'] = JavaKeywordMap['interface'] keywordMap['enumeration'].update(JavaKeywordMap['enumeration']) keywordMap['annotation'].update(JavaKeywordMap['annotation']) RemoveDuplicateKeyword(keywordMap, [ 'keywords', + 'Java class', + 'Java interface', 'class', 'interface', 'enumeration', @@ -1612,7 +1614,9 @@ def parse_kotlin_api_file(path): ]) return [ ('keywords', keywordMap['keywords'], KeywordAttr.Default), + ('Java class', keywordMap['Java class'], KeywordAttr.Default), ('class', keywordMap['class'], KeywordAttr.Default), + ('Java interface', keywordMap['Java interface'], KeywordAttr.Default), ('interface', keywordMap['interface'], KeywordAttr.Default), ('enumeration', keywordMap['enumeration'], KeywordAttr.Default), ('annotation', keywordMap['annotation'], KeywordAttr.NoLexer | KeywordAttr.Special), diff --git a/tools/lang/CSS.css b/tools/lang/CSS.css index a1adbb2292..91569bd202 100644 --- a/tools/lang/CSS.css +++ b/tools/lang/CSS.css @@ -1,5 +1,5 @@ // 2023 https://www.w3.org/TR/CSS/ 14 February 2023 -// 2023-08-12 https://drafts.csswg.org/ +// 2023-11-18 https://drafts.csswg.org/ // https://github.com/w3c/csswg-drafts/ // https://www.w3.org/Style/CSS/all-properties // https://www.w3.org/Style/CSS/all-descriptors @@ -839,7 +839,7 @@ all continuous paged visual audio speech tactile grid bitmap interactive static float-offset:; } -// CSS Paged Media Module Level 3 https://www.w3.org/TR/css-page-3/ 18 October 2018 +// CSS Paged Media Module Level 3 https://www.w3.org/TR/css-page-3/ 14 September 2023 @page {} @top-left-corner {} @top-left {} @@ -866,7 +866,6 @@ all continuous paged visual audio speech tactile grid bitmap interactive static marks: none | crop | cross; bleed: auto; page: auto; - // https://drafts.csswg.org/css-page-3/ page-orientation: upright | rotate-left | rotate-right; } @@ -1185,18 +1184,21 @@ view() chains: none; } -// CSS Text Module Level 4 https://www.w3.org/TR/css-text-4/ 29 March 2023 -// CSS Text Module Level 3 https://www.w3.org/TR/css-text-3/ 13 February 2023 +// CSS Text Module Level 4 https://www.w3.org/TR/css-text-4/ 20 October 2023 +// CSS Text Module Level 3 https://www.w3.org/TR/css-text-3/ 3 September 2023 // Text https://www.w3.org/TR/CSS22/text.html { text-transform: none | capitalize | uppercase | lowercase | full-width | full-size-kana; + word-space-transform: none | space | ideographic-space | auto-phrase; word-boundary-detection: normal | manual | auto(); word-boundary-expansion: none | space | ideographic-space; + white-space: normal | pre | nowrap | pre-wrap | break-spaces | pre-line; white-space-collapse: collapse | discard | preserve | preserve-breaks | preserve-spaces; white-space-trim: none | trim-inner | discard-before | discard-after; tab-size:; - word-break: normal | keep-all | break-all | break-word; + + word-break: normal | keep-all | break-all | manual | auto-phrase | break-word; line-break: auto | loose | normal | strict | anywhere; hyphens: none | manual | auto; hyphenate-character: auto; @@ -1206,21 +1208,27 @@ view() hyphenate-limit-last: none | always | column | page | spread; overflow-wrap: normal | break-word | anywhere; word-wrap: normal | break-word | anywhere; + + text-wrap-mode: wrap | nowrap; + text-wrap-style: auto| balance | stable | pretty; text-wrap: wrap | nowrap | balance | stable | pretty; wrap-before: auto | avoid | avoid-line | avoid-flex | line | flex; wrap-after: auto | avoid | avoid-line | avoid-flex | line | flex; wrap-inside: auto | avoid; + text-align: start | end | left | right | center | justify | match-parent | justify-all; text-align-all: start | end | left | right | center | justify | match-parent; text-align-last: auto | start | end | left | right | center | justify | match-parent; text-justify: auto | none | inter-word | inter-character | no-compress; text-group-align: none | start | end | left | right | center; + word-spacing: normal; letter-spacing: normal; line-padding:; text-autospace: normal | no-autospace | ideograph-alpha | ideograph-numeric | punctuation | insert | replace; - text-spacing-trim: auto | space-all | trim-auto | allow-end | space-first; + text-spacing-trim: auto | space-all | trim-auto | allow-end | space-first | trim-all; text-spacing: normal | none | no-compress | trim-start | space-start | space-first | trim-end | space-end | allow-end | trim-adjacent | space-adjacent | ideograph-alpha | ideograph-numeric | punctuation; + text-indent: hanging | each-line; hanging-punctuation: none | first | force-end | allow-end | last; } @@ -1280,7 +1288,7 @@ view() transition:; } -// CSS Values and Units Module Level 4 https://www.w3.org/TR/css-values-4/ 6 April 2023 +// CSS Values and Units Module Level 4 https://www.w3.org/TR/css-values-4/ 27 October 2023 // CSS Values and Units Module Level 3 https://www.w3.org/TR/css-values-3/ 01 December 2022 mix() initial nherit unset @@ -1295,7 +1303,7 @@ pow() sqrt() hypot() log() exp() abs() sign() pi infinity NaN -// CSS View Transitions Module Level 1 https://www.w3.org/TR/css-view-transitions-1/ 3 August 2023 +// CSS View Transitions Module Level 1 https://www.w3.org/TR/css-view-transitions-1/ 5 September 2023 { view-transition-name: none; } @@ -1388,7 +1396,7 @@ aural speech speak-header: once | always; } -// Compatibility https://compat.spec.whatwg.org/ 19 June 2023 +// Compatibility https://compat.spec.whatwg.org/ 27 September 2023 { touch-action: auto | none | pan-x | pan-left | pan-right | pan-y | pan-up | pan-down | pinch-zoom | manipulation; } diff --git a/tools/lang/PHP.php b/tools/lang/PHP.php index b84dd66cc1..10a96cc4d2 100644 --- a/tools/lang/PHP.php +++ b/tools/lang/PHP.php @@ -1,5 +1,5 @@ @@ -310,14 +310,14 @@
-
+
- + diff --git a/version.txt b/version.txt index 2e8429ef66..1d9363f8ec 100644 --- a/version.txt +++ b/version.txt @@ -4,18 +4,18 @@ git clone https://github.com/XhmikosR/notepad2-mod.git Scintilla (upstream) hg clone http://hg.code.sf.net/p/scintilla/code scintilla -5.3.7 -2023-10-06 9393:c33d0f12ef84 +5.4.0 +2023-11-18 9428:f634641a8c10 Lexilla (upstream) git clone https://github.com/ScintillaOrg/lexilla.git -5.2.7 -2023-10-06 56c49a41e8266acf6150e930f7cfe88304ac1627 +5.2.9 +2023-11-18 cf7b44e3a2689179918cc28567bbc21d23c55173 SciTE (upstream) hg clone http://hg.code.sf.net/p/scintilla/scite -5.3.8 -2023-10-06 6201:4e348f6cc324 +5.4.0 +2023-11-18 6215:b401c42098d6 init submodule: git submodule init