mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-14 21:09:05 +08:00
Merge branch 'Dev_RC' into Dev_ONIGURUMA
# Conflicts: # src/Notepad3.c
This commit is contained in:
commit
25e5ab5679
@ -1 +1 @@
|
||||
1718
|
||||
1721
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
<assemblyIdentity
|
||||
name="Notepad3"
|
||||
processorArchitecture="*"
|
||||
version="5.19.522.1718"
|
||||
version="5.19.525.1721"
|
||||
type="win32"
|
||||
/>
|
||||
<description>Notepad3 ONIGURUMA</description>
|
||||
|
||||
72
src/Edit.c
72
src/Edit.c
@ -5012,7 +5012,7 @@ static RegExResult_t _FindHasMatch(HWND hwnd, LPCEDITFINDREPLACE lpefr, DocPos
|
||||
if (bMarkAll) {
|
||||
EditClearAllOccurrenceMarkers(hwnd);
|
||||
if (iPos >= 0) {
|
||||
EditMarkAll(hwnd, szFind, (int)(lpefr->fuFlags), 0, iTextEnd, false, false);
|
||||
EditMarkAll(hwnd, szFind, (int)(lpefr->fuFlags), 0, iTextEnd);
|
||||
if (FocusedView.HideNonMatchedLines) { EditHideNotMarkedLineRange(lpefr->hwnd, true); }
|
||||
}
|
||||
else {
|
||||
@ -5160,12 +5160,9 @@ static INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wPara
|
||||
CheckDlgButton(hwnd, IDC_ALL_OCCURRENCES, BST_CHECKED);
|
||||
EnableCmd(GetMenu(Globals.hwndMain), IDM_VIEW_MARKOCCUR_ONOFF, false);
|
||||
EnableCmd(GetMenu(Globals.hwndMain), IDM_VIEW_MARKOCCUR_VISIBLE, false);
|
||||
EnableCmd(GetMenu(Globals.hwndMain), IDM_VIEW_TOGGLE_VIEW, false);
|
||||
DialogEnableWindow(hwnd, IDC_TOGGLE_VISIBILITY, true);
|
||||
}
|
||||
else {
|
||||
CheckDlgButton(hwnd, IDC_ALL_OCCURRENCES, BST_UNCHECKED);
|
||||
DialogEnableWindow(hwnd, IDC_TOGGLE_VISIBILITY, false);
|
||||
EditClearAllOccurrenceMarkers(sg_pefrData->hwnd);
|
||||
}
|
||||
EnableCmd(GetMenu(Globals.hwndMain), IDM_VIEW_MARKOCCUR_VISIBLE, Settings.MarkOccurrencesMatchVisible);
|
||||
@ -5272,7 +5269,6 @@ static INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wPara
|
||||
Settings.MarkOccurrencesMatchVisible = s_SaveMarkMatchVisible;
|
||||
EnableCmd(GetMenu(Globals.hwndMain), IDM_VIEW_MARKOCCUR_ONOFF, true);
|
||||
EnableCmd(GetMenu(Globals.hwndMain), IDM_VIEW_MARKOCCUR_VISIBLE, true);
|
||||
EnableCmd(GetMenu(Globals.hwndMain), IDM_VIEW_TOGGLE_VIEW, true);
|
||||
|
||||
Globals.iReplacedOccurrences = 0;
|
||||
Globals.FindReplaceMatchFoundState = FND_NOP;
|
||||
@ -5561,24 +5557,14 @@ static INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wPara
|
||||
DialogEnableWindow(hwnd, IDC_TOGGLE_VISIBILITY, true);
|
||||
EnableCmd(GetMenu(Globals.hwndMain), IDM_VIEW_MARKOCCUR_ONOFF, false);
|
||||
EnableCmd(GetMenu(Globals.hwndMain), IDM_VIEW_MARKOCCUR_VISIBLE, false);
|
||||
EnableCmd(GetMenu(Globals.hwndMain), IDM_VIEW_TOGGLE_VIEW, false);
|
||||
_DelayMarkAll(hwnd, 0, s_InitialSearchStart);
|
||||
}
|
||||
else { // switched OFF
|
||||
//DialogEnableWindow(hwnd, IDC_TOGGLE_VISIBILITY, IsMarkOccurrencesEnabled() && !Settings.MarkOccurrencesMatchVisible);
|
||||
DialogEnableWindow(hwnd, IDC_TOGGLE_VISIBILITY, false);
|
||||
EnableCmd(GetMenu(Globals.hwndMain), IDM_VIEW_MARKOCCUR_ONOFF, true);
|
||||
EnableCmd(GetMenu(Globals.hwndMain), IDM_VIEW_MARKOCCUR_VISIBLE, true);
|
||||
EnableCmd(GetMenu(Globals.hwndMain), IDM_VIEW_TOGGLE_VIEW, true);
|
||||
|
||||
if (FocusedView.HideNonMatchedLines) {
|
||||
SendWMCommand(hwnd, IDC_TOGGLE_VISIBILITY);
|
||||
}
|
||||
else {
|
||||
EditClearAllOccurrenceMarkers(sg_pefrData->hwnd);
|
||||
}
|
||||
EditClearAllOccurrenceMarkers(sg_pefrData->hwnd);
|
||||
InvalidateRect(GetDlgItem(hwnd, IDC_FINDTEXT), NULL, true);
|
||||
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -6169,6 +6155,9 @@ void EditMarkAllOccurrences(HWND hwnd, bool bForceClear)
|
||||
bool const bWaitCursor = (Globals.iMarkOccurrencesCount > 4000) ? true : false;
|
||||
if (bWaitCursor) { BeginWaitCursor(NULL); }
|
||||
|
||||
int searchFlags = EditAddSearchFlags(0, false, false, false,
|
||||
Settings.MarkOccurrencesCurrentWord || Settings.MarkOccurrencesMatchWholeWords, false);
|
||||
|
||||
_IGNORE_NOTIFY_CHANGE_;
|
||||
|
||||
if (Settings.MarkOccurrencesMatchVisible) {
|
||||
@ -6181,10 +6170,10 @@ void EditMarkAllOccurrences(HWND hwnd, bool bForceClear)
|
||||
|
||||
// !!! don't clear all marks, else this method is re-called
|
||||
// !!! on UpdateUI notification on drawing indicator mark
|
||||
EditMarkAll(hwnd, NULL, Settings.MarkOccurrencesCurrentWord, iPosStart, iPosEnd, Settings.MarkOccurrencesMatchCase, Settings.MarkOccurrencesMatchWholeWords);
|
||||
EditMarkAll(hwnd, NULL, searchFlags, iPosStart, iPosEnd);
|
||||
}
|
||||
else {
|
||||
EditMarkAll(hwnd, NULL, Settings.MarkOccurrencesCurrentWord, 0, Sci_GetDocEndPosition(), Settings.MarkOccurrencesMatchCase, Settings.MarkOccurrencesMatchWholeWords);
|
||||
EditMarkAll(hwnd, NULL, searchFlags, 0, Sci_GetDocEndPosition());
|
||||
}
|
||||
|
||||
_OBSERVE_NOTIFY_CHANGE_;
|
||||
@ -6512,27 +6501,38 @@ void EditToggleView(HWND hwnd)
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// EditAddSearchFlags()
|
||||
//
|
||||
int EditAddSearchFlags(int flags, bool bRegEx, bool bWordStart, bool bMatchCase, bool bMatchWords, bool bDotMatchAll)
|
||||
{
|
||||
flags |= (bRegEx) ? SCFIND_REGEXP : 0;
|
||||
flags |= (bWordStart) ? SCFIND_WORDSTART : 0;
|
||||
flags |= (bMatchWords) ? SCFIND_WHOLEWORD : 0;
|
||||
flags |= (bMatchCase ? SCFIND_MATCHCASE : 0);
|
||||
flags |= (bDotMatchAll ? SCFIND_DOT_MATCH_ALL : 0);
|
||||
return flags;
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// EditMarkAll()
|
||||
// Mark all occurrences of the matching text in range (by Aleksandar Lekov)
|
||||
//
|
||||
void EditMarkAll(HWND hwnd, char* pszFind, int flags, DocPos rangeStart, DocPos rangeEnd, bool bMatchCase, bool bMatchWords)
|
||||
void EditMarkAll(HWND hwnd, char* pszFind, int flags, DocPos rangeStart, DocPos rangeEnd)
|
||||
{
|
||||
char* pszText = NULL;
|
||||
char txtBuffer[HUGE_BUFFER] = { '\0' };
|
||||
char txtBuffer[XHUGE_BUFFER] = { '\0' };
|
||||
char* pszText = (pszFind != NULL) ? pszFind : txtBuffer;
|
||||
|
||||
DocPos iFindLength = 0;
|
||||
|
||||
if (pszFind != NULL)
|
||||
pszText = pszFind;
|
||||
else
|
||||
pszText = txtBuffer;
|
||||
|
||||
if (pszFind == NULL)
|
||||
if (StrIsEmptyA(pszText))
|
||||
{
|
||||
if (SciCall_IsSelectionEmpty()) {
|
||||
if (flags) { // nothing selected, get word under caret if flagged
|
||||
if (flags & SCFIND_WHOLEWORD) { // nothing selected, get word under caret if flagged
|
||||
DocPos const iCurrPos = SciCall_GetCurrentPos();
|
||||
DocPos const iWordStart = SciCall_WordStartPosition(iCurrPos, true);
|
||||
DocPos const iWordEnd = SciCall_WordEndPosition(iCurrPos, true);
|
||||
@ -6540,12 +6540,10 @@ void EditMarkAll(HWND hwnd, char* pszFind, int flags, DocPos rangeStart, DocPos
|
||||
StringCchCopyNA(txtBuffer, COUNTOF(txtBuffer), SciCall_GetRangePointer(iWordStart, iFindLength), iFindLength);
|
||||
}
|
||||
else {
|
||||
return; // no selection and no word mark chosen
|
||||
return; // no pattern, no selection and no word mark chosen
|
||||
}
|
||||
}
|
||||
else { // selection found
|
||||
|
||||
if (flags) { return; } // no current word matching if we have a selection
|
||||
else { // we have a selection
|
||||
|
||||
// get current selection
|
||||
DocPos const iSelStart = SciCall_GetSelectionStart();
|
||||
@ -6553,14 +6551,14 @@ void EditMarkAll(HWND hwnd, char* pszFind, int flags, DocPos rangeStart, DocPos
|
||||
DocPos const iSelCount = (iSelEnd - iSelStart);
|
||||
|
||||
// if multiple lines are selected exit
|
||||
if ((SciCall_LineFromPosition(iSelStart) != SciCall_LineFromPosition(iSelEnd)) || (iSelCount >= HUGE_BUFFER)) {
|
||||
if ((SciCall_LineFromPosition(iSelStart) != SciCall_LineFromPosition(iSelEnd)) || (iSelCount >= COUNTOF(txtBuffer))) {
|
||||
return;
|
||||
}
|
||||
|
||||
iFindLength = SciCall_GetSelText(pszText) - 1;
|
||||
|
||||
// exit if selection is not a word and Match whole words only is enabled
|
||||
if (bMatchWords) {
|
||||
if (flags & SCFIND_WHOLEWORD) {
|
||||
DocPos iSelStart2 = 0;
|
||||
const char* delims = (Settings.AccelWordNavigation ? DelimCharsAccel : DelimChars);
|
||||
while ((iSelStart2 <= iSelCount) && pszText[iSelStart2]) {
|
||||
@ -6571,10 +6569,6 @@ void EditMarkAll(HWND hwnd, char* pszFind, int flags, DocPos rangeStart, DocPos
|
||||
}
|
||||
}
|
||||
}
|
||||
// set additional flags
|
||||
flags = flags ? SCFIND_WHOLEWORD : 0; // match current word under caret ?
|
||||
flags |= (bMatchWords) ? SCFIND_WHOLEWORD : 0;
|
||||
flags |= (bMatchCase ? SCFIND_MATCHCASE : 0);
|
||||
}
|
||||
else {
|
||||
iFindLength = (DocPos)StringCchLenA(pszFind, FNDRPL_BUFFER);
|
||||
@ -6933,8 +6927,6 @@ void EditHideNotMarkedLineRange(HWND hwnd, bool bHideLines)
|
||||
else // ===== fold lines without marker =====
|
||||
{
|
||||
// prepare hidden (folding) settings
|
||||
EditFinalizeStyling(hwnd, -1);
|
||||
EditMarkAllOccurrences(hwnd, true);
|
||||
FocusedView.CodeFoldingAvailable = true;
|
||||
FocusedView.ShowCodeFolding = true;
|
||||
Style_SetFoldingFocusedView();
|
||||
|
||||
@ -103,7 +103,8 @@ void EditPrintInit();
|
||||
void EditMatchBrace(HWND hwnd);
|
||||
void EditClearAllOccurrenceMarkers(HWND hwnd);
|
||||
void EditToggleView(HWND hwnd);
|
||||
void EditMarkAll(HWND hwnd, char* pszFind, int flags, DocPos rangeStart, DocPos rangeEnd, bool, bool);
|
||||
int EditAddSearchFlags(int flags, bool bRegEx, bool bWordStart, bool bMatchCase, bool bMatchWords, bool bDotMatchAll);
|
||||
void EditMarkAll(HWND hwnd, char* pszFind, int flags, DocPos rangeStart, DocPos rangeEnd);
|
||||
void EditFinalizeStyling(HWND hwnd, DocPos iEndPos);
|
||||
void EditUpdateUrlIndicators(HWND hwnd, DocPos startPos, DocPos endPos, bool);
|
||||
void EditSetAccelWordNav(HWND hwnd,bool);
|
||||
|
||||
@ -3180,7 +3180,7 @@ LRESULT MsgInitMenu(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||
CheckCmd(hmenu, IDM_VIEW_MARKOCCUR_VISIBLE, Settings.MarkOccurrencesMatchVisible);
|
||||
CheckCmd(hmenu, IDM_VIEW_MARKOCCUR_CASE, Settings.MarkOccurrencesMatchCase);
|
||||
|
||||
EnableCmd(hmenu, IDM_VIEW_TOGGLE_VIEW, (Settings.MarkOccurrences > 0) && !Settings.MarkOccurrencesMatchVisible);
|
||||
EnableCmd(hmenu, IDM_VIEW_TOGGLE_VIEW, (Settings.MarkOccurrences > 0));
|
||||
CheckCmd(hmenu, IDM_VIEW_TOGGLE_VIEW, FocusedView.HideNonMatchedLines);
|
||||
|
||||
if (Settings.MarkOccurrencesMatchWholeWords) {
|
||||
@ -3295,7 +3295,7 @@ LRESULT MsgInitMenu(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||
}
|
||||
|
||||
UpdateSettingsCmds();
|
||||
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -5095,14 +5095,17 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
case IDM_VIEW_MARKOCCUR_ONOFF:
|
||||
Settings.MarkOccurrences = (Settings.MarkOccurrences == 0) ? max_i(1, IniGetInt(L"Settings", L"MarkOccurrences", 1)) : 0;
|
||||
EnableCmd(GetMenu(hwnd), IDM_VIEW_TOGGLE_VIEW, (Settings.MarkOccurrences > 0) && !Settings.MarkOccurrencesMatchVisible);
|
||||
if ((Settings.MarkOccurrences <= 0) && FocusedView.HideNonMatchedLines) {
|
||||
EditToggleView(Globals.hwndEdit);
|
||||
}
|
||||
EnableCmd(GetMenu(hwnd), IDM_VIEW_TOGGLE_VIEW, (Settings.MarkOccurrences > 0));
|
||||
MarkAllOccurrences(0, true);
|
||||
UpdateToolbar();
|
||||
break;
|
||||
|
||||
case IDM_VIEW_MARKOCCUR_VISIBLE:
|
||||
Settings.MarkOccurrencesMatchVisible = !Settings.MarkOccurrencesMatchVisible;
|
||||
MarkAllOccurrences(0, true);
|
||||
EnableCmd(GetMenu(hwnd), IDM_VIEW_TOGGLE_VIEW, (Settings.MarkOccurrences > 0) && !Settings.MarkOccurrencesMatchVisible);
|
||||
break;
|
||||
|
||||
case IDM_VIEW_TOGGLE_VIEW:
|
||||
@ -8713,7 +8716,6 @@ static void _UpdateToolbarDelayed()
|
||||
|
||||
EnableTool(IDT_FILE_LAUNCH, b2);
|
||||
|
||||
|
||||
EnableTool(IDT_EDIT_FIND, b2);
|
||||
//EnableTool(IDT_EDIT_FINDNEXT,b2);
|
||||
//EnableTool(IDT_EDIT_FINDPREV,b2 && StringCchLenA(Settings.EFR_Data.szFind,0));
|
||||
@ -8725,7 +8727,7 @@ static void _UpdateToolbarDelayed()
|
||||
|
||||
EnableTool(IDT_VIEW_TOGGLEFOLDS, b2 && (FocusedView.CodeFoldingAvailable && FocusedView.ShowCodeFolding));
|
||||
|
||||
EnableTool(IDT_VIEW_TOGGLE_VIEW, b2 && ((Settings.MarkOccurrences > 0) && !Settings.MarkOccurrencesMatchVisible));
|
||||
EnableTool(IDT_VIEW_TOGGLE_VIEW, b2 && (Settings.MarkOccurrences > 0));
|
||||
CheckTool(IDT_VIEW_TOGGLE_VIEW, tv);
|
||||
}
|
||||
|
||||
@ -9870,9 +9872,9 @@ static int _UndoRedoActionMap(int token, UndoRedoSelection_t** selection)
|
||||
(*selection) = (UndoRedoSelection_t*)utarray_eltptr(UndoRedoSelectionUTArray, utoken);
|
||||
}
|
||||
else {
|
||||
// this is a set request (filled redo pos)
|
||||
// is done in place, so:
|
||||
assert(false); //§§§ should not occur
|
||||
// this is a set request (fill redo pos)
|
||||
assert(false); // not used yet
|
||||
//utarray_insert(UndoRedoSelectionUTArray, (void*)(*selection), utoken);
|
||||
}
|
||||
// don't clear map item here (token used in redo/undo again)
|
||||
}
|
||||
|
||||
@ -7,8 +7,8 @@
|
||||
#define SAPPNAME "Notepad3"
|
||||
#define VERSION_MAJOR 5
|
||||
#define VERSION_MINOR 19
|
||||
#define VERSION_REV 522
|
||||
#define VERSION_BUILD 1718
|
||||
#define VERSION_REV 525
|
||||
#define VERSION_BUILD 1721
|
||||
#define SCINTILLA_VER 415+
|
||||
#define ONIGURUMA_REGEX_VER 6.9.2
|
||||
#define VERSION_PATCH ONIGURUMA
|
||||
|
||||
Loading…
Reference in New Issue
Block a user