[BUG_FIXED] (Author: Ivan Radić, aka Loreia) Fix a minor issue of UDL2.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@967 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2012-10-07 21:49:52 +00:00
parent 4f8122d2ef
commit cc1c928b8c
4 changed files with 50 additions and 48 deletions

View File

@ -2067,6 +2067,7 @@ void Notepad_plus::addHotSpot(bool docIsModifing)
_pEditView->execute(SCI_SETTARGETEND, endPos);
vector<pair<int, int> > hotspotStylers;
int style_hotspot = 30;
int posFound = _pEditView->execute(SCI_SEARCHINTARGET, strlen(URL_REG_EXPR), (LPARAM)URL_REG_EXPR);
@ -2079,69 +2080,69 @@ void Notepad_plus::addHotSpot(bool docIsModifing)
if (end < posBegin2style - 1)
{
if (style_hotspot > 1)
if (style_hotspot > 24)
style_hotspot--;
}
else
{
int fs = -1;
for (size_t i = 0 ; i < hotspotStylers.size() ; i++)
int fs = -1;
for (size_t i = 0 ; i < hotspotStylers.size() ; i++)
{
if (hotspotStylers[i].second == idStyle)
{
if (hotspotStylers[i].second == idStyle)
{
fs = hotspotStylers[i].first;
break;
}
fs = hotspotStylers[i].first;
break;
}
}
if (fs != -1)
{
_pEditView->execute(SCI_STARTSTYLING, start, 0xFF);
_pEditView->execute(SCI_SETSTYLING, foundTextLen, fs);
if (fs != -1)
{
_pEditView->execute(SCI_STARTSTYLING, start, 0xFF);
_pEditView->execute(SCI_SETSTYLING, foundTextLen, fs);
}
else
{
pair<int, int> p(style_hotspot, idStyle);
hotspotStylers.push_back(p);
int activeFG = 0xFF0000;
char fontNameA[128];
}
else
{
pair<int, int> p(style_hotspot, idStyle);
hotspotStylers.push_back(p);
int activeFG = 0xFF0000;
char fontNameA[128];
Style hotspotStyle;
Style hotspotStyle;
hotspotStyle._styleID = style_hotspot;
_pEditView->execute(SCI_STYLEGETFONT, idStyle, (LPARAM)fontNameA);
TCHAR *generic_fontname = new TCHAR[128];
hotspotStyle._styleID = style_hotspot;
_pEditView->execute(SCI_STYLEGETFONT, idStyle, (LPARAM)fontNameA);
TCHAR *generic_fontname = new TCHAR[128];
#ifdef UNICODE
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
const wchar_t * fontNameW = wmc->char2wchar(fontNameA, _nativeLangSpeaker.getLangEncoding());
lstrcpy(generic_fontname, fontNameW);
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
const wchar_t * fontNameW = wmc->char2wchar(fontNameA, _nativeLangSpeaker.getLangEncoding());
lstrcpy(generic_fontname, fontNameW);
#else
lstrcpy(generic_fontname, fontNameA);
lstrcpy(generic_fontname, fontNameA);
#endif
hotspotStyle._fontName = generic_fontname;
hotspotStyle._fontName = generic_fontname;
hotspotStyle._fgColor = _pEditView->execute(SCI_STYLEGETFORE, idStyle);
hotspotStyle._bgColor = _pEditView->execute(SCI_STYLEGETBACK, idStyle);
hotspotStyle._fontSize = _pEditView->execute(SCI_STYLEGETSIZE, idStyle);
hotspotStyle._fgColor = _pEditView->execute(SCI_STYLEGETFORE, idStyle);
hotspotStyle._bgColor = _pEditView->execute(SCI_STYLEGETBACK, idStyle);
hotspotStyle._fontSize = _pEditView->execute(SCI_STYLEGETSIZE, idStyle);
int isBold = _pEditView->execute(SCI_STYLEGETBOLD, idStyle);
int isItalic = _pEditView->execute(SCI_STYLEGETITALIC, idStyle);
int isUnderline = _pEditView->execute(SCI_STYLEGETUNDERLINE, idStyle);
hotspotStyle._fontStyle = (isBold?FONTSTYLE_BOLD:0) | (isItalic?FONTSTYLE_ITALIC:0) | (isUnderline?FONTSTYLE_UNDERLINE:0);
int isBold = _pEditView->execute(SCI_STYLEGETBOLD, idStyle);
int isItalic = _pEditView->execute(SCI_STYLEGETITALIC, idStyle);
int isUnderline = _pEditView->execute(SCI_STYLEGETUNDERLINE, idStyle);
hotspotStyle._fontStyle = (isBold?FONTSTYLE_BOLD:0) | (isItalic?FONTSTYLE_ITALIC:0) | (isUnderline?FONTSTYLE_UNDERLINE:0);
int urlAction = (NppParameters::getInstance())->getNppGUI()._styleURL;
if (urlAction == 2)
hotspotStyle._fontStyle |= FONTSTYLE_UNDERLINE;
int urlAction = (NppParameters::getInstance())->getNppGUI()._styleURL;
if (urlAction == 2)
hotspotStyle._fontStyle |= FONTSTYLE_UNDERLINE;
_pEditView->setHotspotStyle(hotspotStyle);
_pEditView->setHotspotStyle(hotspotStyle);
_pEditView->execute(SCI_STYLESETHOTSPOT, style_hotspot, TRUE);
_pEditView->execute(SCI_SETHOTSPOTACTIVEFORE, TRUE, activeFG);
_pEditView->execute(SCI_SETHOTSPOTSINGLELINE, style_hotspot, 0);
_pEditView->execute(SCI_STARTSTYLING, start, 0x1F);
_pEditView->execute(SCI_SETSTYLING, foundTextLen, style_hotspot);
if (style_hotspot > 1)
_pEditView->execute(SCI_STYLESETHOTSPOT, style_hotspot, TRUE);
_pEditView->execute(SCI_SETHOTSPOTACTIVEFORE, TRUE, activeFG);
_pEditView->execute(SCI_SETHOTSPOTSINGLELINE, style_hotspot, 0);
_pEditView->execute(SCI_STARTSTYLING, start, 0x1F);
_pEditView->execute(SCI_SETSTYLING, foundTextLen, style_hotspot);
if (style_hotspot > 24)
style_hotspot--;
}
}

View File

@ -405,7 +405,7 @@ public:
};
protected:
Style _styleArray[SCE_USER_STYLE_TOTAL_STYLES];
Style _styleArray[SCE_STYLE_ARRAY_SIZE];
int _nbStyler;
};

View File

@ -259,6 +259,7 @@
#define SCE_USER_STYLE_IDENTIFIER 24
#define SCE_USER_STYLE_TOTAL_STYLES SCE_USER_STYLE_IDENTIFIER
#define SCE_USER_STYLE_MAPPER_TOTAL 17
#define SCE_STYLE_ARRAY_SIZE 30 // must cover sizes of NppParameters::_lexerStyler and NppParameters::_widgetStyle
#define SCE_USER_MASK_NESTING_NONE 0
#define SCE_USER_MASK_NESTING_DELIMITER1 0x1

View File

@ -809,8 +809,8 @@ static bool isInListBackward(WordList & list, StyleContext & sc, bool specialMod
// multi-part keyword is found,
// but it must be followed by whitespace (or 'forward' keyword)
// otherwise "else if" might wrongly match "else iff"
bNext = sc.GetRelative(indexb + offset + 1);
if (isWhiteSpace2(b, nlCountTemp, wsChar, bNext))
bNext = sc.GetRelative(indexb + offset);
if (isWhiteSpace(bNext))
fwDelimiterFound = FORWARD_WHITESPACE_FOUND;
if (fwDelimiterFound == NO_DELIMITER)