diff --git a/uppsrc/CodeEditor/CHighlight.cpp b/uppsrc/CodeEditor/CHighlight.cpp index c78db3c4a..566b357f4 100644 --- a/uppsrc/CodeEditor/CHighlight.cpp +++ b/uppsrc/CodeEditor/CHighlight.cpp @@ -70,6 +70,12 @@ void CSyntax::Highlight(const wchar *ltext, const wchar *e, HighlightOutput& hls int linelen = int(e - ltext); const wchar *p = ltext; + for(const wchar *ms = p; ms < e; ms++) + if(*ms != ' ' && *ms != '\t') { + macro = macro || *ms == '#'; + break; + } + Grounding(p, e); if(highlight == HIGHLIGHT_CALC) { if(editor && line == editor->GetLineCount() - 1 || *p == '$') @@ -315,8 +321,7 @@ void CSyntax::Highlight(const wchar *ltext, const wchar *e, HighlightOutput& hls if(lbrace < 0 && lbclose >= 0) hls.SetPaper(lbclose, linelen + 1 - lbclose, lbcolor); } - if(!IsNull(cppid) && (cppid == "else" || cppid == "elif" || cppid == "endif" || cppid == "if" - || cppid == "ifdef" || cppid == "ifndef")) + if(findarg(cppid, "else", "elif", "endif", "if", "ifdef", "ifndef") >= 0) hls.SetPaper(0, hls.v.GetCount(), hl_style[PAPER_IFDEF].color); } diff --git a/uppsrc/CodeEditor/hl_color.i b/uppsrc/CodeEditor/hl_color.i index c193ea0db..97800eb6b 100644 --- a/uppsrc/CodeEditor/hl_color.i +++ b/uppsrc/CodeEditor/hl_color.i @@ -34,7 +34,7 @@ HL_COLOR(PAPER_BLOCK3, t_("Block level 3"), 0) HL_COLOR(PAPER_BLOCK4, t_("Block level 4"), 0) HL_COLOR(INK_MACRO, t_("#preprocesor text"), 1) -HL_COLOR(PAPER_MACRO, t_("#define background"), 0) +HL_COLOR(PAPER_MACRO, t_("#define/#undef/#pragma background"), 0) HL_COLOR(PAPER_IFDEF, t_("#if/#else/#endif background"), 0) HL_COLOR(INK_IFDEF, t_("#if/#else/#endif comment"), 1)