+ chg: make zero based character count for statusbar configurable

+ fix: TransformBS handling in Find/Replace dialog
+ fix: German menu strings
+ add: replaced pattern counter for statusbar
+ chg: naming of some global vars
This commit is contained in:
Rainer Kottenhoff 2018-08-07 12:10:40 +02:00
parent cf75e2a116
commit 92b3868b16
7 changed files with 146 additions and 115 deletions

Binary file not shown.

Binary file not shown.

View File

@ -71,7 +71,7 @@ extern HICON g_hDlgIcon;
extern DWORD dwLastIOError;
extern bool bReplaceInitialized;
extern bool bUseOldStyleBraceMatching;
extern bool g_bUseOldStyleBraceMatching;
extern bool bUseDefaultForFileEncoding;
extern bool g_bFindReplCopySelOrClip;
@ -94,9 +94,9 @@ extern int g_iDefaultCharSet;
extern bool bLoadASCIIasUTF8;
extern bool bLoadNFOasOEM;
extern bool bAccelWordNavigation;
extern bool g_bAccelWordNavigation;
extern int iReplacedOccurrences;
extern int g_iReplacedOccurrences;
extern int g_iMarkOccurrences;
extern int g_iMarkOccurrencesCount;
extern int g_iMarkOccurrencesMaxCount;
@ -166,9 +166,9 @@ enum SortOrderMask {
extern LPMRULIST g_pMRUfind;
extern LPMRULIST g_pMRUreplace;
extern bool bMarkOccurrencesCurrentWord;
extern bool bMarkOccurrencesMatchCase;
extern bool bMarkOccurrencesMatchWords;
extern bool g_bMarkOccurrencesCurrentWord;
extern bool g_bMarkOccurrencesMatchCase;
extern bool g_bMarkOccurrencesMatchWords;
//=============================================================================
@ -3821,10 +3821,10 @@ void EditWrapToColumn(HWND hwnd,DocPos nColumn/*,int nTabWidth*/)
DocPos iLineLength = 0;
//#define W_DELIMITER L"!\"#$%&'()*+,-./:;<=>?@[\\]^`{|}~" // underscore counted as part of word
//WCHAR* W_DELIMITER = bAccelWordNavigation ? W_DelimCharsAccel : W_DelimChars;
//WCHAR* W_DELIMITER = g_bAccelWordNavigation ? W_DelimCharsAccel : W_DelimChars;
//#define ISDELIMITER(wc) StrChr(W_DELIMITER,wc)
//WCHAR* W_WHITESPACE = bAccelWordNavigation ? W_WhiteSpaceCharsAccelerated : W_WhiteSpaceCharsDefault;
//WCHAR* W_WHITESPACE = g_bAccelWordNavigation ? W_WhiteSpaceCharsAccelerated : W_WhiteSpaceCharsDefault;
//#define ISWHITE(wc) StrChr(W_WHITESPACE,wc)
#define ISWHITE(wc) StrChr(L" \t\f",wc)
@ -5016,7 +5016,7 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
//sg_pefrData = (LPEDITFINDREPLACE)lParam;
sg_pefrData = (LPEDITFINDREPLACE)GetWindowLongPtr(hwnd, DWLP_USER);
iReplacedOccurrences = 0;
g_iReplacedOccurrences = 0;
g_FindReplaceMatchFoundState = FND_NOP;
iSaveMarkOcc = bSwitchedFindReplace ? iSaveMarkOcc : g_iMarkOccurrences;
@ -5069,11 +5069,9 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
CheckDlgButton(hwnd, IDC_FINDSTART, BST_CHECKED);
if (sg_pefrData->bTransformBS) {
bSaveTFBackSlashes = sg_pefrData->bTransformBS;
CheckDlgButton(hwnd, IDC_FINDTRANSFORMBS, BST_CHECKED);
}
else
bSaveTFBackSlashes = false;
bSaveTFBackSlashes = sg_pefrData->bTransformBS;
if (sg_pefrData->fuFlags & SCFIND_REGEXP) {
CheckDlgButton(hwnd, IDC_FINDREGEXP, BST_CHECKED);
@ -5192,7 +5190,7 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_MARKOCCUR_VISIBLE, true);
EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_TOGGLE_VIEW, true);
iReplacedOccurrences = 0;
g_iReplacedOccurrences = 0;
g_FindReplaceMatchFoundState = FND_NOP;
if (EditToggleView(g_hwndEdit, false)) {
@ -5458,13 +5456,14 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
{
DialogEnableWindow(hwnd, IDC_DOT_MATCH_ALL, true);
CheckDlgButton(hwnd, IDC_WILDCARDSEARCH, BST_UNCHECKED); // Can not use wildcard search together with regexp
CheckDlgButton(hwnd, IDC_FINDTRANSFORMBS, (bSaveTFBackSlashes) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwnd, IDC_FINDTRANSFORMBS, BST_CHECKED); // transform BS handled by regex
DialogEnableWindow(hwnd, IDC_FINDTRANSFORMBS, false);
}
else { // unchecked
DialogEnableWindow(hwnd, IDC_DOT_MATCH_ALL, false);
DialogEnableWindow(hwnd, IDC_FINDTRANSFORMBS, true);
CheckDlgButton(hwnd, IDC_FINDTRANSFORMBS, (sg_pefrData->bTransformBS) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwnd, IDC_FINDTRANSFORMBS, (bSaveTFBackSlashes) ? BST_CHECKED : BST_UNCHECKED);
}
_SetSearchFlags(hwnd, sg_pefrData);
_DelayMarkAll(hwnd, 0, s_InitialSearchStart);
@ -5480,24 +5479,20 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
{
CheckDlgButton(hwnd, IDC_FINDREGEXP, BST_UNCHECKED);
DialogEnableWindow(hwnd, IDC_DOT_MATCH_ALL, false);
CheckDlgButton(hwnd, IDC_FINDTRANSFORMBS, (bSaveTFBackSlashes) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwnd, IDC_FINDTRANSFORMBS, BST_CHECKED); // transform BS handled by regex
DialogEnableWindow(hwnd, IDC_FINDTRANSFORMBS, false);
}
else { // unchecked
DialogEnableWindow(hwnd, IDC_FINDTRANSFORMBS, true);
CheckDlgButton(hwnd, IDC_FINDTRANSFORMBS, (sg_pefrData->bTransformBS) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwnd, IDC_FINDTRANSFORMBS, (bSaveTFBackSlashes) ? BST_CHECKED : BST_UNCHECKED);
}
_SetSearchFlags(hwnd, sg_pefrData);
_DelayMarkAll(hwnd, 0, s_InitialSearchStart);
break;
case IDC_FINDTRANSFORMBS:
if (IsDlgButtonChecked(hwnd, IDC_FINDTRANSFORMBS) == BST_CHECKED) {
bSaveTFBackSlashes = true;
}
else {
bSaveTFBackSlashes = false;
}
bSaveTFBackSlashes = (IsDlgButtonChecked(hwnd, IDC_FINDTRANSFORMBS) == BST_CHECKED);
_SetSearchFlags(hwnd, sg_pefrData);
_DelayMarkAll(hwnd, 0, s_InitialSearchStart);
break;
@ -5521,7 +5516,7 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
case IDC_REPLACE:
case IDC_REPLACEALL:
case IDC_REPLACEINSEL:
iReplacedOccurrences = 0;
g_iReplacedOccurrences = 0;
case IDOK:
case IDC_FINDPREV:
case IDACC_SELTONEXT:
@ -6024,10 +6019,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, bMarkOccurrencesCurrentWord, iPosStart, iPosEnd, bMarkOccurrencesMatchCase, bMarkOccurrencesMatchWords);
EditMarkAll(hwnd, NULL, g_bMarkOccurrencesCurrentWord, iPosStart, iPosEnd, g_bMarkOccurrencesMatchCase, g_bMarkOccurrencesMatchWords);
}
else {
EditMarkAll(hwnd, NULL, bMarkOccurrencesCurrentWord, 0, Sci_GetDocEndPosition(), bMarkOccurrencesMatchCase, bMarkOccurrencesMatchWords);
EditMarkAll(hwnd, NULL, g_bMarkOccurrencesCurrentWord, 0, Sci_GetDocEndPosition(), g_bMarkOccurrencesMatchCase, g_bMarkOccurrencesMatchWords);
}
_LEAVE_TARGET_TRANSACTION_;
@ -6106,7 +6101,7 @@ bool EditReplace(HWND hwnd, LPCEDITFINDREPLACE lpefr) {
DocPos start = (SciCall_IsSelectionEmpty() ? SciCall_GetCurrentPos() : SciCall_GetSelectionStart());
DocPos end = SciCall_GetTextLength();
DocPos _start = start;
iReplacedOccurrences = 0;
g_iReplacedOccurrences = 0;
const DocPos iPos = _FindInTarget(hwnd, lpefr->szFind, StringCchLenA(lpefr->szFind, FRMOD_NORM),
(int)(lpefr->fuFlags), &start, &end, false, false);
@ -6125,7 +6120,7 @@ bool EditReplace(HWND hwnd, LPCEDITFINDREPLACE lpefr) {
}
}
}
iReplacedOccurrences = 1;
g_iReplacedOccurrences = 1;
_ENTER_TARGET_TRANSACTION_;
@ -6258,17 +6253,17 @@ bool EditReplaceAll(HWND hwnd, LPCEDITFINDREPLACE lpefr, bool bShowInfo)
DocPos enlargement = 0;
BeginWaitCursor(NULL);
iReplacedOccurrences = EditReplaceAllInRange(hwnd, lpefr, start, end, &enlargement);
g_iReplacedOccurrences = EditReplaceAllInRange(hwnd, lpefr, start, end, &enlargement);
EndWaitCursor();
if (bShowInfo) {
if (iReplacedOccurrences > 0)
InfoBoxLng(0, L"MsgReplaceCount", IDS_MUI_REPLCOUNT, iReplacedOccurrences);
if (g_iReplacedOccurrences > 0)
InfoBoxLng(0, L"MsgReplaceCount", IDS_MUI_REPLCOUNT, g_iReplacedOccurrences);
else
InfoBoxLng(0, L"MsgNotFound", IDS_MUI_NOTFOUND);
}
return (iReplacedOccurrences > 0) ? true : false;
return (g_iReplacedOccurrences > 0) ? true : false;
}
@ -6293,10 +6288,10 @@ bool EditReplaceAllInSelection(HWND hwnd, LPCEDITFINDREPLACE lpefr, bool bShowIn
bool const bWaitCursor = ((end - start) > (512 * 512)) ? true : false;
if (bWaitCursor) { BeginWaitCursor(NULL); }
iReplacedOccurrences = EditReplaceAllInRange(hwnd, lpefr, start, end, &enlargement);
g_iReplacedOccurrences = EditReplaceAllInRange(hwnd, lpefr, start, end, &enlargement);
if (bWaitCursor) { EndWaitCursor(); }
if (iReplacedOccurrences > 0)
if (g_iReplacedOccurrences > 0)
{
if (currPos < anchorPos)
SciCall_SetSel(anchorPos + enlargement, currPos);
@ -6304,15 +6299,15 @@ bool EditReplaceAllInSelection(HWND hwnd, LPCEDITFINDREPLACE lpefr, bool bShowIn
SciCall_SetSel(anchorPos, currPos + enlargement);
if (bShowInfo) {
if (iReplacedOccurrences > 0)
InfoBoxLng(0, L"MsgReplaceCount", IDS_MUI_REPLCOUNT, iReplacedOccurrences);
if (g_iReplacedOccurrences > 0)
InfoBoxLng(0, L"MsgReplaceCount", IDS_MUI_REPLCOUNT, g_iReplacedOccurrences);
else
InfoBoxLng(0, L"MsgNotFound", IDS_MUI_NOTFOUND);
}
}
_END_UNDO_ACTION_;
return (iReplacedOccurrences > 0) ? true : false;
return (g_iReplacedOccurrences > 0) ? true : false;
}
@ -6442,7 +6437,7 @@ void EditMarkAll(HWND hwnd, char* pszFind, int flags, DocPos rangeStart, DocPos
// exit if selection is not a word and Match whole words only is enabled
if (bMatchWords) {
DocPos iSelStart2 = 0;
const char* delims = (bAccelWordNavigation ? DelimCharsAccel : DelimChars);
const char* delims = (g_bAccelWordNavigation ? DelimCharsAccel : DelimChars);
while ((iSelStart2 <= iSelCount) && pszText[iSelStart2]) {
if (StrChrIA(delims, pszText[iSelStart2])) {
return;
@ -6511,7 +6506,7 @@ void EditCompleteWord(HWND hwnd, bool autoInsert)
char const * ALLOWED_WORD_CHARS = AutoCompleteWordASCII;
if (ALLOWED_WORD_CHARS[0] == '\0') {
ALLOWED_WORD_CHARS = bAccelWordNavigation ? WordCharsAccelerated : WordCharsDefault;
ALLOWED_WORD_CHARS = g_bAccelWordNavigation ? WordCharsAccelerated : WordCharsDefault;
}
DocPos const iCurrentPos = SciCall_GetCurrentPos();
@ -6800,7 +6795,7 @@ static bool __fastcall _HighlightIfBrace(HWND hwnd, DocPos iPos)
// clear indicator
SendMessage(hwnd, SCI_BRACEBADLIGHT, (WPARAM)INVALID_POSITION, 0);
SendMessage(hwnd, SCI_SETHIGHLIGHTGUIDE, 0, 0);
if (!bUseOldStyleBraceMatching)
if (!g_bUseOldStyleBraceMatching)
SendMessage(hwnd, SCI_BRACEBADLIGHTINDICATOR, 0, INDIC_NP3_BAD_BRACE);
return true;
}
@ -6814,14 +6809,14 @@ static bool __fastcall _HighlightIfBrace(HWND hwnd, DocPos iPos)
DocPos col2 = SciCall_GetColumn(iBrace2);
SendMessage(hwnd, SCI_BRACEHIGHLIGHT, iPos, iBrace2);
SendMessage(hwnd, SCI_SETHIGHLIGHTGUIDE, min(col1, col2), 0);
if (!bUseOldStyleBraceMatching) {
if (!g_bUseOldStyleBraceMatching) {
SendMessage(hwnd, SCI_BRACEHIGHLIGHTINDICATOR, 1, INDIC_NP3_MATCH_BRACE);
}
}
else {
SendMessage(hwnd, SCI_BRACEBADLIGHT, iPos, 0);
SendMessage(hwnd, SCI_SETHIGHLIGHTGUIDE, 0, 0);
if (!bUseOldStyleBraceMatching) {
if (!g_bUseOldStyleBraceMatching) {
SendMessage(hwnd, SCI_BRACEBADLIGHTINDICATOR, 1, INDIC_NP3_BAD_BRACE);
}
}
@ -7649,9 +7644,9 @@ bool EditSortDlg(HWND hwnd,int* piSortFlags)
//
void EditSetAccelWordNav(HWND hwnd,bool bAccelWordNav)
{
bAccelWordNavigation = bAccelWordNav;
g_bAccelWordNavigation = bAccelWordNav;
if (bAccelWordNavigation) {
if (g_bAccelWordNavigation) {
SendMessage(hwnd, SCI_SETWORDCHARS, 0, (LPARAM)WordCharsAccelerated);
SendMessage(hwnd, SCI_SETWHITESPACECHARS, 0,(LPARAM)WhiteSpaceCharsAccelerated);
SendMessage(hwnd, SCI_SETPUNCTUATIONCHARS,0,(LPARAM)PunctuationCharsAccelerated);

View File

@ -189,25 +189,27 @@ int g_iTabWidth;
int iTabWidthG;
int g_iIndentWidth;
int iIndentWidthG;
bool bMarkLongLines;
bool g_bMarkLongLines;
int g_iLongLinesLimit;
int iLongLinesLimitG;
int iLongLineMode;
int iWrapCol = 0;
bool g_bShowSelectionMargin;
bool bShowLineNumbers;
int iReplacedOccurrences;
bool g_bShowLineNumbers;
bool g_bZeroBasedColumnIndex;
bool g_bZeroBasedCharacterCount;
int g_iReplacedOccurrences;
int g_iMarkOccurrences;
int g_iMarkOccurrencesCount;
int g_iMarkOccurrencesMaxCount;
bool g_bMarkOccurrencesMatchVisible;
bool bMarkOccurrencesMatchCase;
bool bMarkOccurrencesMatchWords;
bool bMarkOccurrencesCurrentWord;
bool bUseOldStyleBraceMatching;
bool bAutoCompleteWords;
bool bAccelWordNavigation;
bool bDenyVirtualSpaceAccess;
bool g_bMarkOccurrencesMatchCase;
bool g_bMarkOccurrencesMatchWords;
bool g_bMarkOccurrencesCurrentWord;
bool g_bUseOldStyleBraceMatching;
bool g_bAutoCompleteWords;
bool g_bAccelWordNavigation;
bool g_bDenyVirtualSpaceAccess;
bool g_bCodeFoldingAvailable;
bool g_bShowCodeFolding;
bool bViewWhiteSpace;
@ -1297,7 +1299,7 @@ HWND InitInstance(HINSTANCE hInstance,LPSTR pszCmdLine,int nCmdShow)
if (g_flagStartAsTrayIcon)
SetNotifyIconTitle(g_hwndMain);
iReplacedOccurrences = 0;
g_iReplacedOccurrences = 0;
g_iMarkOccurrencesCount = (g_iMarkOccurrences > 0) ? 0 : -1;
UpdateToolbar();
@ -1369,7 +1371,7 @@ LRESULT CALLBACK MainWndProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam)
{
if (!bAltKeyIsDown) {
bAltKeyIsDown = true;
if (!bDenyVirtualSpaceAccess) {
if (!g_bDenyVirtualSpaceAccess) {
SciCall_SetVirtualSpaceOptions(SCVS_RECTANGULARSELECTION | SCVS_NOWRAPLINESTART | SCVS_USERACCESSIBLE);
}
}
@ -1381,7 +1383,7 @@ LRESULT CALLBACK MainWndProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam)
{
if (bAltKeyIsDown) {
bAltKeyIsDown = false;
SciCall_SetVirtualSpaceOptions(bDenyVirtualSpaceAccess ? SCVS_NONE : SCVS_RECTANGULARSELECTION);
SciCall_SetVirtualSpaceOptions(g_bDenyVirtualSpaceAccess ? SCVS_NONE : SCVS_RECTANGULARSELECTION);
}
}
return DefWindowProc(hwnd, umsg, wParam, lParam);
@ -1389,7 +1391,7 @@ LRESULT CALLBACK MainWndProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam)
case WM_KILLFOCUS:
if (bAltKeyIsDown) {
bAltKeyIsDown = false;
SciCall_SetVirtualSpaceOptions(bDenyVirtualSpaceAccess ? SCVS_NONE : SCVS_RECTANGULARSELECTION);
SciCall_SetVirtualSpaceOptions(g_bDenyVirtualSpaceAccess ? SCVS_NONE : SCVS_RECTANGULARSELECTION);
}
return DefWindowProc(hwnd, umsg, wParam, lParam);
@ -1663,7 +1665,7 @@ static void __fastcall _InitializeSciEditCtrl(HWND hwndEditCtrl)
else
SendMessage(hwndEditCtrl, SCI_SETYCARETPOLICY, (WPARAM)(_CARET_SYMETRY), 0);
SendMessage(hwndEditCtrl, SCI_SETVIRTUALSPACEOPTIONS, (WPARAM)(bDenyVirtualSpaceAccess ? SCVS_NONE : SCVS_RECTANGULARSELECTION), 0);
SendMessage(hwndEditCtrl, SCI_SETVIRTUALSPACEOPTIONS, (WPARAM)(g_bDenyVirtualSpaceAccess ? SCVS_NONE : SCVS_RECTANGULARSELECTION), 0);
SendMessage(hwndEditCtrl, SCI_SETENDATLASTLINE, (WPARAM)((bScrollPastEOF) ? 0 : 1), 0);
// Tabs
@ -1680,7 +1682,7 @@ static void __fastcall _InitializeSciEditCtrl(HWND hwndEditCtrl)
_SetWordWrapping(hwndEditCtrl);
// Long Lines
if (bMarkLongLines)
if (g_bMarkLongLines)
SendMessage(hwndEditCtrl, SCI_SETEDGEMODE, (iLongLineMode == EDGE_LINE) ? EDGE_LINE : EDGE_BACKGROUND, 0);
else
SendMessage(hwndEditCtrl, SCI_SETEDGEMODE, EDGE_NONE, 0);
@ -1696,7 +1698,7 @@ static void __fastcall _InitializeSciEditCtrl(HWND hwndEditCtrl)
// word delimiter handling
EditInitWordDelimiter(hwndEditCtrl);
EditSetAccelWordNav(hwndEditCtrl, bAccelWordNavigation);
EditSetAccelWordNav(hwndEditCtrl, g_bAccelWordNavigation);
// Init default values for printing
EditPrintInit();
@ -2843,28 +2845,28 @@ void MsgInitMenu(HWND hwnd,WPARAM wParam,LPARAM lParam)
CheckCmd(hmenu,IDM_VIEW_USE2NDDEFAULT,Style_GetUse2ndDefault());
CheckCmd(hmenu,IDM_VIEW_WORDWRAP,g_bWordWrap);
CheckCmd(hmenu,IDM_VIEW_LONGLINEMARKER,bMarkLongLines);
CheckCmd(hmenu,IDM_VIEW_LONGLINEMARKER,g_bMarkLongLines);
CheckCmd(hmenu,IDM_VIEW_TABSASSPACES,g_bTabsAsSpaces);
CheckCmd(hmenu,IDM_VIEW_SHOWINDENTGUIDES,bShowIndentGuides);
CheckCmd(hmenu,IDM_VIEW_AUTOINDENTTEXT,bAutoIndent);
CheckCmd(hmenu,IDM_VIEW_LINENUMBERS,bShowLineNumbers);
CheckCmd(hmenu,IDM_VIEW_LINENUMBERS,g_bShowLineNumbers);
CheckCmd(hmenu,IDM_VIEW_MARGIN,g_bShowSelectionMargin);
CheckCmd(hmenu,IDM_VIEW_CHASING_DOCTAIL, g_bChasingDocTail);
EnableCmd(hmenu,IDM_EDIT_COMPLETEWORD,!e && !ro);
CheckCmd(hmenu,IDM_VIEW_AUTOCOMPLETEWORDS,bAutoCompleteWords && !ro);
CheckCmd(hmenu,IDM_VIEW_ACCELWORDNAV,bAccelWordNavigation);
CheckCmd(hmenu,IDM_VIEW_AUTOCOMPLETEWORDS,g_bAutoCompleteWords && !ro);
CheckCmd(hmenu,IDM_VIEW_ACCELWORDNAV,g_bAccelWordNavigation);
CheckCmd(hmenu, IDM_VIEW_MARKOCCUR_ONOFF, (g_iMarkOccurrences > 0));
CheckCmd(hmenu, IDM_VIEW_MARKOCCUR_VISIBLE, g_bMarkOccurrencesMatchVisible);
CheckCmd(hmenu, IDM_VIEW_MARKOCCUR_CASE, bMarkOccurrencesMatchCase);
CheckCmd(hmenu, IDM_VIEW_MARKOCCUR_CASE, g_bMarkOccurrencesMatchCase);
EnableCmd(hmenu, IDM_VIEW_TOGGLE_VIEW, (g_iMarkOccurrences > 0) && !g_bMarkOccurrencesMatchVisible);
CheckCmd(hmenu, IDM_VIEW_TOGGLE_VIEW, EditToggleView(g_hwndEdit, false));
if (bMarkOccurrencesMatchWords)
if (g_bMarkOccurrencesMatchWords)
i = IDM_VIEW_MARKOCCUR_WORD;
else if (bMarkOccurrencesCurrentWord)
else if (g_bMarkOccurrencesCurrentWord)
i = IDM_VIEW_MARKOCCUR_CURRENT;
else
i = IDM_VIEW_MARKOCCUR_WNONE;
@ -4611,8 +4613,8 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_VIEW_LONGLINEMARKER:
bMarkLongLines = (bMarkLongLines) ? false: true;
if (bMarkLongLines) {
g_bMarkLongLines = (g_bMarkLongLines) ? false: true;
if (g_bMarkLongLines) {
SendMessage(g_hwndEdit,SCI_SETEDGEMODE,(iLongLineMode == EDGE_LINE)?EDGE_LINE:EDGE_BACKGROUND,0);
Style_SetLongLineColors(g_hwndEdit);
}
@ -4626,7 +4628,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_VIEW_LONGLINESETTINGS:
if (LongLineSettingsDlg(hwnd,IDD_MUI_LONGLINES,&g_iLongLinesLimit)) {
bMarkLongLines = true;
g_bMarkLongLines = true;
SendMessage(g_hwndEdit, SCI_SETEDGEMODE, (iLongLineMode == EDGE_LINE) ? EDGE_LINE : EDGE_BACKGROUND, 0);
Style_SetLongLineColors(g_hwndEdit);
g_iLongLinesLimit = max(min(g_iLongLinesLimit,4096),0);
@ -4685,7 +4687,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case IDM_VIEW_LINENUMBERS:
bShowLineNumbers = (bShowLineNumbers) ? false : true;
g_bShowLineNumbers = (g_bShowLineNumbers) ? false : true;
UpdateLineNumberWidth();
break;
@ -4697,14 +4699,14 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
break;
case IDM_VIEW_AUTOCOMPLETEWORDS:
bAutoCompleteWords = (bAutoCompleteWords) ? false : true; // toggle
if (!bAutoCompleteWords)
g_bAutoCompleteWords = (g_bAutoCompleteWords) ? false : true; // toggle
if (!g_bAutoCompleteWords)
SendMessage(g_hwndEdit, SCI_AUTOCCANCEL, 0, 0); // close the auto completion list
break;
case IDM_VIEW_ACCELWORDNAV:
bAccelWordNavigation = (bAccelWordNavigation) ? false : true; // toggle
EditSetAccelWordNav(g_hwndEdit,bAccelWordNavigation);
g_bAccelWordNavigation = (g_bAccelWordNavigation) ? false : true; // toggle
EditSetAccelWordNav(g_hwndEdit,g_bAccelWordNavigation);
MarkAllOccurrences(iUpdateDelayMarkAllCoccurrences, true);
break;
@ -4733,25 +4735,25 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
break;
case IDM_VIEW_MARKOCCUR_CASE:
bMarkOccurrencesMatchCase = (bMarkOccurrencesMatchCase) ? false : true;
g_bMarkOccurrencesMatchCase = (g_bMarkOccurrencesMatchCase) ? false : true;
MarkAllOccurrences(iUpdateDelayMarkAllCoccurrences, true);
break;
case IDM_VIEW_MARKOCCUR_WNONE:
bMarkOccurrencesMatchWords = false;
bMarkOccurrencesCurrentWord = false;
g_bMarkOccurrencesMatchWords = false;
g_bMarkOccurrencesCurrentWord = false;
MarkAllOccurrences(iUpdateDelayMarkAllCoccurrences, true);
break;
case IDM_VIEW_MARKOCCUR_WORD:
bMarkOccurrencesMatchWords = true;
bMarkOccurrencesCurrentWord = false;
g_bMarkOccurrencesMatchWords = true;
g_bMarkOccurrencesCurrentWord = false;
MarkAllOccurrences(iUpdateDelayMarkAllCoccurrences, true);
break;
case IDM_VIEW_MARKOCCUR_CURRENT:
bMarkOccurrencesMatchWords = false;
bMarkOccurrencesCurrentWord = true;
g_bMarkOccurrencesMatchWords = false;
g_bMarkOccurrencesCurrentWord = true;
MarkAllOccurrences(iUpdateDelayMarkAllCoccurrences, true);
break;
@ -5446,7 +5448,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
case CMD_INCLINELIMIT:
case CMD_DECLINELIMIT:
if (!bMarkLongLines)
if (!g_bMarkLongLines)
SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_VIEW_LONGLINEMARKER,1),0);
else {
if (LOWORD(wParam) == CMD_INCLINELIMIT)
@ -6191,7 +6193,7 @@ LRESULT MsgNotify(HWND hwnd,WPARAM wParam,LPARAM lParam)
}
}
}
else if (bAutoCompleteWords && !SendMessage(g_hwndEdit, SCI_AUTOCACTIVE, 0, 0)) {
else if (g_bAutoCompleteWords && !SendMessage(g_hwndEdit, SCI_AUTOCACTIVE, 0, 0)) {
EditCompleteWord(g_hwndEdit, false);
}
}
@ -6507,9 +6509,9 @@ void LoadSettings()
bAutoIndent = IniSectionGetBool(pIniSection,L"AutoIndent",true);
bAutoCompleteWords = IniSectionGetBool(pIniSection,L"AutoCompleteWords",false);
g_bAutoCompleteWords = IniSectionGetBool(pIniSection,L"AutoCompleteWords",false);
bAccelWordNavigation = IniSectionGetBool(pIniSection, L"AccelWordNavigation", false);
g_bAccelWordNavigation = IniSectionGetBool(pIniSection, L"AccelWordNavigation", false);
bShowIndentGuides = IniSectionGetBool(pIniSection,L"ShowIndentGuides",false);
@ -6529,7 +6531,7 @@ void LoadSettings()
g_iIndentWidth = max(min(g_iIndentWidth,256),0);
iIndentWidthG = g_iIndentWidth;
bMarkLongLines = IniSectionGetBool(pIniSection,L"MarkLongLines",true);
g_bMarkLongLines = IniSectionGetBool(pIniSection,L"MarkLongLines",true);
g_iLongLinesLimit = IniSectionGetInt(pIniSection,L"LongLinesLimit",80);
g_iLongLinesLimit = max(min(g_iLongLinesLimit,4096),0);
@ -6540,17 +6542,17 @@ void LoadSettings()
g_bShowSelectionMargin = IniSectionGetBool(pIniSection,L"ShowSelectionMargin",false);
bShowLineNumbers = IniSectionGetBool(pIniSection,L"ShowLineNumbers", true);
g_bShowLineNumbers = IniSectionGetBool(pIniSection,L"ShowLineNumbers", true);
g_bShowCodeFolding = IniSectionGetBool(pIniSection,L"ShowCodeFolding", true);
g_iMarkOccurrences = IniSectionGetInt(pIniSection,L"MarkOccurrences",1);
g_iMarkOccurrences = max(min(g_iMarkOccurrences, 3), 0);
g_bMarkOccurrencesMatchVisible = IniSectionGetBool(pIniSection, L"MarkOccurrencesMatchVisible", false);
bMarkOccurrencesMatchCase = IniSectionGetBool(pIniSection,L"MarkOccurrencesMatchCase",false);
bMarkOccurrencesMatchWords = IniSectionGetBool(pIniSection,L"MarkOccurrencesMatchWholeWords",true);
bMarkOccurrencesCurrentWord = IniSectionGetBool(pIniSection, L"MarkOccurrencesCurrentWord", !bMarkOccurrencesMatchWords);
bMarkOccurrencesCurrentWord = bMarkOccurrencesCurrentWord && !bMarkOccurrencesMatchWords;
g_bMarkOccurrencesMatchCase = IniSectionGetBool(pIniSection,L"MarkOccurrencesMatchCase",false);
g_bMarkOccurrencesMatchWords = IniSectionGetBool(pIniSection,L"MarkOccurrencesMatchWholeWords",true);
g_bMarkOccurrencesCurrentWord = IniSectionGetBool(pIniSection, L"MarkOccurrencesCurrentWord", !g_bMarkOccurrencesMatchWords);
g_bMarkOccurrencesCurrentWord = g_bMarkOccurrencesCurrentWord && !g_bMarkOccurrencesMatchWords;
bViewWhiteSpace = IniSectionGetBool(pIniSection,L"ViewWhiteSpace", false);
@ -6704,8 +6706,8 @@ void LoadSettings()
iUpdateDelayMarkAllCoccurrences = IniSectionGetInt(pIniSection, L"UpdateDelayMarkAllCoccurrences", 50);
iUpdateDelayMarkAllCoccurrences = max(min(iUpdateDelayMarkAllCoccurrences, 10000), USER_TIMER_MINIMUM);
bDenyVirtualSpaceAccess = IniSectionGetBool(pIniSection, L"DenyVirtualSpaceAccess", false);
bUseOldStyleBraceMatching = IniSectionGetBool(pIniSection, L"UseOldStyleBraceMatching", false);
g_bDenyVirtualSpaceAccess = IniSectionGetBool(pIniSection, L"DenyVirtualSpaceAccess", false);
g_bUseOldStyleBraceMatching = IniSectionGetBool(pIniSection, L"UseOldStyleBraceMatching", false);
iCurrentLineHorizontalSlop = IniSectionGetInt(pIniSection, L"CurrentLineHorizontalSlop", 40);
iCurrentLineHorizontalSlop = max(min(iCurrentLineHorizontalSlop, 2000), 0);
@ -6715,6 +6717,7 @@ void LoadSettings()
IniSectionGetString(pIniSection, L"AdministrationTool.exe", L"", g_tchAdministrationExe, COUNTOF(g_tchAdministrationExe));
// --------------------------------------------------------------------------
LoadIniSection(L"Statusbar Settings", pIniSection, cchIniSection);
// --------------------------------------------------------------------------
@ -6745,7 +6748,10 @@ void LoadSettings()
IniSectionGetString(pIniSection, L"SectionWidthSpecs", STATUSBAR_SECTION_WIDTH_SPECS, tchStatusBar, COUNTOF(tchStatusBar));
ReadVectorFromString(tchStatusBar, g_iStatusbarWidthSpec, STATUS_SECTOR_COUNT, -4096, 4096, 0);
g_bZeroBasedColumnIndex = IniSectionGetBool(pIniSection, L"ZeroBasedColumnIndex", false);
g_bZeroBasedCharacterCount = IniSectionGetBool(pIniSection, L"ZeroBasedCharacterCount", false);
// --------------------------------------------------------------------------
LoadIniSection(L"Toolbar Images",pIniSection,cchIniSection);
@ -6761,6 +6767,7 @@ void LoadSettings()
int ResX = GetSystemMetrics(SM_CXSCREEN);
int ResY = GetSystemMetrics(SM_CYSCREEN);
// --------------------------------------------------------------------------
LoadIniSection(L"Window", pIniSection, cchIniSection);
// --------------------------------------------------------------------------
@ -6905,25 +6912,25 @@ void SaveSettings(bool bSaveSettingsNow) {
IniSectionSetBool(pIniSection, L"HyperlinkHotspot", g_bHyperlinkHotspot);
IniSectionSetBool(pIniSection, L"ScrollPastEOF", bScrollPastEOF);
IniSectionSetBool(pIniSection, L"AutoIndent", bAutoIndent);
IniSectionSetBool(pIniSection, L"AutoCompleteWords", bAutoCompleteWords);
IniSectionSetBool(pIniSection, L"AccelWordNavigation", bAccelWordNavigation);
IniSectionSetBool(pIniSection, L"AutoCompleteWords", g_bAutoCompleteWords);
IniSectionSetBool(pIniSection, L"AccelWordNavigation", g_bAccelWordNavigation);
IniSectionSetBool(pIniSection, L"ShowIndentGuides", bShowIndentGuides);
IniSectionSetBool(pIniSection, L"TabsAsSpaces", bTabsAsSpacesG);
IniSectionSetBool(pIniSection, L"TabIndents", bTabIndentsG);
IniSectionSetBool(pIniSection, L"BackspaceUnindents", bBackspaceUnindents);
IniSectionSetInt(pIniSection, L"TabWidth", iTabWidthG);
IniSectionSetInt(pIniSection, L"IndentWidth", iIndentWidthG);
IniSectionSetBool(pIniSection, L"MarkLongLines", bMarkLongLines);
IniSectionSetBool(pIniSection, L"MarkLongLines", g_bMarkLongLines);
IniSectionSetPos(pIniSection, L"LongLinesLimit", iLongLinesLimitG);
IniSectionSetInt(pIniSection, L"LongLineMode", iLongLineMode);
IniSectionSetBool(pIniSection, L"ShowSelectionMargin", g_bShowSelectionMargin);
IniSectionSetBool(pIniSection, L"ShowLineNumbers", bShowLineNumbers);
IniSectionSetBool(pIniSection, L"ShowLineNumbers", g_bShowLineNumbers);
IniSectionSetBool(pIniSection, L"ShowCodeFolding", g_bShowCodeFolding);
IniSectionSetInt(pIniSection, L"MarkOccurrences", g_iMarkOccurrences);
IniSectionSetBool(pIniSection, L"MarkOccurrencesMatchVisible", g_bMarkOccurrencesMatchVisible);
IniSectionSetBool(pIniSection, L"MarkOccurrencesMatchCase", bMarkOccurrencesMatchCase);
IniSectionSetBool(pIniSection, L"MarkOccurrencesMatchWholeWords", bMarkOccurrencesMatchWords);
IniSectionSetBool(pIniSection, L"MarkOccurrencesCurrentWord", bMarkOccurrencesCurrentWord);
IniSectionSetBool(pIniSection, L"MarkOccurrencesMatchCase", g_bMarkOccurrencesMatchCase);
IniSectionSetBool(pIniSection, L"MarkOccurrencesMatchWholeWords", g_bMarkOccurrencesMatchWords);
IniSectionSetBool(pIniSection, L"MarkOccurrencesCurrentWord", g_bMarkOccurrencesCurrentWord);
IniSectionSetBool(pIniSection, L"ViewWhiteSpace", bViewWhiteSpace);
IniSectionSetBool(pIniSection, L"ViewEOLs", bViewEOLs);
IniSectionSetInt(pIniSection, L"DefaultEncoding", Encoding_MapIniSetting(false, g_iDefaultNewFileEncoding));
@ -8006,10 +8013,12 @@ static void __fastcall _UpdateStatusbarDelayed(bool bForceRedraw)
static WCHAR tchCol[32] = { L'\0' };
static WCHAR tchCols[32] = { L'\0' };
DocPos const colOffset = g_bZeroBasedColumnIndex ? 0 : 1;
static DocPos s_iCol = -1;
DocPos const iCol = SciCall_GetColumn(iPos) + SciCall_GetSelectionNCaretVirtualSpace(0);
if (s_iCol != iCol) {
StringCchPrintf(tchCol, COUNTOF(tchCol), L"%td", iCol + 1);
StringCchPrintf(tchCol, COUNTOF(tchCol), L"%td", iCol + colOffset);
FormatNumberStr(tchCol);
}
@ -8017,7 +8026,7 @@ static void __fastcall _UpdateStatusbarDelayed(bool bForceRedraw)
DocPos const iLineBack = SciCall_GetLineEndPosition(iLnFromPos);
DocPos const iCols = SciCall_GetColumn(iLineBack);
if (s_iCols != iCols) {
StringCchPrintf(tchCols, COUNTOF(tchCols), L"%td", iCols + 1);
StringCchPrintf(tchCols, COUNTOF(tchCols), L"%td", iCols + colOffset);
FormatNumberStr(tchCols);
}
@ -8036,18 +8045,20 @@ static void __fastcall _UpdateStatusbarDelayed(bool bForceRedraw)
static WCHAR tchChr[32] = { L'\0' };
static WCHAR tchChrs[32] = { L'\0' };
DocPos const chrOffset = g_bZeroBasedCharacterCount ? 0 : 1;
static DocPos s_iChr = -1;
DocPos const iLineBegin = SciCall_PositionFromLine(iLnFromPos);
DocPos const iChr = SciCall_CountCharacters(iLineBegin, iPos);
if (s_iChr != iChr) {
StringCchPrintf(tchChr, COUNTOF(tchChr), L"%td", iChr);
StringCchPrintf(tchChr, COUNTOF(tchChr), L"%td", iChr + chrOffset);
FormatNumberStr(tchChr);
}
static DocPos s_iChrs = -1;
DocPos const iChrs = SciCall_CountCharacters(iLineBegin, iLineBack);
if (s_iChrs != iChrs) {
StringCchPrintf(tchChrs, COUNTOF(tchChrs), L"%td", iChrs);
StringCchPrintf(tchChrs, COUNTOF(tchChrs), L"%td", iChrs + chrOffset);
FormatNumberStr(tchChrs);
}
@ -8170,6 +8181,31 @@ static void __fastcall _UpdateStatusbarDelayed(bool bForceRedraw)
// ------------------------------------------------------
// number of replaced pattern
static WCHAR tchRepl[32] = { L'\0' };
static int s_iReplacedOccurrences = -1;
if (s_iReplacedOccurrences != g_iReplacedOccurrences)
{
if (g_iReplacedOccurrences > 0)
{
StringCchPrintf(tchRepl, COUNTOF(tchRepl), L"%i", g_iReplacedOccurrences);
FormatNumberStr(tchRepl);
}
else {
StringCchCopy(tchRepl, COUNTOF(tchRepl), L"--");
}
StringCchPrintf(tchStatusBar[STATUS_OCCREPLACE], txtWidth, L"%s%s%s",
g_mxSBPrefix[STATUS_OCCREPLACE], tchRepl, g_mxSBPostfix[STATUS_OCCREPLACE]);
s_iReplacedOccurrences = g_iReplacedOccurrences;
bIsUpdateNeeded = true;
}
// ------------------------------------------------------
// get number of bytes in current encoding
static WCHAR tchBytes[32] = { L'\0' };
static DocPos s_iTextLength = -1;
@ -8309,8 +8345,8 @@ static void __fastcall _UpdateStatusbarDelayed(bool bForceRedraw)
// update Find/Replace dialog (if any)
static WCHAR tchReplOccs[32] = { L'\0' };
if (g_hwndDlgFindReplace) {
if (iReplacedOccurrences > 0)
StringCchPrintf(tchReplOccs, COUNTOF(tchReplOccs), L"%i", iReplacedOccurrences);
if (g_iReplacedOccurrences > 0)
StringCchPrintf(tchReplOccs, COUNTOF(tchReplOccs), L"%i", g_iReplacedOccurrences);
else
StringCchCopy(tchReplOccs, COUNTOF(tchReplOccs), L"--");
@ -8337,7 +8373,7 @@ static void __fastcall _UpdateStatusbarDelayed(bool bForceRedraw)
//
void UpdateLineNumberWidth()
{
if (bShowLineNumbers)
if (g_bShowLineNumbers)
{
char chLines[32] = { '\0' };
StringCchPrintfA(chLines, COUNTOF(chLines), "_%td", (size_t)SciCall_GetLineCount());
@ -8447,7 +8483,7 @@ static int __fastcall _SaveUndoSelection()
case SC_SEL_THIN:
sel.anchorPos_undo = (DocPos)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONANCHOR, 0, 0);
sel.curPos_undo = (DocPos)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONCARET, 0, 0);
if (!bDenyVirtualSpaceAccess) {
if (!g_bDenyVirtualSpaceAccess) {
sel.anchorVS_undo = (DocPos)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE, 0, 0);
sel.curVS_undo = (DocPos)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE, 0, 0);
}
@ -8491,7 +8527,7 @@ static void __fastcall _SaveRedoSelection(int token)
case SC_SEL_THIN:
sel.anchorPos_redo = (DocPos)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONANCHOR, 0, 0);
sel.curPos_redo = (DocPos)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONCARET, 0, 0);
if (!bDenyVirtualSpaceAccess) {
if (!g_bDenyVirtualSpaceAccess) {
sel.anchorVS_redo = (DocPos)SendMessage(g_hwndEdit, SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE, 0, 0);
}
break;

View File

@ -61,7 +61,7 @@ extern bool g_bShowSelectionMargin;
extern bool g_bIniFileFromScratch;
extern int g_iMarkOccurrences;
extern bool bUseOldStyleBraceMatching;
extern bool g_bUseOldStyleBraceMatching;
extern int xCustomSchemesDlg;
extern int yCustomSchemesDlg;
@ -3536,7 +3536,7 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew)
Style_SetMargin(hwnd, pCurrentStandard->Styles[STY_MARGIN].iStyle,
pCurrentStandard->Styles[STY_MARGIN].szValue); // margin (line number, bookmarks, folding) style
if (bUseOldStyleBraceMatching) {
if (g_bUseOldStyleBraceMatching) {
Style_SetStyles(hwnd, pCurrentStandard->Styles[STY_BRACE_OK].iStyle,
pCurrentStandard->Styles[STY_BRACE_OK].szValue, false); // brace light
}
@ -3557,7 +3557,7 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew)
}
SendMessage(hwnd, SCI_INDICSETSTYLE, INDIC_NP3_MATCH_BRACE, iValue);
}
if (bUseOldStyleBraceMatching) {
if (g_bUseOldStyleBraceMatching) {
Style_SetStyles(hwnd, pCurrentStandard->Styles[STY_BRACE_BAD].iStyle,
pCurrentStandard->Styles[STY_BRACE_BAD].szValue, false); // brace bad
}
@ -3793,7 +3793,7 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew)
Style_SetMargin(hwnd, g_pLexCurrent->Styles[STY_MARGIN].iStyle,
g_pLexCurrent->Styles[STY_MARGIN].szValue); // margin (line number, bookmarks, folding) style
if (bUseOldStyleBraceMatching) {
if (g_bUseOldStyleBraceMatching) {
Style_SetStyles(hwnd, pCurrentStandard->Styles[STY_BRACE_OK].iStyle,
pCurrentStandard->Styles[STY_BRACE_OK].szValue, false);

View File

@ -100,7 +100,7 @@ typedef enum {
#define STATUSBAR_SECTION_PREFIXES L"Ln ,Col ,Sel ,Sb ,SLn ,Occ ,,,,,,,Ch ,Repl ,"
#define STATUSBAR_SECTION_POSTFIXES L",,, [UTF-8],,, [UTF-8],,,,,,,,"
#define STATUSBAR_DEFAULT_IDS L"0 1 12 2 4 5 6 7 8 9 10 11"
#define STATUSBAR_SECTION_WIDTH_SPECS L"30 20 20 20 20 20 0 0 0 0 0 0 20 0"
#define STATUSBAR_SECTION_WIDTH_SPECS L"30 20 20 20 20 20 0 0 0 0 0 0 20 20"
#define STAUSBAR_RIGHT_MARGIN 20
// --------------------------------------------------------------------------