--- a\np2src\src\Edit.c Sun Jun 21 00:00:00 2009 +++ b\np2src\src\Edit.c Tue Jun 23 00:27:31 2009 @@ -3297,12 +3297,24 @@ void EditJumpTo(HWND hwnd,int iNewLine,i //============================================================================= // // EditSelectEx() // void EditSelectEx(HWND hwnd,int iAnchorPos,int iCurrentPos) { + // Ensure that the first and last lines of a selection are always unfolded + // This needs to be done *before* the SCI_SETSEL message + + int iAnchorLine = SendMessage(hwnd,SCI_LINEFROMPOSITION,iAnchorPos,0); + int iCurrentLine = SendMessage(hwnd,SCI_LINEFROMPOSITION,iCurrentPos,0); + + SendMessage(hwnd,SCI_ENSUREVISIBLE,iAnchorLine,0); + + if (iAnchorLine != iCurrentLine) + SendMessage(hwnd,SCI_ENSUREVISIBLE,iCurrentLine,0); + + SendMessage(hwnd,SCI_SETXCARETPOLICY,CARET_SLOP|CARET_STRICT|CARET_EVEN,50); SendMessage(hwnd,SCI_SETSEL,iAnchorPos,iCurrentPos); SendMessage(hwnd,SCI_SETXCARETPOLICY,CARET_SLOP|CARET_EVEN,50); } --- a\np2src\src\Notepad2.c Sun Jun 21 00:00:00 2009 +++ b\np2src\src\Notepad2.c Mon Jun 22 18:08:49 2009 @@ -52,14 +52,15 @@ HWND hwndEdit; HWND hwndEditFrame; HWND hwndMain; HWND hwndFindReplace = NULL; HWND hwndNextCBChain = NULL; HWND hDlgFindReplace = NULL; -#define NUMTOOLBITMAPS 23 +#define NUMTOOLBITMAPS 24 #define NUMINITIALTOOLS 24 +#define MARGIN_FOLD_INDEX 2 TBBUTTON tbbMainWnd[] = { {0,IDT_FILE_NEW,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0}, {1,IDT_FILE_OPEN,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0}, {2,IDT_FILE_BROWSE,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0}, {3,IDT_FILE_SAVE,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0}, {0,0,0,TBSTYLE_SEP,0,0}, @@ -84,13 +85,14 @@ TBBUTTON tbbMainWnd[] = { {0,IDT_FILE_N {16,IDT_FILE_EXIT,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0}, {17,IDT_FILE_SAVEAS,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0}, {18,IDT_FILE_SAVECOPY,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0}, {19,IDT_EDIT_CLEAR,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0}, {20,IDT_FILE_PRINT,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0}, {21,IDT_FILE_OPENFAV,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0}, - {22,IDT_FILE_ADDTOFAV,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0} }; + {22,IDT_FILE_ADDTOFAV,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0}, + {23,IDT_VIEW_TOGGLEFOLDS,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0} }; WCHAR szIniFile[MAX_PATH] = L""; WCHAR szIniFile2[MAX_PATH] = L""; BOOL bSaveSettings; BOOL bSaveRecentFiles; BOOL bSaveFindReplace; @@ -124,12 +126,13 @@ BOOL bMarkLongLines; int iLongLinesLimit; int iLongLinesLimitG; int iLongLineMode; int iWrapCol = 0; BOOL bShowSelectionMargin; BOOL bShowLineNumbers; +BOOL bShowCodeFolding; BOOL bViewWhiteSpace; BOOL bViewEOLs; int iDefaultEncoding; BOOL bSkipUnicodeDetection; int iDefaultEOLMode; BOOL bFixLineEndings; @@ -1188,12 +1191,31 @@ LRESULT MsgCreate(HWND hwnd,WPARAM wPara SendMessage(hwndEdit,SCI_SETMARGINWIDTHN,2,0); SendMessage(hwndEdit,SCI_SETMARGINWIDTHN,1,(bShowSelectionMargin)?16:0); UpdateLineNumberWidth(); //SendMessage(hwndEdit,SCI_SETMARGINWIDTHN,0, // (bShowLineNumbers)?SendMessage(hwndEdit,SCI_TEXTWIDTH,STYLE_LINENUMBER,(LPARAM)L"_999999_"):0); + // Code folding + SendMessage(hwndEdit, SCI_SETMARGINTYPEN, MARGIN_FOLD_INDEX, SC_MARGIN_SYMBOL); + SendMessage(hwndEdit, SCI_SETMARGINMASKN, MARGIN_FOLD_INDEX, SC_MASK_FOLDERS); + SendMessage(hwndEdit, SCI_SETMARGINWIDTHN, MARGIN_FOLD_INDEX, (bShowCodeFolding) ? 11 : 0); + SendMessage(hwndEdit, SCI_SETPROPERTY, (WPARAM)"fold", (LPARAM)"1"); + SendMessage(hwndEdit, SCI_SETPROPERTY, (WPARAM)"fold.compact", (LPARAM)"0"); + SendMessage(hwndEdit, SCI_SETPROPERTY, (WPARAM)"fold.comment", (LPARAM)"1"); + SendMessage(hwndEdit, SCI_SETPROPERTY, (WPARAM)"fold.html", (LPARAM)"1"); + SendMessage(hwndEdit, SCI_SETPROPERTY, (WPARAM)"fold.preprocessor", (LPARAM)"1"); + SendMessage(hwndEdit, SCI_MARKERDEFINE, SC_MARKNUM_FOLDEROPEN, SC_MARK_BOXMINUS); + SendMessage(hwndEdit, SCI_MARKERDEFINE, SC_MARKNUM_FOLDER, SC_MARK_BOXPLUS); + SendMessage(hwndEdit, SCI_MARKERDEFINE, SC_MARKNUM_FOLDERSUB, SC_MARK_VLINE); + SendMessage(hwndEdit, SCI_MARKERDEFINE, SC_MARKNUM_FOLDERTAIL, SC_MARK_LCORNER); + SendMessage(hwndEdit, SCI_MARKERDEFINE, SC_MARKNUM_FOLDEREND, SC_MARK_BOXPLUSCONNECTED); + SendMessage(hwndEdit, SCI_MARKERDEFINE, SC_MARKNUM_FOLDEROPENMID, SC_MARK_BOXMINUSCONNECTED); + SendMessage(hwndEdit, SCI_MARKERDEFINE, SC_MARKNUM_FOLDERMIDTAIL, SC_MARK_TCORNER); + SendMessage(hwndEdit, SCI_SETFOLDFLAGS, 16, 0); + SendMessage(hwndEdit, SCI_SETMARGINSENSITIVEN, MARGIN_FOLD_INDEX, 1); + // Nonprinting characters SendMessage(hwndEdit,SCI_SETVIEWWS,(bViewWhiteSpace)?SCWS_VISIBLEALWAYS:SCWS_INVISIBLE,0); SendMessage(hwndEdit,SCI_SETVIEWEOL,bViewEOLs,0); hwndEditFrame = CreateWindowEx( WS_EX_CLIENTEDGE, @@ -1723,12 +1745,14 @@ void MsgInitMenu(HWND hwnd,WPARAM wParam CheckCmd(hmenu,IDM_VIEW_LONGLINEMARKER,bMarkLongLines); CheckCmd(hmenu,IDM_VIEW_TABSASSPACES,bTabsAsSpaces); CheckCmd(hmenu,IDM_VIEW_SHOWINDENTGUIDES,bShowIndentGuides); CheckCmd(hmenu,IDM_VIEW_AUTOINDENTTEXT,bAutoIndent); CheckCmd(hmenu,IDM_VIEW_LINENUMBERS,bShowLineNumbers); CheckCmd(hmenu,IDM_VIEW_MARGIN,bShowSelectionMargin); + CheckCmd(hmenu,IDM_VIEW_FOLDING,bShowCodeFolding); + EnableCmd(hmenu,IDM_VIEW_TOGGLEFOLDS,bShowCodeFolding); CheckCmd(hmenu,IDM_VIEW_SHOWWHITESPACE,bViewWhiteSpace); CheckCmd(hmenu,IDM_VIEW_SHOWEOLS,bViewEOLs); CheckCmd(hmenu,IDM_VIEW_WORDWRAPSYMBOLS,bShowWordWrapSymbols); CheckCmd(hmenu,IDM_VIEW_MATCHBRACES,bMatchBraces); CheckCmd(hmenu,IDM_VIEW_TOOLBAR,bShowToolbar); EnableCmd(hmenu,IDM_VIEW_CUSTOMIZETB,bShowToolbar); @@ -3192,12 +3216,48 @@ LRESULT MsgCommand(HWND hwnd,WPARAM wPar case IDM_VIEW_MARGIN: bShowSelectionMargin = (bShowSelectionMargin) ? FALSE : TRUE; SendMessage(hwndEdit,SCI_SETMARGINWIDTHN,1,(bShowSelectionMargin)?16:0); break; + case IDM_VIEW_FOLDING: + bShowCodeFolding = (bShowCodeFolding) ? FALSE : TRUE; + SendMessage(hwndEdit, SCI_SETMARGINWIDTHN, MARGIN_FOLD_INDEX, (bShowCodeFolding) ? 11 : 0); + UpdateToolbar(); + + // If we are disabling code folding, then we should expand all folds, + // which is why this break is conditional, so that we can fall through to + // IDM_VIEW_TOGGLEFOLDS, which will expand all folds if !bShowCodeFolding. + if (bShowCodeFolding) + break; + + + case IDM_VIEW_TOGGLEFOLDS: + { + // mode: 0 == sniff, -1 == expand all, 1 == fold all + int mode = (bShowCodeFolding) ? 0 : -1; + int i, iLines = SendMessage(hwndEdit, SCI_GETLINECOUNT, 0, 0); + + for (i = 0; i < iLines; ++i) + { + if (SendMessage(hwndEdit, SCI_GETFOLDLEVEL, i, 0) & SC_FOLDLEVELHEADERFLAG) + { + BOOL fExpanded = SendMessage(hwndEdit, SCI_GETFOLDEXPANDED, i, 0); + + if (mode == 0) + mode = fExpanded ? 1 : -1; + + if ((mode == 1 && fExpanded) || (mode == -1 && !fExpanded)) + SendMessage(hwndEdit, SCI_TOGGLEFOLD, i, 0); + } + } + + break; + } + + case IDM_VIEW_SHOWWHITESPACE: bViewWhiteSpace = (bViewWhiteSpace) ? FALSE : TRUE; SendMessage(hwndEdit,SCI_SETVIEWWS,(bViewWhiteSpace)?SCWS_VISIBLEALWAYS:SCWS_INVISIBLE,0); break; @@ -4100,12 +4160,20 @@ LRESULT MsgCommand(HWND hwnd,WPARAM wPar if (IsCmdEnabled(hwnd,IDM_FILE_ADDTOFAV)) SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_FILE_ADDTOFAV,1),0); else MessageBeep(0); break; + + case IDT_VIEW_TOGGLEFOLDS: + if (IsCmdEnabled(hwnd,IDM_VIEW_TOGGLEFOLDS)) + SendMessage(hwnd,WM_COMMAND,MAKELONG(IDM_VIEW_TOGGLEFOLDS,1),0); + else + MessageBeep(0); + break; + } return(0); } @@ -4320,12 +4388,21 @@ LRESULT MsgNotify(HWND hwnd,WPARAM wPara case SCN_SAVEPOINTLEFT: bModified = TRUE; SetWindowTitle(hwnd,uidsAppTitle,IDS_UNTITLED,szCurFile, iPathNameFormat,bModified || iCodePage != iInitialCP, IDS_READONLY,bReadOnly,szTitleExcerpt); break; + + case SCN_MARGINCLICK: + if (scn->margin == MARGIN_FOLD_INDEX) + { + INT_PTR iCurLine = SendMessage(hwndEdit, SCI_LINEFROMPOSITION, scn->position, 0); + if (SendMessage(hwndEdit, SCI_GETFOLDLEVEL, iCurLine, 0) & SC_FOLDLEVELHEADERFLAG) + SendMessage(hwndEdit, SCI_TOGGLEFOLD, iCurLine, 0); + } + break; } break; case IDC_TOOLBAR: @@ -4574,12 +4651,15 @@ void LoadSettings() bShowSelectionMargin = IniSectionGetInt(pIniSection,L"ShowSelectionMargin",0); if (bShowSelectionMargin) bShowSelectionMargin = 1; bShowLineNumbers = IniSectionGetInt(pIniSection,L"ShowLineNumbers",1); if (bShowLineNumbers) bShowLineNumbers = 1; + bShowCodeFolding = IniSectionGetInt(pIniSection,L"ShowCodeFolding",0); + if (bShowCodeFolding) bShowCodeFolding = 1; + bViewWhiteSpace = IniSectionGetInt(pIniSection,L"ViewWhiteSpace",0); if (bViewWhiteSpace) bViewWhiteSpace = 1; bViewEOLs = IniSectionGetInt(pIniSection,L"ViewEOLs",0); if (bViewEOLs) bViewEOLs = 1; @@ -4795,12 +4875,13 @@ void SaveSettings(BOOL bSaveSettingsNow) IniSectionSetInt(pIniSection,L"IndentWidth",iIndentWidthG); IniSectionSetInt(pIniSection,L"MarkLongLines",bMarkLongLines); IniSectionSetInt(pIniSection,L"LongLinesLimit",iLongLinesLimitG); IniSectionSetInt(pIniSection,L"LongLineMode",iLongLineMode); IniSectionSetInt(pIniSection,L"ShowSelectionMargin",bShowSelectionMargin); IniSectionSetInt(pIniSection,L"ShowLineNumbers",bShowLineNumbers); + IniSectionSetInt(pIniSection,L"ShowCodeFolding",bShowCodeFolding); IniSectionSetInt(pIniSection,L"ViewWhiteSpace",bViewWhiteSpace); IniSectionSetInt(pIniSection,L"ViewEOLs",bViewEOLs); IniSectionSetInt(pIniSection,L"DefaultEncoding",iDefaultEncoding); IniSectionSetInt(pIniSection,L"SkipUnicodeDetection",bSkipUnicodeDetection); IniSectionSetInt(pIniSection,L"DefaultEOLMode",iDefaultEOLMode); IniSectionSetInt(pIniSection,L"FixLineEndings",bFixLineEndings); @@ -5446,12 +5527,14 @@ void UpdateToolbar() i = SendMessage(hwndEdit,SCI_GETLENGTH,0,0); EnableTool(IDT_EDIT_FIND,i); //EnableTool(IDT_EDIT_FINDNEXT,i); //EnableTool(IDT_EDIT_FINDPREV,i && lstrlen(efrData.szFind)); EnableTool(IDT_EDIT_REPLACE,i /*&& !bReadOnly*/); EnableTool(IDT_EDIT_CLEAR,i /*&& !bReadOnly*/); + + EnableTool(IDT_VIEW_TOGGLEFOLDS,bShowCodeFolding); CheckTool(IDT_VIEW_WORDWRAP,fWordWrap); } --- a\np2src\src\Notepad2.rc Mon Jun 22 13:51:40 2009 +++ b\np2src\src\Notepad2.rc Mon Jun 22 17:26:40 2009 @@ -254,12 +254,15 @@ BEGIN MENUITEM "Highlight C&urrent Line\tCtrl+Shift+I", IDM_VIEW_HILITECURRENTLINE MENUITEM SEPARATOR MENUITEM "Line &Numbers\tCtrl+Shift+N", IDM_VIEW_LINENUMBERS MENUITEM "Selection &Margin\tCtrl+Shift+M", IDM_VIEW_MARGIN MENUITEM SEPARATOR + MENUITEM "Code &Folding\tCtrl+Shift+Alt+F", IDM_VIEW_FOLDING + MENUITEM "&Toggle All Folds\tCtrl+Shift+F", IDM_VIEW_TOGGLEFOLDS + MENUITEM SEPARATOR MENUITEM "Zoom &In\tCtrl++", IDM_VIEW_ZOOMIN MENUITEM "Zoom &Out\tCtrl+-", IDM_VIEW_ZOOMOUT MENUITEM "Reset &Zoom\tCtrl+/", IDM_VIEW_RESETZOOM END POPUP "&Settings" BEGIN @@ -383,12 +386,16 @@ BEGIN NOINVERT "E", IDM_EDIT_COPYADD, VIRTKEY, CONTROL, NOINVERT "E", IDM_EDIT_ESCAPECCHARS, VIRTKEY, CONTROL, ALT, NOINVERT "E", IDM_EDIT_URLENCODE, VIRTKEY, SHIFT, CONTROL, NOINVERT "F", IDM_EDIT_FIND, VIRTKEY, CONTROL, NOINVERT + "F", IDM_VIEW_FOLDING, VIRTKEY, SHIFT, CONTROL, ALT, + NOINVERT + "F", IDM_VIEW_TOGGLEFOLDS, VIRTKEY, SHIFT, CONTROL, + NOINVERT "G", IDM_EDIT_GOTOLINE, VIRTKEY, CONTROL, NOINVERT "G", IDM_VIEW_SHOWINDENTGUIDES, VIRTKEY, SHIFT, CONTROL, NOINVERT "H", IDM_EDIT_REPLACE, VIRTKEY, CONTROL, NOINVERT "H", IDM_FILE_RECENT, VIRTKEY, ALT, NOINVERT "H", IDM_VIEW_AUTOCLOSETAGS, VIRTKEY, SHIFT, CONTROL, @@ -1331,12 +1338,13 @@ END STRINGTABLE BEGIN IDT_FILE_PRINT "Print" IDT_FILE_OPENFAV "Favorites" IDT_FILE_ADDTOFAV "Add to Favorites" + IDT_VIEW_TOGGLEFOLDS "Toggle All Folds" END STRINGTABLE BEGIN IDS_ERR_LOADFILE "Error loading ""%s""!\nMake sure the file is not locked by another application." IDS_ERR_SAVEFILE "Error saving ""%s""!\nProbably the file is locked by another application." --- a\np2src\src\resource.h Sun Jun 21 00:00:00 2009 +++ b\np2src\src\resource.h Mon Jun 22 16:55:49 2009 @@ -290,12 +290,14 @@ #define IDM_VIEW_NOSAVEFINDREPL 40439 #define IDM_VIEW_TOOLBAR 40440 #define IDM_VIEW_CUSTOMIZETB 40441 #define IDM_VIEW_STATUSBAR 40442 #define IDM_VIEW_SAVESETTINGS 40443 #define IDM_VIEW_SAVESETTINGSNOW 40444 +#define IDM_VIEW_FOLDING 40445 +#define IDM_VIEW_TOGGLEFOLDS 40446 #define IDM_HELP_ABOUT 40500 #define IDM_TRAY_RESTORE 40600 #define IDM_TRAY_EXIT 40601 #define IDT_FILE_NEW 40700 #define IDT_FILE_OPEN 40701 #define IDT_FILE_BROWSE 40702 @@ -316,12 +318,13 @@ #define IDT_FILE_SAVEAS 40717 #define IDT_FILE_SAVECOPY 40718 #define IDT_EDIT_CLEAR 40719 #define IDT_FILE_PRINT 40720 #define IDT_FILE_OPENFAV 40721 #define IDT_FILE_ADDTOFAV 40722 +#define IDT_VIEW_TOGGLEFOLDS 40723 #define SC_SAVEPOS 40800 #define SC_RESETPOS 40801 #define IDS_ERR_LOADFILE 50000 #define IDS_ERR_SAVEFILE 50001 #define IDS_ERR_BROWSE 50002 #define IDS_ERR_MRUDLG 50003 --- a\np2src\src\Styles.c Tue Mar 10 00:00:00 2009 +++ b\np2src\src\Styles.c Tue Mar 10 17:15:14 2009 @@ -1481,19 +1481,54 @@ void Style_SetLexer(HWND hwnd,PEDITLEXER if (SendMessage(hwnd,SCI_GETEDGEMODE,0,0) == EDGE_LINE) { if (Style_StrGetColor(TRUE,lexDefault.Styles[11+iIdx].szValue,&rgb)) // edge fore SendMessage(hwnd,SCI_SETEDGECOLOUR,rgb,0); else SendMessage(hwnd,SCI_SETEDGECOLOUR,GetSysColor(COLOR_3DLIGHT),0); - } + } else { if (Style_StrGetColor(FALSE,lexDefault.Styles[11+iIdx].szValue,&rgb)) // edge back SendMessage(hwnd,SCI_SETEDGECOLOUR,rgb,0); else SendMessage(hwnd,SCI_SETEDGECOLOUR,GetSysColor(COLOR_3DLIGHT),0); - } + } + + { // set folding style; braces are for scoping only + static const int iMarkerIDs[] = + { + SC_MARKNUM_FOLDEROPEN, + SC_MARKNUM_FOLDER, + SC_MARKNUM_FOLDERSUB, + SC_MARKNUM_FOLDERTAIL, + SC_MARKNUM_FOLDEREND, + SC_MARKNUM_FOLDEROPENMID, + SC_MARKNUM_FOLDERMIDTAIL + }; + + int i; + + COLORREF clrFore = SendMessage(hwnd, SCI_STYLEGETFORE, STYLE_DEFAULT, 0); + COLORREF clrBack = SendMessage(hwnd, SCI_STYLEGETBACK, STYLE_DEFAULT, 0); + + SendMessage(hwnd, SCI_SETFOLDMARGINCOLOUR, TRUE, clrBack); + SendMessage(hwnd, SCI_SETFOLDMARGINHICOLOUR, TRUE, clrBack); + + // Set marker color to the average of clrFore and clrBack + clrFore = (((clrFore & 0xFF0000) + (clrBack & 0xFF0000)) >> 1 & 0xFF0000) | + (((clrFore & 0x00FF00) + (clrBack & 0x00FF00)) >> 1 & 0x00FF00) | + (((clrFore & 0x0000FF) + (clrBack & 0x0000FF)) >> 1 & 0x0000FF); + + // Rounding hack for pure white against pure black + if (clrFore == 0x7F7F7F) clrFore = 0x808080; + + for (i = 0; i < COUNTOF(iMarkerIDs); ++i) + { + SendMessage(hwnd, SCI_MARKERSETBACK, iMarkerIDs[i], clrFore); + SendMessage(hwnd, SCI_MARKERSETFORE, iMarkerIDs[i], clrBack); + } + } // end set folding style if (SendMessage(hwnd,SCI_GETINDENTATIONGUIDES,0,0) != SC_IV_NONE) Style_SetIndentGuides(hwnd,TRUE); if (pLexNew->iLexer != SCLEX_NULL) { --- a\np2src\scintilla\src\LexCPP.cxx Wed Jun 10 07:06:42 2009 +++ b\np2src\scintilla\src\LexCPP.cxx Mon Jun 22 13:55:24 2009 @@ -418,22 +418,24 @@ static void FoldCppDoc(unsigned int star levelNext++; } else if (!IsStreamCommentStyle(styleNext) && (styleNext != SCE_C_COMMENTLINEDOC) && !atEOL) { // Comments don't end at end of line and the next character may be unstyled. levelNext--; } } + /* Disable explicit folding; it can often cause problems with non-aware code if (foldComment && (style == SCE_C_COMMENTLINE)) { if ((ch == '/') && (chNext == '/')) { char chNext2 = styler.SafeGetCharAt(i + 2); if (chNext2 == '{') { levelNext++; } else if (chNext2 == '}') { levelNext--; } } } + */ if (foldPreprocessor && (style == SCE_C_PREPROCESSOR)) { if (ch == '#') { unsigned int j = i + 1; while ((j < endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) { j++; } --- a\np2src\scintilla\src\LexSQL.cxx Sun Apr 12 01:59:50 2009 +++ b\np2src\scintilla\src\LexSQL.cxx Mon Jun 22 13:55:24 2009 @@ -255,24 +255,26 @@ static void FoldSQLDoc(unsigned int star levelNext++; } else if (!IsStreamCommentStyle(styleNext) && !atEOL) { // Comments don't end at end of line and the next character may be unstyled. levelNext--; } } + /* Disable explicit folding; it can often cause problems with non-aware code if (foldComment && (style == SCE_SQL_COMMENTLINE)) { // MySQL needs -- comments to be followed by space or control char if ((ch == '-') && (chNext == '-')) { char chNext2 = styler.SafeGetCharAt(i + 2); char chNext3 = styler.SafeGetCharAt(i + 3); if (chNext2 == '{' || chNext3 == '{') { levelNext++; } else if (chNext2 == '}' || chNext3 == '}') { levelNext--; } } } + */ if (style == SCE_SQL_OPERATOR) { if (ch == '(') { levelNext++; } else if (ch == ')') { levelNext--; }