[BUG_FIXED] Fix Lexer SearchResult syntax highlighting bug.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@656 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2010-08-27 01:01:10 +00:00
parent 6da146a4ec
commit f602782337
3 changed files with 24 additions and 14 deletions

View File

@ -512,7 +512,7 @@ void Finder::GotoFoundLine()
// Then we colourise the double clicked line
setFinderStyle();
_scintView.execute(SCI_SETLEXER, SCLEX_NULL); // yniq - this line causes a bug!!! (last line suddenly belongs to file header level (?) instead of having level=0x400)
//_scintView.execute(SCI_SETLEXER, SCLEX_NULL); // yniq - this line causes a bug!!! (last line suddenly belongs to file header level (?) instead of having level=0x400)
// later it affects DeleteResult and gotoNextFoundResult (assertions)
// fixed by calling setFinderStyle() in DeleteResult()
_scintView.execute(SCI_STYLESETEOLFILLED, SCE_SEARCHRESULT_HIGHLIGHT_LINE, true);
@ -1676,7 +1676,7 @@ void FindReplaceDlg::replaceAllInOpenedDocs()
void FindReplaceDlg::findAllIn(InWhat op)
{
//HANDLE hEvent = ::OpenEvent(EVENT_ALL_ACCESS, FALSE, TEXT("findInFilesEvent"));
bool doSetMarkingStruct = false;
if (!_pFinder)
{
_pFinder = new Finder();
@ -1711,11 +1711,6 @@ void FindReplaceDlg::findAllIn(InWhat op)
_pFinder->_scintView.showMargin(ScintillaEditView::_SC_MARGE_FOLDER, true);
//_pFinder->_scintView.execute(SCI_SETEOLMODE, SC_EOL_CRLF); // yniq - needed?
// Send the address of _MarkingsStruct to the lexer
char ptrword[sizeof(void*)*2+1];
sprintf(ptrword, "%p", &_pFinder->_MarkingsStruct);
_pFinder->_scintView.execute(SCI_SETKEYWORDS, 0, (LPARAM) ptrword);
// get the width of FindDlg
RECT findRect;
::GetWindowRect(_pFinder->getHSelf(), &findRect);
@ -1726,9 +1721,19 @@ void FindReplaceDlg::findAllIn(InWhat op)
_pFinder->_scintView.display();
_pFinder->display();
doSetMarkingStruct = true;
}
_pFinder->setFinderStyle();
if (doSetMarkingStruct)
{
// Send the address of _MarkingsStruct to the lexer
char ptrword[sizeof(void*)*2+1];
sprintf(ptrword, "%p", &_pFinder->_MarkingsStruct);
//_pFinder->_scintView.execute(SCI_SETKEYWORDS, 0, (LPARAM) ptrword);
_pFinder->_scintView.execute(SCI_SETPROPERTY, (WPARAM)"@MarkingsStruct", (LPARAM)ptrword);
}
::SendMessage(_pFinder->getHSelf(), WM_SIZE, 0, 0);
int cmdid = 0;
@ -2266,7 +2271,7 @@ void Finder::openAll()
void Finder::beginNewFilesSearch()
{
_scintView.execute(SCI_SETLEXER, SCLEX_NULL);
//_scintView.execute(SCI_SETLEXER, SCLEX_NULL);
_scintView.execute(SCI_SETCURRENTPOS, 0);
_pMainFoundInfos = _pMainFoundInfos == &_foundInfos1 ? &_foundInfos2 : &_foundInfos1;

View File

@ -110,12 +110,12 @@
#define SCLEX_POWERPRO 95
#define SCLEX_NIMROD 96
#define SCLEX_SML 97
#define SCLEX_MARKDOWN 198
#define SCLEX_TXT2TAGS 199
#define SCLEX_MARKDOWN 98
#define SCLEX_TXT2TAGS 99
#define SCLEX_SEARCHRESULT 98
#define SCLEX_OBJC 99
#define SCLEX_USER 100
#define SCLEX_SEARCHRESULT 150
#define SCLEX_OBJC 151
#define SCLEX_USER 152
#define SCLEX_AUTOMATIC 1000

View File

@ -31,6 +31,7 @@
#include "ILexer.h"
#include "LexAccessor.h"
#include "PropSetSimple.h"
#include "Accessor.h"
#include "WordList.h"
#include "Scintilla.h"
@ -103,8 +104,12 @@ static void ColouriseSearchResultDoc(unsigned int startPos, int length, int, Wor
unsigned int linePos = 0;
unsigned int startLine = startPos;
const char *addrMarkingsStruct = (styler.pprops)->Get("@MarkingsStruct");
if (!addrMarkingsStruct || !addrMarkingsStruct[0])
return;
SearchResultMarkings* pMarkings = NULL;
sscanf(keywordlists[0]->words[0], "%p", &pMarkings);
sscanf(addrMarkingsStruct, "%p", &pMarkings);
PLATFORM_ASSERT(pMarkings);
for (unsigned int i = startPos; i < startPos + length; i++) {