Merge pull request #269 from RaiKoHoff/MarkOcc

Mark Occurrences: Match Current Word (instantly)
This commit is contained in:
Derick Payne 2018-01-04 23:54:53 +02:00 committed by GitHub
commit 0e63c8d403
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 637 additions and 477 deletions

View File

@ -89,7 +89,6 @@ extern BOOL bHyperlinkHotspot;
extern int iMarkOccurrences;
extern int iMarkOccurrencesCount;
extern int iMarkOccurrencesMaxCount;
extern NP2ENCODING mEncoding[];
@ -423,7 +422,7 @@ BOOL EditSetNewEncoding(HWND hwnd,int iNewEncoding,BOOL bNoUI,BOOL bSetSavePoint
BOOL doNewEncoding = (!bNoUI) ? (InfoBox(MBYESNO, L"MsgConv1", IDS_ASK_ENCODING) == IDYES) : TRUE;
if (doNewEncoding) {
BeginWaitCursor();
BeginWaitCursor(NULL);
BOOL result = EditConvertText(hwnd,iCurrentEncoding,iNewEncoding,FALSE);
EndWaitCursor();
return result;
@ -3947,47 +3946,6 @@ void EditSortLines(HWND hwnd, int iSortFlags)
}
//=============================================================================
//
// EditJumpTo()
//
void EditJumpTo(HWND hwnd,int iNewLine,int iNewCol)
{
int iMaxLine = (int)SendMessage(hwnd,SCI_GETLINECOUNT,0,0);
// Jumpt to end with line set to -1
if (iNewLine == -1) {
SendMessage(hwnd,SCI_DOCUMENTEND,0,0);
return;
}
// Line maximum is iMaxLine
iNewLine = min(iNewLine,iMaxLine);
// Column minimum is 1
iNewCol = max(iNewCol,1);
if (iNewLine > 0 && iNewLine <= iMaxLine && iNewCol > 0)
{
int iNewPos = (int)SendMessage(hwnd,SCI_POSITIONFROMLINE,(WPARAM)iNewLine-1,0);
int iLineEndPos = (int)SendMessage(hwnd,SCI_GETLINEENDPOSITION,(WPARAM)iNewLine-1,0);
while (iNewCol-1 > SendMessage(hwnd,SCI_GETCOLUMN,(WPARAM)iNewPos,0))
{
if (iNewPos >= iLineEndPos)
break;
iNewPos = (int)SendMessage(hwnd,SCI_POSITIONAFTER,(WPARAM)iNewPos,0);
}
iNewPos = min(iNewPos,iLineEndPos);
EditSelectEx(hwnd,-1,iNewPos); // SCI_GOTOPOS(pos) is equivalent to SCI_SETSEL(-1, pos)
SendMessage(hwnd,SCI_CHOOSECARETX,0,0);
}
}
//=============================================================================
//
// EditSelectEx()
@ -4003,11 +3961,41 @@ void EditSelectEx(HWND hwnd, int iAnchorPos, int iCurrentPos)
if (iAnchorLine != iNewLine) {
SciCall_EnsureVisible(iNewLine);
}
SendMessage(hwnd,SCI_SETXCARETPOLICY,CARET_SLOP|CARET_STRICT|CARET_EVEN,50);
SendMessage(hwnd,SCI_SETYCARETPOLICY,CARET_SLOP|CARET_STRICT|CARET_EVEN,5);
SendMessage(hwnd,SCI_SETSEL,iAnchorPos,iCurrentPos);
SendMessage(hwnd,SCI_SETXCARETPOLICY,CARET_SLOP|CARET_EVEN,50);
SendMessage(hwnd,SCI_SETYCARETPOLICY,CARET_EVEN,0);
SendMessage(hwnd, SCI_SETXCARETPOLICY, CARET_SLOP | CARET_STRICT | CARET_EVEN, 50);
SendMessage(hwnd, SCI_SETYCARETPOLICY, CARET_SLOP | CARET_STRICT | CARET_EVEN, 5);
SendMessage(hwnd, SCI_SETSEL, iAnchorPos, iCurrentPos);
SendMessage(hwnd, SCI_SETXCARETPOLICY, CARET_SLOP | CARET_EVEN, 50);
SendMessage(hwnd, SCI_SETYCARETPOLICY, CARET_EVEN, 0);
}
//=============================================================================
//
// EditJumpTo()
//
void EditJumpTo(HWND hwnd,int iNewLine,int iNewCol)
{
// Jumpt to end with line set to -1
if (iNewLine < 0) {
SendMessage(hwnd, SCI_DOCUMENTEND, 0, 0);
return;
}
const int iMaxLine = SciCall_GetLineCount();
// Line maximum is iMaxLine - 1 (doc line count starts with 0)
iNewLine = (min(iNewLine, iMaxLine) - 1);
const int iLineEndPos = SciCall_GetLineEndPosition(iNewLine);
// Column minimum is 1
iNewCol = max(0, min((iNewCol - 1), iLineEndPos));
const int iNewPos = (int)SendMessage(hwnd, SCI_FINDCOLUMN, (WPARAM)iNewLine, (LPARAM)iNewCol);
EditSelectEx(hwnd, -1, iNewPos); // SCI_GOTOPOS(pos) is equivalent to SCI_SETSEL(-1, pos)
// remember x-pos for moving caret vertivally
SendMessage(hwnd, SCI_CHOOSECARETX, 0, 0);
}
@ -4301,17 +4289,21 @@ RegExResult_t __fastcall EditFindHasMatch(HWND hwnd, LPCEDITFINDREPLACE lpefr, B
char szFind[FNDRPL_BUFFER];
int slen = EditGetFindStrg(hwnd, lpefr, szFind, COUNTOF(szFind));
const int iTextLength = SciCall_GetTextLength();
int start = bFirstMatchOnly ? (int)SendMessage(hwnd, SCI_GETSELECTIONNSTART, 0, 0) : 0;
int end = (int)SendMessage(hwnd, SCI_GETTEXTLENGTH, 0, 0);
int end = iTextLength;
int iPos = EditFindInTarget(hwnd, szFind, slen, (int)(lpefr->fuFlags), &start, &end, FALSE);
if (!bFirstMatchOnly)
{
if (bMarkAll && (iPos >= 0))
EditMarkAll(hwnd, szFind, (int)(lpefr->fuFlags), FALSE, FALSE);
else
EditMarkAll(hwnd, "", 0, FALSE, FALSE);
if (bMarkAll && (iPos >= 0)) {
EditMarkAll(hwnd, szFind, (int)(lpefr->fuFlags), 0, iTextLength, FALSE, FALSE);
}
else {
EditMarkAll(hwnd, "", 0, 0, iTextLength, FALSE, FALSE);
}
}
return ((iPos >= 0) ? MATCH : ((iPos == -1) ? NO_MATCH : INVALID));
}
@ -4352,7 +4344,7 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
if (lpefr->bMarkOccurences) {
iSaveMarkOcc = iMarkOccurrences;
EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_MARKOCCURRENCES_ONOFF, FALSE);
EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_MARKOCCUR_ONOFF, FALSE);
iMarkOccurrences = 0;
CheckDlgButton(hwnd, IDC_ALL_OCCURRENCES, BST_CHECKED);
}
@ -4532,7 +4524,7 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
EditSetSearchFlags(hwnd, lpefr);
bFlagsChanged = TRUE;
SetTimer(hwnd, IDT_TIMER_MRKALL, 200, NULL);
SetTimer(hwnd, IDT_TIMER_MRKALL, 100, NULL);
}
return TRUE;
@ -4543,9 +4535,9 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
DeleteObject(hBrushBlue);
if (iSaveMarkOcc >= 0) {
EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_MARKOCCURRENCES_ONOFF, TRUE);
EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_MARKOCCUR_ONOFF, TRUE);
if (iSaveMarkOcc != 0) {
SendMessage(g_hwndMain, WM_COMMAND, (WPARAM)MAKELONG(IDM_VIEW_MARKOCCURRENCES_ONOFF, 1), 0);
SendMessage(g_hwndMain, WM_COMMAND, (WPARAM)MAKELONG(IDM_VIEW_MARKOCCUR_ONOFF, 1), 0);
}
}
KillTimer(hwnd, IDT_TIMER_MRKALL);
@ -4557,6 +4549,7 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
{
if (LOWORD(wParam) == IDT_TIMER_MRKALL)
{
KillTimer(hwnd, IDT_TIMER_MRKALL);
PostMessage(hwnd, WM_COMMAND, MAKELONG(IDC_MARKALL_OCC, 1), 0);
return TRUE;
}
@ -4569,7 +4562,7 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
lpefr = (LPEDITFINDREPLACE)GetWindowLongPtr(hwnd, DWLP_USER);
if (lpefr->bMarkOccurences) {
bFlagsChanged = TRUE;
SetTimer(hwnd, IDT_TIMER_MRKALL, 50, NULL);
SetTimer(hwnd, IDT_TIMER_MRKALL, 100, NULL);
}
else {
DialogEnableWindow(hwnd, IDC_REPLACEINSEL, !(BOOL)SendMessage(g_hwndEdit, SCI_GETSELECTIONEMPTY, 0, 0));
@ -4619,15 +4612,15 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
{
lpefr->bMarkOccurences = TRUE;
iSaveMarkOcc = iMarkOccurrences;
EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_MARKOCCURRENCES_ONOFF, FALSE);
EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_MARKOCCUR_ONOFF, FALSE);
iMarkOccurrences = 0;
}
else { // switched OFF
lpefr->bMarkOccurences = FALSE;
if (iSaveMarkOcc >= 0) {
EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_MARKOCCURRENCES_ONOFF, TRUE);
EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_MARKOCCUR_ONOFF, TRUE);
if (iSaveMarkOcc != 0) {
SendMessage(g_hwndMain, WM_COMMAND, (WPARAM)MAKELONG(IDM_VIEW_MARKOCCURRENCES_ONOFF, 1), 0);
SendMessage(g_hwndMain, WM_COMMAND, (WPARAM)MAKELONG(IDM_VIEW_MARKOCCUR_ONOFF, 1), 0);
}
}
iSaveMarkOcc = -1;
@ -4644,7 +4637,6 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
EditSetSearchFlags(hwnd, lpefr);
if (lpefr->bMarkOccurences) {
if (bFlagsChanged || (StringCchCompareXA(g_lastFind, lpefr->szFind) != 0)) {
BeginWaitCursor();
StringCchCopyA(g_lastFind, COUNTOF(g_lastFind), lpefr->szFind);
RegExResult_t match = EditFindHasMatch(g_hwndEdit, lpefr, (iSaveMarkOcc > 0), FALSE);
if (regexMatch != match) {
@ -4654,8 +4646,8 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
EditFindHasMatch(g_hwndEdit, lpefr, FALSE, TRUE);
bFlagsChanged = FALSE;
InvalidateRect(GetDlgItem(hwnd, IDC_FINDTEXT), NULL, TRUE);
EndWaitCursor();
}
UpdateStatusbar();
}
}
break;
@ -5329,7 +5321,7 @@ int EditReplaceAllInRange(HWND hwnd, LPCEDITFINDREPLACE lpefr, BOOL bShowInfo, i
int start = iStartPos;
int end = iEndPos;
BeginWaitCursor();
BeginWaitCursor(NULL);
int iPos = EditFindInTarget(hwnd, szFind, slen, (int)(lpefr->fuFlags), &start, &end, FALSE);
@ -5465,7 +5457,7 @@ BOOL EditReplaceAllInSelection(HWND hwnd,LPCEDITFINDREPLACE lpefr,BOOL bShowInfo
void EditClearAllMarks(HWND hwnd)
{
SendMessage(hwnd, SCI_SETINDICATORCURRENT, INDIC_NP3_MARK_OCCURANCE, 0);
SendMessage(hwnd, SCI_INDICATORCLEARRANGE, 0, (int)SendMessage(hwnd, SCI_GETLENGTH, 0, 0));
SendMessage(hwnd, SCI_INDICATORCLEARRANGE, 0, SciCall_GetTextLength());
iMarkOccurrencesCount = -1; // -1 !
}
@ -5473,79 +5465,103 @@ void EditClearAllMarks(HWND hwnd)
//=============================================================================
//
// EditMarkAll()
// Mark all occurrences of the text currently selected (by Aleksandar Lekov)
// Mark all occurrences of the matching text in range (by Aleksandar Lekov)
//
void EditMarkAll(HWND hwnd, char* pszFind, int flags, BOOL bMatchCase, BOOL bMatchWords)
void EditMarkAll(HWND hwnd, char* pszFind, int flags, int rangeStart, int rangeEnd, BOOL bMatchCase, BOOL bMatchWords)
{
EditClearAllMarks(hwnd);
char* pszText = NULL;
char txtBuffer[HUGE_BUFFER] = { '\0' };
int iTextLength = (int)SendMessage(hwnd, SCI_GETTEXTLENGTH, 0, 0);
int iFindLength = 0;
char* pszText = pszFind;
if (pszFind != NULL)
pszText = pszFind;
else
pszText = txtBuffer;
if (pszText == NULL) {
// get current selection
int iSelStart = (int)SendMessage(hwnd, SCI_GETSELECTIONSTART, 0, 0);
int iSelEnd = (int)SendMessage(hwnd, SCI_GETSELECTIONEND, 0, 0);
int iSelCount = iSelEnd - iSelStart;
EditClearAllMarks(hwnd);
// if nothing selected or multiple lines are selected exit
if ((iSelCount == 0) ||
(int)SendMessage(hwnd, SCI_LINEFROMPOSITION, iSelStart, 0) !=
(int)SendMessage(hwnd, SCI_LINEFROMPOSITION, iSelEnd, 0))
return;
if (pszFind == NULL) {
iFindLength = (int)SendMessage(hwnd, SCI_GETSELTEXT, 0, (LPARAM)NULL) - 1;
pszText = LocalAlloc(LPTR, iFindLength + 1);
(int)SendMessage(hwnd, SCI_GETSELTEXT, 0, (LPARAM)pszText);
if (SciCall_IsSelectionEmpty()) {
// exit if selection is not a word and Match whole words only is enabled
if (bMatchWords) {
int iSelStart2 = 0;
const char* delims = (bAccelWordNavigation ? DelimCharsAccel : DelimChars);
while ((iSelStart2 <= iSelCount) && pszText[iSelStart2]) {
if (StrChrIA(delims, pszText[iSelStart2])) {
LocalFree(pszText);
return;
}
iSelStart2++;
if (flags) { // nothing selected, get word under caret if flagged
int iCurrPos = SciCall_GetCurrentPos();
int iWordStart = (int)SendMessage(hwnd, SCI_WORDSTARTPOSITION, iCurrPos, (LPARAM)1);
int iWordEnd = (int)SendMessage(hwnd, SCI_WORDENDPOSITION, iCurrPos, (LPARAM)1);
iFindLength = (iWordEnd - iWordStart);
struct Sci_TextRange tr = { { 0, -1 }, NULL };
tr.lpstrText = pszText;
tr.chrg.cpMin = iWordStart;
tr.chrg.cpMax = iWordEnd;
SendMessage(hwnd, SCI_GETTEXTRANGE, 0, (LPARAM)&tr);
}
else {
return; // no selection and no word mark chosen
}
}
// override flags
flags = 0;
else { // selection found
if (flags) { return; } // no current word matching if we have a selection
// get current selection
int iSelStart = SciCall_GetSelectionStart();
int iSelEnd = SciCall_GetSelectionEnd();
int iSelCount = (iSelEnd - iSelStart);
// if multiple lines are selected exit
if ((SciCall_LineFromPosition(iSelStart) != SciCall_LineFromPosition(iSelEnd)) || (iSelCount >= HUGE_BUFFER)) {
return;
}
iFindLength = (int)SendMessage(hwnd, SCI_GETSELTEXT, 0, (LPARAM)pszText) - 1;
// exit if selection is not a word and Match whole words only is enabled
if (bMatchWords) {
int iSelStart2 = 0;
const char* delims = (bAccelWordNavigation ? DelimCharsAccel : DelimChars);
while ((iSelStart2 <= iSelCount) && pszText[iSelStart2]) {
if (StrChrIA(delims, pszText[iSelStart2])) {
return;
}
iSelStart2++;
}
}
}
// set additional flags
flags = flags ? SCFIND_WHOLEWORD : 0; // match current word under caret ?
flags |= (bMatchWords) ? SCFIND_WHOLEWORD : 0;
flags |= (bMatchCase ? SCFIND_MATCHCASE : 0);
flags |= (bMatchWords ? SCFIND_WHOLEWORD : 0);
}
else {
iFindLength = StringCchLenA(pszFind, FNDRPL_BUFFER);
}
if (iFindLength <= 0) return;
if (iFindLength > 0) {
int start = 0;
int end = iTextLength;
while (++iMarkOccurrencesCount < iMarkOccurrencesMaxCount)
{
int iPos = EditFindInTarget(hwnd, pszText, iFindLength, flags, &start, &end, (end == start));
const int iTextLength = SciCall_GetTextLength();
rangeStart = max(0, rangeStart);
rangeEnd = min(rangeEnd, iTextLength);
if (iPos < 0)
break; // not found
int start = rangeStart;
int end = rangeEnd;
// mark this match
SendMessage(hwnd, SCI_INDICATORFILLRANGE, iPos, (end - start));
start = end;
end = iTextLength;
do {
++iMarkOccurrencesCount;
if (start >= end)
break;
int iPos = EditFindInTarget(hwnd, pszText, iFindLength, flags, &start, &end, (end == start));
if (iPos < 0)
break; // not found
// mark this match
SendMessage(hwnd, SCI_INDICATORFILLRANGE, iPos, (end - start));
start = end;
end = rangeEnd;
} while (start < end); // < iMarkOccurrencesMaxCount
}
// free text buffer if not set from outside (pszFind)
if (pszFind == NULL)
LocalFree(pszText);
UpdateStatusbar();
}

View File

@ -123,7 +123,7 @@ void EditPrintSetup(HWND);
void EditPrintInit();
void EditMatchBrace(HWND);
void EditClearAllMarks(HWND);
void EditMarkAll(HWND,char*,int,BOOL,BOOL);
void EditMarkAll(HWND,char*,int,int,int,BOOL,BOOL);
void EditUpdateUrlHotspots(HWND, int, int, BOOL);
void EditSetAccelWordNav(HWND,BOOL);
void EditCompleteWord(HWND,BOOL);

View File

@ -37,6 +37,7 @@
#include "scintilla.h"
#include "resource.h"
#include "edit.h"
#include "notepad3.h"
#include "helpers.h"
@ -890,26 +891,28 @@ void DeleteBitmapButton(HWND hwnd,int nCtlId)
//=============================================================================
//
// StatusSetText()
// SendWMSize()
//
BOOL StatusSetText(HWND hwnd,UINT nPart,LPCWSTR lpszText)
LRESULT SendWMSize(HWND hwnd)
{
UINT uFlags = (nPart == 255) ? nPart|SBT_NOBORDERS : nPart;
return (BOOL)SendMessage(hwnd,SB_SETTEXT,uFlags,(LPARAM)lpszText);
RECT rc; GetClientRect(hwnd, &rc);
return(SendMessage(hwnd, WM_SIZE, SIZE_RESTORED,
MAKELPARAM(rc.right, rc.bottom)));
}
//=============================================================================
//
// SendWMSize()
// StatusSetText()
//
LRESULT SendWMSize(HWND hwnd)
BOOL StatusSetText(HWND hwnd,UINT nPart,LPCWSTR lpszText)
{
RECT rc; GetClientRect(hwnd,&rc);
return(SendMessage(hwnd,WM_SIZE,SIZE_RESTORED,
MAKELPARAM(rc.right,rc.bottom)));
UINT uFlags = (nPart == (UINT)STATUS_HELP) ? nPart|SBT_NOBORDERS : nPart;
if (lpszText)
return (BOOL)SendMessage(hwnd, SB_SETTEXT, uFlags, (LPARAM)lpszText);
else
return (BOOL)SendMessage(hwnd, SB_SETTEXT, uFlags, (LPARAM)L"...");
}
@ -921,7 +924,7 @@ BOOL StatusSetTextID(HWND hwnd,UINT nPart,UINT uID)
{
WCHAR szText[256] = { L'\0' };
UINT uFlags = (nPart == 255) ? nPart|SBT_NOBORDERS : nPart;
UINT uFlags = (nPart == STATUS_HELP) ? nPart|SBT_NOBORDERS : nPart;
if (!uID)
{

View File

@ -71,8 +71,9 @@ __inline BOOL IniSectionSetBool(LPWSTR lpCachedIniSection, LPCWSTR lpName, BOOL
//extern HWND g_hwndEdit;
#define BeginWaitCursor() { SendMessage(g_hwndEdit,SCI_SETCURSOR,(WPARAM)SC_CURSORWAIT,0); StatusSetText(g_hwndStatus,255,L"..."); }
#define EndWaitCursor() { POINT pt; SendMessage(g_hwndEdit,SCI_SETCURSOR,(WPARAM)SC_CURSORNORMAL,0); GetCursorPos(&pt); SetCursorPos(pt.x,pt.y); UpdateStatusbar(); }
#define BeginWaitCursor(TCH) { SendMessage(g_hwndEdit,SCI_SETCURSOR,(WPARAM)SC_CURSORWAIT,0); StatusSetText(g_hwndStatus,STATUS_HELP,(TCH)); }
#define BeginWaitCursorID(UID) { SendMessage(g_hwndEdit,SCI_SETCURSOR,(WPARAM)SC_CURSORWAIT,0); StatusSetTextID(g_hwndStatus,STATUS_HELP,(UID)); }
#define EndWaitCursor() { POINT pt; SendMessage(g_hwndEdit,SCI_SETCURSOR,(WPARAM)SC_CURSORNORMAL,0); GetCursorPos(&pt); SetCursorPos(pt.x,pt.y); StatusSetSimple(g_hwndStatus,FALSE); UpdateStatusbar(); }
//#define Is2k() (g_uWinVer >= 0x0500)

File diff suppressed because it is too large Load Diff

View File

@ -139,11 +139,13 @@ int CreateIniFile();
int CreateIniFileEx(LPCWSTR);
void MarkAllOccurrences();
void UpdateEditWndUI();
void UpdateStatusbar();
void UpdateToolbar();
void UpdateStatusbar();
void UpdateLineNumberWidth();
void UpdateSettingsCmds();
void UpdateVisibleUrlHotspot();
void InvalidateSelections();

View File

@ -302,10 +302,13 @@ BEGIN
MENUITEM "Highlight C&urrent Line\tCtrl+Shift+I", IDM_VIEW_HILITECURRENTLINE
POPUP "Mar&k Occurrences"
BEGIN
MENUITEM "&Active", IDM_VIEW_MARKOCCURRENCES_ONOFF
MENUITEM "&Active", IDM_VIEW_MARKOCCUR_ONOFF
MENUITEM SEPARATOR
MENUITEM "Match &Case", IDM_VIEW_MARKOCCURRENCES_CASE
MENUITEM "Match &Whole Words Only", IDM_VIEW_MARKOCCURRENCES_WORD
MENUITEM "Match Visible Only", IDM_VIEW_MARKOCCUR_VISIBLE
MENUITEM "Match &Case Sensitive", IDM_VIEW_MARKOCCUR_CASE
MENUITEM SEPARATOR
MENUITEM "Match &Whole Word Only", IDM_VIEW_MARKOCCUR_WORD
MENUITEM "Match Cu&rrent Word", IDM_VIEW_MARKOCCUR_CURRENT
END
MENUITEM SEPARATOR
MENUITEM "Line &Numbers\tCtrl+Shift+N", IDM_VIEW_LINENUMBERS

View File

@ -101,11 +101,15 @@ DeclareSciCallR1(PositionAfter, POSITIONAFTER, int, Sci_Position, position);
DeclareSciCallR0(GetLineCount, GETLINECOUNT, int);
DeclareSciCallR0(GetTextLength, GETTEXTLENGTH, int);
DeclareSciCallR1(LineLength, LINELENGTH, int, Sci_Position, line);
DeclareSciCallR1(LineFromPosition, LINEFROMPOSITION, int, Sci_Position, position);
DeclareSciCallR1(PositionFromLine, POSITIONFROMLINE, int, Sci_Position, line);
DeclareSciCallR1(GetLineEndPosition, GETLINEENDPOSITION, int, Sci_Position, line);
DeclareSciCallR0(GetEndStyled, GETENDSTYLED, int);
DeclareSciCallR1(GetColumn, GETCOLUMN, int, Sci_Position, position);
DeclareSciCallR0(LinesOnScreen, LINESONSCREEN, int);
DeclareSciCallR0(GetFirstVisibleLine, GETFIRSTVISIBLELINE, int);
DeclareSciCallR1(DocLineFromVisible, DOCLINEFROMVISIBLE, int, Sci_Position, line);
DeclareSciCallR1(GetCharAt, GETCHARAT, char, Sci_Position, position);

View File

@ -6,7 +6,7 @@
* Styles.c *
* Scintilla Style Management *
* Based on code from Notepad2, (c) Florian Balmer 1996-2011 *
* Mostly taken from SciTE, (c) Neil Hodgson *
* Mostly taken from SciTE, (c) Neil Hodgson *
* *
* (c) Rizonesoft 2008-2016 *
* http://www.rizonesoft.com *
@ -3256,8 +3256,14 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew) {
// global define current lexer
g_pLexCurrent = pLexNew;
if (g_pLexCurrent != &lexStandard) {
Style_SetStyles(hwnd, STYLE_DEFAULT, g_pLexCurrent->Styles[STY_DEFAULT].szValue);
if (g_pLexCurrent != &lexStandard)
{
WCHAR* wchCurrentLexerStyleStrg = g_pLexCurrent->Styles[STY_DEFAULT].szValue;
// use this font size as new base
Style_StrGetSize(wchCurrentLexerStyleStrg, &iBaseFontSize);
Style_SetBaseFontSize(hwnd, iBaseFontSize);
// merge lexer styles
Style_SetStyles(hwnd, STYLE_DEFAULT, wchCurrentLexerStyleStrg);
EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_CURRENTSCHEME, TRUE);
}
else {

View File

@ -120,6 +120,10 @@
#define IDC_ALL_OCCURRENCES 131
#define IDC_MARKALL_OCC 132
#define IDC_DOT_MATCH_ALL 133
#define IDT_TIMER_MAIN_MRKALL 134
#define IDC_MAIN_MARKALL_OCC 135
#define IDT_TIMER_UPDATE_HOTSPOT 136
#define IDC_CALL_UPDATE_HOTSPOT 137
#define IDC_BACKSLASHHELP 151
#define IDC_REGEXPHELP 152
#define IDC_WILDCARDHELP 153
@ -381,14 +385,16 @@
#define IDM_VIEW_SAVESETTINGSNOW 40444
#define IDM_VIEW_FOLDING 40445
#define IDM_VIEW_TOGGLEFOLDS 40446
#define IDM_VIEW_MARKOCCURRENCES_ONOFF 40447
#define IDM_VIEW_MARKOCCURRENCES_CASE 40448
#define IDM_VIEW_MARKOCCURRENCES_WORD 40449
#define IDM_VIEW_AUTOCOMPLETEWORDS 40450
#define IDM_VIEW_ACCELWORDNAV 40451
#define IDM_VIEW_NOPRESERVECARET 40452
#define IDM_VIEW_HYPERLINKHOTSPOTS 40453
#define IDM_VIEW_CURRENTSCHEME 40454
#define IDM_VIEW_MARKOCCUR_ONOFF 40447
#define IDM_VIEW_MARKOCCUR_CASE 40448
#define IDM_VIEW_MARKOCCUR_WORD 40449
#define IDM_VIEW_MARKOCCUR_CURRENT 40450
#define IDM_VIEW_MARKOCCUR_VISIBLE 40451
#define IDM_VIEW_AUTOCOMPLETEWORDS 40452
#define IDM_VIEW_ACCELWORDNAV 40453
#define IDM_VIEW_NOPRESERVECARET 40454
#define IDM_VIEW_HYPERLINKHOTSPOTS 40455
#define IDM_VIEW_CURRENTSCHEME 40456
#define IDM_HELP_ABOUT 40500
#define IDM_HELP_CMD 40501
#define IDM_HELP_ONLINEDOCUMENTATION 40502