mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-11 21:03:05 +08:00
+ chg: add some more coding fonts to prefer over Consolas (if installed)
+ bld: linker: hardware-enforced stack-protection + rfc: some code cleanup
This commit is contained in:
parent
112caf1bcc
commit
456be83425
@ -241,6 +241,7 @@
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<CETCompat>true</CETCompat>
|
||||
</Link>
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>true</LinkLibraryDependencies>
|
||||
@ -277,6 +278,7 @@
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<CETCompat>true</CETCompat>
|
||||
</Link>
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>true</LinkLibraryDependencies>
|
||||
@ -312,6 +314,7 @@
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<CETCompat>true</CETCompat>
|
||||
</Link>
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>true</LinkLibraryDependencies>
|
||||
@ -340,6 +343,7 @@
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<CETCompat>true</CETCompat>
|
||||
</Link>
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>true</LinkLibraryDependencies>
|
||||
@ -375,6 +379,7 @@
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<CETCompat>true</CETCompat>
|
||||
</Link>
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>true</LinkLibraryDependencies>
|
||||
@ -409,6 +414,7 @@
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<CETCompat>true</CETCompat>
|
||||
</Link>
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>true</LinkLibraryDependencies>
|
||||
|
||||
@ -147,6 +147,7 @@
|
||||
<ManifestFile />
|
||||
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
|
||||
<DelayLoadDLLs>uxtheme.dll</DelayLoadDLLs>
|
||||
<CETCompat>true</CETCompat>
|
||||
</Link>
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
@ -210,6 +211,7 @@
|
||||
<ManifestFile />
|
||||
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
|
||||
<DelayLoadDLLs>uxtheme.dll</DelayLoadDLLs>
|
||||
<CETCompat>true</CETCompat>
|
||||
</Link>
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
@ -276,6 +278,7 @@
|
||||
</ManifestFile>
|
||||
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
|
||||
<DelayLoadDLLs>uxtheme.dll</DelayLoadDLLs>
|
||||
<CETCompat>true</CETCompat>
|
||||
</Link>
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
@ -312,6 +315,7 @@
|
||||
<ManifestFile />
|
||||
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
|
||||
<DelayLoadDLLs>uxtheme.dll</DelayLoadDLLs>
|
||||
<CETCompat>true</CETCompat>
|
||||
</Link>
|
||||
<ClCompile>
|
||||
</ClCompile>
|
||||
@ -350,6 +354,7 @@
|
||||
<ManifestFile />
|
||||
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
|
||||
<DelayLoadDLLs>uxtheme.dll</DelayLoadDLLs>
|
||||
<CETCompat>true</CETCompat>
|
||||
</Link>
|
||||
<ClCompile>
|
||||
</ClCompile>
|
||||
@ -394,6 +399,7 @@
|
||||
</ManifestFile>
|
||||
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
|
||||
<DelayLoadDLLs>uxtheme.dll</DelayLoadDLLs>
|
||||
<CETCompat>true</CETCompat>
|
||||
</Link>
|
||||
<ClCompile />
|
||||
<ClCompile>
|
||||
|
||||
98
src/Edit.c
98
src/Edit.c
@ -1787,8 +1787,6 @@ void EditURLEncode(const bool isPathConvert)
|
||||
return;
|
||||
}
|
||||
|
||||
_SAVE_TARGET_RANGE_;
|
||||
|
||||
DocPos const iSelStart = SciCall_GetSelectionStart();
|
||||
//DocPos const iSelEnd = SciCall_GetSelectionEnd();
|
||||
DocPos const iSelSize = SciCall_GetSelText(NULL) - 1; // w/o terminating zero
|
||||
@ -1846,8 +1844,6 @@ void EditURLEncode(const bool isPathConvert)
|
||||
|
||||
EndUndoTransAction();
|
||||
|
||||
_RESTORE_TARGET_RANGE_;
|
||||
|
||||
FreeMem(pszEscaped);
|
||||
FreeMem(pszEscapedW);
|
||||
}
|
||||
@ -1867,8 +1863,6 @@ void EditURLDecode(const bool isPathConvert)
|
||||
return;
|
||||
}
|
||||
|
||||
_SAVE_TARGET_RANGE_;
|
||||
|
||||
DocPos const iSelStart = SciCall_GetSelectionStart();
|
||||
//DocPos const iSelEnd = SciCall_GetSelectionEnd();
|
||||
DocPos const iSelSize = SciCall_GetSelText(NULL) - 1; // w/o terminating zero
|
||||
@ -1933,8 +1927,6 @@ void EditURLDecode(const bool isPathConvert)
|
||||
EndUndoTransAction();
|
||||
}
|
||||
|
||||
_RESTORE_TARGET_RANGE_;
|
||||
|
||||
FreeMem(pszTextW);
|
||||
FreeMem(pszUnescaped);
|
||||
FreeMem(pszUnescapedW);
|
||||
@ -1956,8 +1948,6 @@ void EditReplaceAllChr(const WCHAR chSearch, const WCHAR chReplace) {
|
||||
return;
|
||||
}
|
||||
|
||||
_SAVE_TARGET_RANGE_;
|
||||
|
||||
DocPos const iSelStart = SciCall_GetSelectionStart();
|
||||
DocPos const iSelEnd = SciCall_GetSelectionEnd();
|
||||
DocPos const iSelSize = SciCall_GetSelText(NULL) - 1; // w/o terminating zero
|
||||
@ -1996,8 +1986,6 @@ void EditReplaceAllChr(const WCHAR chSearch, const WCHAR chReplace) {
|
||||
|
||||
EndUndoTransAction();
|
||||
|
||||
_RESTORE_TARGET_RANGE_;
|
||||
|
||||
FreeMem(pwchText);
|
||||
FreeMem(pchReplace);
|
||||
}
|
||||
@ -2060,8 +2048,6 @@ void EditBase64Code(HWND hwnd, const bool bEncode, cpi_enc_t cpi) {
|
||||
base64Size = (size_t)new_size;
|
||||
}
|
||||
|
||||
_SAVE_TARGET_RANGE_;
|
||||
|
||||
UndoTransActionBegin();
|
||||
|
||||
SciCall_TargetFromSelection();
|
||||
@ -2078,8 +2064,6 @@ void EditBase64Code(HWND hwnd, const bool bEncode, cpi_enc_t cpi) {
|
||||
|
||||
EndUndoTransAction();
|
||||
|
||||
_RESTORE_TARGET_RANGE_;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -2609,13 +2593,11 @@ void EditTabsToSpaces(int nTabWidth,bool bOnlyIndentingWS)
|
||||
iCurPos = iSelStart + cchConvM;
|
||||
}
|
||||
|
||||
_SAVE_TARGET_RANGE_;
|
||||
UndoTransActionBegin();
|
||||
SciCall_SetTargetRange(iSelStart, iSelEnd);
|
||||
SciCall_ReplaceTarget(cchConvM, pszText2);
|
||||
EditSetSelectionEx(iAnchorPos, iCurPos, -1, -1);
|
||||
EndUndoTransAction();
|
||||
_RESTORE_TARGET_RANGE_;
|
||||
FreeMem(pszText2);
|
||||
}
|
||||
FreeMem(pszConvW);
|
||||
@ -2637,8 +2619,6 @@ void EditSpacesToTabs(int nTabWidth,bool bOnlyIndentingWS)
|
||||
return;
|
||||
}
|
||||
|
||||
_SAVE_TARGET_RANGE_;
|
||||
|
||||
DocPos iCurPos = SciCall_GetCurrentPos();
|
||||
DocPos iAnchorPos = SciCall_GetAnchor();
|
||||
|
||||
@ -2733,8 +2713,6 @@ void EditSpacesToTabs(int nTabWidth,bool bOnlyIndentingWS)
|
||||
FreeMem(pszText2);
|
||||
}
|
||||
|
||||
_RESTORE_TARGET_RANGE_;
|
||||
|
||||
FreeMem(pszConvW);
|
||||
}
|
||||
|
||||
@ -2988,8 +2966,6 @@ void EditModifyLines(const PENCLOSESELDATA pEnclData) {
|
||||
return;
|
||||
}
|
||||
|
||||
_SAVE_TARGET_RANGE_;
|
||||
|
||||
char mszPrefix1[256 * 3] = { '\0' };
|
||||
char mszAppend1[256 * 3] = { '\0' };
|
||||
|
||||
@ -3236,7 +3212,6 @@ void EditModifyLines(const PENCLOSESELDATA pEnclData) {
|
||||
|
||||
EndUndoTransAction();
|
||||
|
||||
_RESTORE_TARGET_RANGE_;
|
||||
}
|
||||
|
||||
|
||||
@ -3341,8 +3316,6 @@ void EditAlignText(int nMode)
|
||||
return;
|
||||
}
|
||||
|
||||
_SAVE_TARGET_RANGE_;
|
||||
|
||||
DocPos iCurPos = SciCall_GetCurrentPos();
|
||||
DocPos iAnchorPos = SciCall_GetAnchor();
|
||||
|
||||
@ -3558,7 +3531,6 @@ void EditAlignText(int nMode)
|
||||
|
||||
EndUndoTransAction();
|
||||
|
||||
_RESTORE_TARGET_RANGE_;
|
||||
}
|
||||
|
||||
|
||||
@ -3574,8 +3546,6 @@ void EditEncloseSelection(LPCWSTR pszOpen, LPCWSTR pszClose) {
|
||||
return;
|
||||
}
|
||||
|
||||
_SAVE_TARGET_RANGE_;
|
||||
|
||||
char mszOpen[ENCLDATA_SIZE * 3] = { '\0' };
|
||||
char mszClose[ENCLDATA_SIZE * 3] = { '\0' };
|
||||
|
||||
@ -3614,7 +3584,6 @@ void EditEncloseSelection(LPCWSTR pszOpen, LPCWSTR pszClose) {
|
||||
|
||||
EndUndoTransAction();
|
||||
|
||||
_RESTORE_TARGET_RANGE_;
|
||||
}
|
||||
|
||||
|
||||
@ -3624,8 +3593,6 @@ void EditEncloseSelection(LPCWSTR pszOpen, LPCWSTR pszClose) {
|
||||
//
|
||||
void EditToggleLineCommentsSimple(LPCWSTR pwszComment, bool bInsertAtStart, LnCmtMode_t mode) {
|
||||
|
||||
_SAVE_TARGET_RANGE_;
|
||||
|
||||
bool const bStraightSel = SciCall_GetAnchor() <= SciCall_GetCurrentPos();
|
||||
|
||||
DocPos const iSelStart = Sci_GetSelectionStartEx();
|
||||
@ -3743,7 +3710,6 @@ void EditToggleLineCommentsSimple(LPCWSTR pwszComment, bool bInsertAtStart, LnCm
|
||||
|
||||
EndUndoTransAction();
|
||||
|
||||
_RESTORE_TARGET_RANGE_;
|
||||
}
|
||||
|
||||
|
||||
@ -3753,8 +3719,6 @@ void EditToggleLineCommentsSimple(LPCWSTR pwszComment, bool bInsertAtStart, LnCm
|
||||
//
|
||||
void EditToggleLineCommentsExtended(LPCWSTR pwszComment, bool bInsertAtStart)
|
||||
{
|
||||
_SAVE_TARGET_RANGE_;
|
||||
|
||||
DocPos const iSelStart = Sci_GetSelectionStartEx();
|
||||
DocPos const iSelEnd = Sci_GetSelectionEndEx();
|
||||
|
||||
@ -3872,7 +3836,6 @@ void EditToggleLineCommentsExtended(LPCWSTR pwszComment, bool bInsertAtStart)
|
||||
|
||||
EndUndoTransAction();
|
||||
|
||||
_RESTORE_TARGET_RANGE_;
|
||||
}
|
||||
|
||||
|
||||
@ -3884,8 +3847,6 @@ static DocPos _AppendSpaces(HWND hwnd, DocLn iLineStart, DocLn iLineEnd, DocPos
|
||||
{
|
||||
UNREFERENCED_PARAMETER(hwnd);
|
||||
|
||||
_SAVE_TARGET_RANGE_;
|
||||
|
||||
size_t size = (size_t)iMaxColumn;
|
||||
char* pmszPadStr = AllocMem(size + 1, HEAP_ZERO_MEMORY);
|
||||
FillMemory(pmszPadStr, size, ' ');
|
||||
@ -3916,8 +3877,6 @@ static DocPos _AppendSpaces(HWND hwnd, DocLn iLineStart, DocLn iLineEnd, DocPos
|
||||
spcCount += iPadLen;
|
||||
}
|
||||
|
||||
_RESTORE_TARGET_RANGE_;
|
||||
|
||||
FreeMem(pmszPadStr);
|
||||
|
||||
return spcCount;
|
||||
@ -4044,8 +4003,6 @@ void EditStripFirstCharacter(HWND hwnd)
|
||||
return;
|
||||
}
|
||||
|
||||
_SAVE_TARGET_RANGE_;
|
||||
|
||||
DocPos const iSelStart = SciCall_IsSelectionEmpty() ? 0 : SciCall_GetSelectionStart();
|
||||
DocPos const iSelEnd = SciCall_IsSelectionEmpty() ? Sci_GetDocEndPosition() : SciCall_GetSelectionEnd();
|
||||
DocLn const iLineStart = SciCall_LineFromPosition(iSelStart);
|
||||
@ -4105,7 +4062,6 @@ void EditStripFirstCharacter(HWND hwnd)
|
||||
|
||||
EndUndoTransAction();
|
||||
|
||||
_RESTORE_TARGET_RANGE_;
|
||||
}
|
||||
|
||||
|
||||
@ -4121,8 +4077,6 @@ void EditStripLastCharacter(HWND hwnd, bool bIgnoreSelection, bool bTrailingBlan
|
||||
return;
|
||||
}
|
||||
|
||||
_SAVE_TARGET_RANGE_;
|
||||
|
||||
DocPos const iSelStart = (SciCall_IsSelectionEmpty() || bIgnoreSelection) ? 0 : SciCall_GetSelectionStart();
|
||||
DocPos const iSelEnd = (SciCall_IsSelectionEmpty() || bIgnoreSelection) ? Sci_GetDocEndPosition() : SciCall_GetSelectionEnd();
|
||||
DocLn const iLineStart = SciCall_LineFromPosition(iSelStart);
|
||||
@ -4220,9 +4174,9 @@ void EditStripLastCharacter(HWND hwnd, bool bIgnoreSelection, bool bTrailingBlan
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EndUndoTransAction();
|
||||
|
||||
_RESTORE_TARGET_RANGE_;
|
||||
}
|
||||
|
||||
|
||||
@ -4232,8 +4186,6 @@ void EditStripLastCharacter(HWND hwnd, bool bIgnoreSelection, bool bTrailingBlan
|
||||
//
|
||||
void EditCompressBlanks()
|
||||
{
|
||||
_SAVE_TARGET_RANGE_;
|
||||
|
||||
const bool bIsSelEmpty = SciCall_IsSelectionEmpty();
|
||||
|
||||
const DocPos iSelStartPos = SciCall_GetSelectionStart();
|
||||
@ -4399,7 +4351,6 @@ void EditCompressBlanks()
|
||||
FreeMem(pszOut);
|
||||
}
|
||||
|
||||
_RESTORE_TARGET_RANGE_;
|
||||
}
|
||||
|
||||
|
||||
@ -4429,8 +4380,6 @@ void EditRemoveBlankLines(HWND hwnd, bool bMerge, bool bRemoveWhiteSpace)
|
||||
--iEndLine;
|
||||
}
|
||||
|
||||
_SAVE_TARGET_RANGE_;
|
||||
|
||||
UndoTransActionBegin();
|
||||
|
||||
for (DocLn iLine = iBegLine; iLine <= iEndLine; ) {
|
||||
@ -4478,7 +4427,6 @@ void EditRemoveBlankLines(HWND hwnd, bool bMerge, bool bRemoveWhiteSpace)
|
||||
|
||||
EndUndoTransAction();
|
||||
|
||||
_RESTORE_TARGET_RANGE_;
|
||||
}
|
||||
|
||||
|
||||
@ -4495,8 +4443,6 @@ void EditRemoveDuplicateLines(HWND hwnd, bool bRemoveEmptyLines)
|
||||
return;
|
||||
}
|
||||
|
||||
_SAVE_TARGET_RANGE_;
|
||||
|
||||
DocPos const iSelStart = SciCall_GetSelectionStart();
|
||||
DocPos const iSelEnd = SciCall_GetSelectionEnd();
|
||||
|
||||
@ -4551,7 +4497,6 @@ void EditRemoveDuplicateLines(HWND hwnd, bool bRemoveEmptyLines)
|
||||
|
||||
EndUndoTransAction();
|
||||
|
||||
_RESTORE_TARGET_RANGE_;
|
||||
}
|
||||
|
||||
|
||||
@ -4667,8 +4612,6 @@ void EditFocusMarkedLinesCmd(HWND hwnd, bool bCopy, bool bDelete)
|
||||
//
|
||||
void EditWrapToColumn(DocPosU nColumn)
|
||||
{
|
||||
_SAVE_TARGET_RANGE_;
|
||||
|
||||
DocPosU const tabWidth = SciCall_GetTabWidth();
|
||||
nColumn = clamppu(nColumn, tabWidth, LONG_LINES_MARKER_LIMIT);
|
||||
|
||||
@ -4803,16 +4746,18 @@ void EditWrapToColumn(DocPosU nColumn)
|
||||
}
|
||||
|
||||
UndoTransActionBegin();
|
||||
|
||||
SciCall_SetTargetRange(iSelStart, iSelEnd);
|
||||
SciCall_ReplaceTarget(cchConvM, pszText);
|
||||
EditSetSelectionEx(iAnchorPos, iCurPos, -1, -1);
|
||||
|
||||
EndUndoTransAction();
|
||||
|
||||
FreeMem(pszText);
|
||||
}
|
||||
}
|
||||
FreeMem(pszConvW);
|
||||
|
||||
_RESTORE_TARGET_RANGE_;
|
||||
}
|
||||
|
||||
|
||||
@ -4830,8 +4775,6 @@ void EditWrapToColumnForce(HWND hwnd, DocPosU nColumn/*,int nTabWidth*/)
|
||||
return;
|
||||
}
|
||||
|
||||
_SAVE_TARGET_RANGE_;
|
||||
|
||||
size_t const size = (size_t)nColumn + 1LL;
|
||||
char const spc = ' ';
|
||||
char* const pTxt = (char* const)AllocMem(size + 1, HEAP_ZERO_MEMORY);
|
||||
@ -4840,14 +4783,15 @@ void EditWrapToColumnForce(HWND hwnd, DocPosU nColumn/*,int nTabWidth*/)
|
||||
FreeMem(pTxt);
|
||||
|
||||
UndoTransActionBegin();
|
||||
|
||||
if (SciCall_IsSelectionEmpty()) {
|
||||
SciCall_TargetWholeDocument();
|
||||
} else {
|
||||
SciCall_TargetFromSelection();
|
||||
}
|
||||
SciCall_LinesSplit(width_pix);
|
||||
|
||||
EndUndoTransAction();
|
||||
_RESTORE_TARGET_RANGE_;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -4859,12 +4803,13 @@ void EditWrapToColumnForce(HWND hwnd, DocPosU nColumn/*,int nTabWidth*/)
|
||||
void EditSplitLines(HWND hwnd)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(hwnd);
|
||||
_SAVE_TARGET_RANGE_;
|
||||
|
||||
UndoTransActionBegin();
|
||||
|
||||
SciCall_TargetFromSelection();
|
||||
SciCall_LinesSplit(0);
|
||||
|
||||
EndUndoTransAction();
|
||||
_RESTORE_TARGET_RANGE_;
|
||||
}
|
||||
|
||||
|
||||
@ -4887,8 +4832,6 @@ void EditJoinLinesEx(bool bPreserveParagraphs, bool bCRLF2Space)
|
||||
return;
|
||||
}
|
||||
|
||||
_SAVE_TARGET_RANGE_;
|
||||
|
||||
DocPos const iSelStart = SciCall_GetSelectionStart();
|
||||
DocPos const iSelEnd = SciCall_GetSelectionEnd();
|
||||
DocPos const iSelLength = (iSelEnd - iSelStart);
|
||||
@ -4942,13 +4885,14 @@ void EditJoinLinesEx(bool bPreserveParagraphs, bool bCRLF2Space)
|
||||
}
|
||||
|
||||
UndoTransActionBegin();
|
||||
|
||||
SciCall_SetTargetRange(iSelStart, iSelEnd);
|
||||
SciCall_ReplaceTarget(cchJoin, pszJoin);
|
||||
EditSetSelectionEx(iAnchorPos, iCurPos, -1, -1);
|
||||
|
||||
EndUndoTransAction();
|
||||
}
|
||||
FreeMem(pszJoin);
|
||||
_RESTORE_TARGET_RANGE_;
|
||||
}
|
||||
|
||||
|
||||
@ -5058,11 +5002,9 @@ void EditSortLines(HWND hwnd, int iSortFlags)
|
||||
return; // no selection
|
||||
}
|
||||
|
||||
_SAVE_TARGET_RANGE_;
|
||||
|
||||
bool const bIsMultiSel = Sci_IsMultiOrRectangleSelection();
|
||||
|
||||
DocPos const iSelStart = SciCall_GetSelectionStart(); //iSelStart = SciCall_PositionFromLine(iLine);
|
||||
DocPos const iSelStart = SciCall_GetSelectionStart(); //~iSelStart = SciCall_PositionFromLine(iLine);
|
||||
DocPos const iSelEnd = SciCall_GetSelectionEnd();
|
||||
//DocLn const iLine = SciCall_LineFromPosition(iSelStart);
|
||||
|
||||
@ -5266,6 +5208,7 @@ void EditSortLines(HWND hwnd, int iSortFlags)
|
||||
}
|
||||
|
||||
UndoTransActionBegin();
|
||||
|
||||
//SciCall_SetTargetRange(SciCall_PositionFromLine(iLineStart), SciCall_PositionFromLine(iLineEnd + 1));
|
||||
SciCall_SetTargetRange(SciCall_PositionFromLine(iLineStart), SciCall_GetLineEndPosition(iLineEnd));
|
||||
SciCall_ReplaceTarget(-1, pmszResult);
|
||||
@ -5275,9 +5218,9 @@ void EditSortLines(HWND hwnd, int iSortFlags)
|
||||
} else {
|
||||
EditSetSelectionEx(iAnchorPos, iCurPos, -1, -1);
|
||||
}
|
||||
|
||||
EndUndoTransAction();
|
||||
|
||||
_RESTORE_TARGET_RANGE_;
|
||||
}
|
||||
|
||||
|
||||
@ -7147,21 +7090,14 @@ void EditSelectionMultiSelectAll()
|
||||
{
|
||||
if (SciCall_GetSelText(NULL) > 1) {
|
||||
|
||||
_SAVE_TARGET_RANGE_;
|
||||
|
||||
SciCall_TargetWholeDocument();
|
||||
|
||||
SciCall_SetSearchFlags(GetMarkAllOccSearchFlags());
|
||||
|
||||
SciCall_MultipleSelectAddEach();
|
||||
|
||||
SciCall_SetMainSelection(0);
|
||||
if (SciCall_GetSelectionNAnchor(0) > SciCall_GetSelectionNCaret(0)) {
|
||||
SciCall_SwapMainAnchorCaret();
|
||||
}
|
||||
EditScrollSelectionToView();
|
||||
|
||||
_RESTORE_TARGET_RANGE_;
|
||||
}
|
||||
}
|
||||
|
||||
@ -7257,9 +7193,8 @@ bool EditReplace(HWND hwnd, LPEDITFINDREPLACE lpefr)
|
||||
return EditFindNext(hwnd, lpefr, false, false);
|
||||
}
|
||||
|
||||
_SAVE_TARGET_RANGE_;
|
||||
|
||||
UndoTransActionBegin();
|
||||
|
||||
SciCall_TargetFromSelection();
|
||||
Sci_ReplaceTarget(iReplaceMsg, -1, pszReplace);
|
||||
// move caret behind replacement
|
||||
@ -7267,9 +7202,8 @@ bool EditReplace(HWND hwnd, LPEDITFINDREPLACE lpefr)
|
||||
Globals.iReplacedOccurrences = 1;
|
||||
|
||||
EndUndoTransAction();
|
||||
FreeMem(pszReplace);
|
||||
|
||||
_RESTORE_TARGET_RANGE_;
|
||||
FreeMem(pszReplace);
|
||||
|
||||
return EditFindNext(hwnd, lpefr, false, false);
|
||||
}
|
||||
|
||||
@ -137,13 +137,6 @@ void EditDeleteMarkerInSelection();
|
||||
void EditSelectionMultiSelectAll();
|
||||
void EditSelectionMultiSelectAllEx(CLPCEDITFINDREPLACE edFndRpl);
|
||||
|
||||
// maybe removed beyond next release
|
||||
//#define _SAVE_TARGET_RANGE_ DocPos const _saveTargetBeg_ = SciCall_GetTargetStart();\
|
||||
// DocPos const _saveTargetEnd_ = SciCall_GetTargetEnd()
|
||||
//#define _RESTORE_TARGET_RANGE_ SciCall_SetTargetRange(_saveTargetBeg_, _saveTargetEnd_)
|
||||
#define _SAVE_TARGET_RANGE_
|
||||
#define _RESTORE_TARGET_RANGE_
|
||||
|
||||
//
|
||||
// Folding Functions
|
||||
//
|
||||
|
||||
@ -7191,10 +7191,8 @@ void HandleColorDefClicked(HWND hwnd, const DocPos position)
|
||||
(int)GetRValue(rgbNew), (int)GetGValue(rgbNew), (int)GetBValue(rgbNew));
|
||||
}
|
||||
|
||||
_SAVE_TARGET_RANGE_;
|
||||
SciCall_SetTargetRange(firstPos, lastPos);
|
||||
SciCall_ReplaceTarget(length, wchColor);
|
||||
_RESTORE_TARGET_RANGE_;
|
||||
|
||||
EditUpdateVisibleIndicators();
|
||||
}
|
||||
|
||||
@ -180,6 +180,7 @@
|
||||
<ManifestFile />
|
||||
<SupportUnloadOfDelayLoadedDLL>true</SupportUnloadOfDelayLoadedDLL>
|
||||
<DelayLoadDLLs>uxtheme.dll</DelayLoadDLLs>
|
||||
<CETCompat>true</CETCompat>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>
|
||||
@ -251,6 +252,7 @@
|
||||
<ManifestFile />
|
||||
<SupportUnloadOfDelayLoadedDLL>true</SupportUnloadOfDelayLoadedDLL>
|
||||
<DelayLoadDLLs>uxtheme.dll</DelayLoadDLLs>
|
||||
<CETCompat>true</CETCompat>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>
|
||||
@ -332,6 +334,7 @@
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<LinkErrorReporting>NoErrorReport</LinkErrorReporting>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
<CETCompat>true</CETCompat>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>
|
||||
@ -408,6 +411,7 @@
|
||||
<SupportUnloadOfDelayLoadedDLL>true</SupportUnloadOfDelayLoadedDLL>
|
||||
<DelayLoadDLLs>uxtheme.dll</DelayLoadDLLs>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<CETCompat>true</CETCompat>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>
|
||||
@ -488,6 +492,7 @@
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<LinkErrorReporting>NoErrorReport</LinkErrorReporting>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
<CETCompat>true</CETCompat>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>
|
||||
@ -563,6 +568,7 @@
|
||||
<SupportUnloadOfDelayLoadedDLL>true</SupportUnloadOfDelayLoadedDLL>
|
||||
<DelayLoadDLLs>uxtheme.dll</DelayLoadDLLs>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<CETCompat>true</CETCompat>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>
|
||||
|
||||
36
src/Styles.c
36
src/Styles.c
@ -2644,38 +2644,56 @@ bool Style_GetFileFilterStr(LPWSTR lpszFilter, int cchFilter, LPWSTR lpszDefExt,
|
||||
|
||||
//=============================================================================
|
||||
|
||||
static WCHAR _DefaultCodingFont[LF_FACESIZE] = { L"\0" }; // session static
|
||||
|
||||
static inline bool GetDefaultCodeFont(LPWSTR pwchFontName, int cchFont) {
|
||||
|
||||
if (StrIsNotEmpty(_DefaultCodingFont)) {
|
||||
StringCchCopy(pwchFontName, cchFont, _DefaultCodingFont);
|
||||
return true;
|
||||
}
|
||||
|
||||
LPCWSTR const FontNamePrioList[] = {
|
||||
L"Cascadia Code",
|
||||
L"Fira Code",
|
||||
L"Roboto Mono",
|
||||
L"Source Code Pro",
|
||||
L"DejaVu Sans Mono",
|
||||
L"Consolas",
|
||||
L"Lucida Console"
|
||||
};
|
||||
bool found = false;
|
||||
for (int i = 0; i < COUNTOF(FontNamePrioList); ++i) {
|
||||
unsigned const countof = COUNTOF(FontNamePrioList);
|
||||
|
||||
unsigned i = 0;
|
||||
for ( ; i < countof; ++i) {
|
||||
LPCWSTR const fontName = FontNamePrioList[i];
|
||||
if (IsFontAvailable(fontName)) {
|
||||
StringCchCopy(pwchFontName, cchFont, fontName);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
if (i >= countof) {
|
||||
StringCchCopy(pwchFontName, cchFont, L"Courier New"); // fallback
|
||||
}
|
||||
return found;
|
||||
StringCchCopy(_DefaultCodingFont, COUNTOF(_DefaultCodingFont), pwchFontName);
|
||||
|
||||
return (i < countof);
|
||||
}
|
||||
|
||||
|
||||
static WORD _wDTFSize = 9;
|
||||
static WCHAR _DefaultTextFont[LF_FACESIZE] = { L"\0" }; // session static
|
||||
|
||||
static inline unsigned GetDefaultTextFont(LPWSTR pwchFontName) {
|
||||
WORD wSize = (WORD)LF_FACESIZE;
|
||||
GetThemedDialogFont(pwchFontName, &wSize);
|
||||
return wSize;
|
||||
if (StrIsNotEmpty(_DefaultTextFont)) {
|
||||
StringCchCopy(pwchFontName, LF_FACESIZE, _DefaultTextFont);
|
||||
return _wDTFSize;
|
||||
}
|
||||
GetThemedDialogFont(pwchFontName, &_wDTFSize);
|
||||
StringCchCopy(_DefaultTextFont, COUNTOF(_DefaultTextFont), pwchFontName);
|
||||
return _wDTFSize;
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// Style_StrGetFontName()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user