+ cln: some code cleanup

This commit is contained in:
Rainer Kottenhoff 2019-06-02 07:37:09 +02:00
parent ccc7ec738a
commit d6fde6e52c
2 changed files with 24 additions and 28 deletions

View File

@ -4377,8 +4377,8 @@ void EditSetSelectionEx(HWND hwnd, DocPos iAnchorPos, DocPos iCurrentPos, DocPos
iCurrentPos = Sci_GetDocEndPosition();
}
const DocLn iNewLine = SciCall_LineFromPosition(iCurrentPos);
const DocLn iAnchorLine = SciCall_LineFromPosition(iAnchorPos);
DocLn const iNewLine = SciCall_LineFromPosition(iCurrentPos);
DocLn const iAnchorLine = SciCall_LineFromPosition(iAnchorPos);
// Ensure that the first and last lines of a selection are always unfolded
// This needs to be done *before* the SCI_SETSEL message
@ -7885,6 +7885,22 @@ void EditSetAccelWordNav(HWND hwnd,bool bAccelWordNav)
}
//=============================================================================
//
// EditShowZeroLengthCallTip()
//
static char s_chZeroLenCT[80] = { '\0' };
void EditShowZeroLengthCallTip(HWND hwnd, DocPos iPosition)
{
UNUSED(hwnd);
if (s_chZeroLenCT[0] == '\0') {
GetLngStringW2MB(IDS_MUI_ZERO_LEN_MATCH, s_chZeroLenCT, COUNTOF(s_chZeroLenCT));
}
SciCall_CallTipShow(iPosition, s_chZeroLenCT);
Globals.CallTipType = CT_ZEROLEN_MATCH;
}
//=============================================================================
//
// EditGetBookmarkList()
@ -8230,7 +8246,7 @@ cpi_enc_t FileVars_GetEncoding(LPFILEVARS lpfv)
#define FOLD_CHILDREN SCMOD_CTRL
#define FOLD_SIBLINGS SCMOD_SHIFT
inline bool _FoldToggleNode(DocLn ln, FOLD_ACTION action)
inline bool _FoldToggleNode(const DocLn ln, const FOLD_ACTION action)
{
bool const fExpanded = SciCall_GetFoldExpanded(ln);
if ((action == SNIFF) || ((action == FOLD) && fExpanded) || ((action == EXPAND) && !fExpanded))
@ -8242,7 +8258,7 @@ inline bool _FoldToggleNode(DocLn ln, FOLD_ACTION action)
}
void __stdcall EditFoldPerformAction(DocLn ln, int mode, FOLD_ACTION action)
void EditFoldPerformAction(DocLn ln, int mode, FOLD_ACTION action)
{
bool fToggled = false;
if (action == SNIFF) {
@ -8251,9 +8267,9 @@ void __stdcall EditFoldPerformAction(DocLn ln, int mode, FOLD_ACTION action)
if (mode & (FOLD_CHILDREN | FOLD_SIBLINGS))
{
// ln/lvNode: line and level of the source of this fold action
DocLn lnNode = ln;
int lvNode = SciCall_GetFoldLevel(lnNode) & SC_FOLDLEVELNUMBERMASK;
DocLn lnTotal = SciCall_GetLineCount();
DocLn const lnNode = ln;
int const lvNode = SciCall_GetFoldLevel(lnNode) & SC_FOLDLEVELNUMBERMASK;
DocLn const lnTotal = SciCall_GetLineCount();
// lvStop: the level over which we should not cross
int lvStop = lvNode;
@ -8406,21 +8422,4 @@ void EditFoldAltArrow(FOLD_MOVE move, FOLD_ACTION action)
}
}
//=============================================================================
//
// EditShowZeroLengthCallTip()
//
static char s_chZeroLenCT[80] = { '\0' };
void EditShowZeroLengthCallTip(HWND hwnd, DocPos iPosition)
{
UNUSED(hwnd);
if (s_chZeroLenCT[0] == '\0') {
GetLngStringW2MB(IDS_MUI_ZERO_LEN_MATCH, s_chZeroLenCT, COUNTOF(s_chZeroLenCT));
}
SciCall_CallTipShow(iPosition, s_chZeroLenCT);
Globals.CallTipType = CT_ZEROLEN_MATCH;
}
/// End of Edit.c ///

View File

@ -110,12 +110,11 @@ void EditFinalizeStyling(HWND hwnd, DocPos iEndPos);
void EditUpdateUrlIndicators(HWND hwnd, DocPos startPos, DocPos endPos, bool);
void EditSetAccelWordNav(HWND hwnd,bool);
bool EditAutoCompleteWord(HWND hwnd,bool);
void EditShowZeroLengthCallTip(HWND hwnd, DocPos iPosition);
void EditGetBookmarkList(HWND hwnd,LPWSTR pszBookMarks,int cchLength);
void EditSetBookmarkList(HWND hwnd,LPCWSTR pszBookMarks);
void EditMarkAllOccurrences(HWND hwnd, bool bForceClear);
void EditHideNotMarkedLineRange(HWND hwnd, bool bHideLines);
void EditSelectionMultiSelectAll();
@ -156,11 +155,9 @@ void EditToggleFolds(FOLD_ACTION action,bool);
void EditFoldClick(DocLn ln, int mode);
void EditFoldAltArrow(FOLD_MOVE move, FOLD_ACTION action);
void EditShowZeroLengthCallTip(HWND hwnd, DocPos iPosition);
#define NP3_BRACES_TO_MATCH "()[]{}"
#define GetMarkAllOccSearchFlags() EditAddSearchFlags(0, false, false, Settings.MarkOccurrencesMatchCase,\
Settings.MarkOccurrencesCurrentWord || Settings.MarkOccurrencesMatchWholeWords, false)