From 87fc359f42b57db2a9ee3d3211b3e9f2fbfe09c2 Mon Sep 17 00:00:00 2001 From: Neil Date: Mon, 21 Apr 2014 11:55:31 +1000 Subject: View line state in margin with SC_FOLDFLAG_LINESTATE as an aid to debugging. --- doc/ScintillaDoc.html | 10 +++++++++- doc/ScintillaHistory.html | 4 ++++ include/Scintilla.h | 1 + include/Scintilla.iface | 1 + src/Editor.cxx | 21 +++++++++++++-------- 5 files changed, 28 insertions(+), 9 deletions(-) diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index b8789801f..a97aa6858 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -82,7 +82,7 @@

Scintilla Documentation

-

Last edited 16 April 2014 NH

+

Last edited 21 April 2014 NH

There is an overview of the internal design of Scintilla.
@@ -5421,6 +5421,14 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ display hexadecimal fold levels in line margin to aid debugging of folding. The appearance of this feature may change in the future. + + + SC_FOLDFLAG_LINESTATE + 128 + + display hexadecimal line state in line margin to aid debugging of lexing and folding. + May not be used at the same time as SC_FOLDFLAG_LEVELNUMBERS. + diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index 0f0434da9..dc78adfd4 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -470,6 +470,10 @@ SC_MOD_INSERTCHECK.

  • + Line state may be displayed in the line number margin to aid in debugging lexing and folding with + SC_FOLDFLAG_LINESTATE (128). +
  • +
  • C++ lexer can highlight task marker keywords in comments as SCE_C_TASKMARKER.
  • diff --git a/include/Scintilla.h b/include/Scintilla.h index ea2c12bc1..f8744c1c0 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -462,6 +462,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SC_FOLDFLAG_LINEAFTER_EXPANDED 0x0008 #define SC_FOLDFLAG_LINEAFTER_CONTRACTED 0x0010 #define SC_FOLDFLAG_LEVELNUMBERS 0x0040 +#define SC_FOLDFLAG_LINESTATE 0x0080 #define SCI_SETFOLDFLAGS 2233 #define SCI_ENSUREVISIBLEENFORCEPOLICY 2234 #define SCI_SETTABINDENTS 2260 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index 78cec5731..276ba8dd7 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -1154,6 +1154,7 @@ val SC_FOLDFLAG_LINEBEFORE_CONTRACTED=0x0004 val SC_FOLDFLAG_LINEAFTER_EXPANDED=0x0008 val SC_FOLDFLAG_LINEAFTER_CONTRACTED=0x0010 val SC_FOLDFLAG_LEVELNUMBERS=0x0040 +val SC_FOLDFLAG_LINESTATE=0x0080 # Set some style options for folding. set void SetFoldFlags=2233(int flags,) diff --git a/src/Editor.cxx b/src/Editor.cxx index aaa440dce..d11de5e72 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -2048,14 +2048,19 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) { char number[100] = ""; if (lineDoc >= 0) sprintf(number, "%d", lineDoc + 1); - if (foldFlags & SC_FOLDFLAG_LEVELNUMBERS) { - int lev = pdoc->GetLevel(lineDoc); - sprintf(number, "%c%c %03X %03X", - (lev & SC_FOLDLEVELHEADERFLAG) ? 'H' : '_', - (lev & SC_FOLDLEVELWHITEFLAG) ? 'W' : '_', - lev & SC_FOLDLEVELNUMBERMASK, - lev >> 16 - ); + if (foldFlags & (SC_FOLDFLAG_LEVELNUMBERS | SC_FOLDFLAG_LINESTATE)) { + if (foldFlags & SC_FOLDFLAG_LEVELNUMBERS) { + int lev = pdoc->GetLevel(lineDoc); + sprintf(number, "%c%c %03X %03X", + (lev & SC_FOLDLEVELHEADERFLAG) ? 'H' : '_', + (lev & SC_FOLDLEVELWHITEFLAG) ? 'W' : '_', + lev & SC_FOLDLEVELNUMBERMASK, + lev >> 16 + ); + } else { + int state = pdoc->GetLineState(lineDoc); + sprintf(number, "%0X", state); + } } PRectangle rcNumber = rcMarker; // Right justify -- cgit v1.2.3