aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--doc/ScintillaDoc.html19
-rw-r--r--include/Scintilla.h4
-rw-r--r--include/Scintilla.iface12
-rw-r--r--src/Editor.cxx16
-rw-r--r--src/ViewStyle.cxx6
-rw-r--r--src/ViewStyle.h2
6 files changed, 58 insertions, 1 deletions
diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html
index c56669ba3..67524b6f8 100644
--- a/doc/ScintillaDoc.html
+++ b/doc/ScintillaDoc.html
@@ -1680,8 +1680,12 @@ struct TextToFind {
useWhitespaceForeColour, int colour)</a><br />
<a class="message" href="#SCI_SETWHITESPACEBACK">SCI_SETWHITESPACEBACK(bool
useWhitespaceBackColour, int colour)</a><br />
+ <a class="message" href="#SCI_SETEXTRAASCENT">SCI_SETEXTRAASCENT(int extraAscent)</a><br />
+ <a class="message" href="#SCI_GETEXTRAASCENT">SCI_GETEXTRAASCENT</a><br />
+ <a class="message" href="#SCI_SETEXTRADESCENT">SCI_SETEXTRADESCENT(int extraDescent)</a><br />
+ <a class="message" href="#SCI_GETEXTRADESCENT">SCI_GETEXTRADESCENT</a><br />
</code>
-
+
<p><b id="SCI_SETVIEWWS">SCI_SETVIEWWS(int wsMode)</b><br />
<b id="SCI_GETVIEWWS">SCI_GETVIEWWS</b><br />
White space can be made visible which may useful for languages in which white space is
@@ -1731,6 +1735,19 @@ struct TextToFind {
the lexer's colours with <code>SCI_SETWHITESPACEFORE</code> and
<code>SCI_SETWHITESPACEBACK</code>.</p>
+ <p>
+ <b id="SCI_SETEXTRAASCENT">SCI_SETEXTRAASCENT(int extraAscent)</b><br />
+ <b id="SCI_GETEXTRAASCENT">SCI_GETEXTRAASCENT</b><br />
+ <b id="SCI_SETEXTRADESCENT">SCI_SETEXTRADESCENT(int extraDescent)</b><br />
+ <b id="SCI_GETEXTRADESCENT">SCI_GETEXTRADESCENT</b><br />
+ Text is drawn with the base of each character on a 'baseline'. The height of a line is found from the maximum
+ that any style extends above the baseline (its 'ascent'), added to the maximum that any style extends below the
+ baseline (its 'descent').
+ Space may be added to the maximum ascent (<code>SCI_SETEXTRAASCENT</code>) and the
+ maximum descent (<code>SCI_SETEXTRADESCENT</code>) to allow for more space between lines.
+ This may done to make the text easier to read or to accomodate underlines or highlights.
+ <p>
+
<h2 id="Cursor">Cursor</h2>
<p><b id="SCI_SETCURSOR">SCI_SETCURSOR(int curType)</b><br />
diff --git a/include/Scintilla.h b/include/Scintilla.h
index fa28c1dbc..3edb6da41 100644
--- a/include/Scintilla.h
+++ b/include/Scintilla.h
@@ -673,6 +673,10 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_GETKEYSUNICODE 2522
#define SCI_INDICSETALPHA 2523
#define SCI_INDICGETALPHA 2524
+#define SCI_SETEXTRAASCENT 2525
+#define SCI_GETEXTRAASCENT 2526
+#define SCI_SETEXTRADESCENT 2527
+#define SCI_GETEXTRADESCENT 2528
#define SCI_STARTRECORD 3001
#define SCI_STOPRECORD 3002
#define SCI_SETLEXER 4001
diff --git a/include/Scintilla.iface b/include/Scintilla.iface
index f13c144a9..166d37d2a 100644
--- a/include/Scintilla.iface
+++ b/include/Scintilla.iface
@@ -1816,6 +1816,18 @@ set void IndicSetAlpha=2523(int indicator, int alpha)
# Get the alpha fill colour of the given indicator.
get int IndicGetAlpha=2524(int indicator,)
+# Set extra ascent for each line
+set void SetExtraAscent=2525(int extraAscent,)
+
+# Get extra ascent for each line
+get int GetExtraAscent=2526(,)
+
+# Set extra descent for each line
+set void SetExtraDescent=2527(int extraDescent,)
+
+# Get extra descent for each line
+get int GetExtraDescent=2528(,)
+
# Start notifying the container of all key presses and commands.
fun void StartRecord=3001(,)
diff --git a/src/Editor.cxx b/src/Editor.cxx
index c4c3a8179..0a619d9a6 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -7610,6 +7610,22 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
case SCI_GETCHARACTERPOINTER:
return reinterpret_cast<sptr_t>(pdoc->BufferPointer());
+ case SCI_SETEXTRAASCENT:
+ vs.extraAscent = wParam;
+ InvalidateStyleRedraw();
+ break;
+
+ case SCI_GETEXTRAASCENT:
+ return vs.extraAscent;
+
+ case SCI_SETEXTRADESCENT:
+ vs.extraDescent = wParam;
+ InvalidateStyleRedraw();
+ break;
+
+ case SCI_GETEXTRADESCENT:
+ return vs.extraDescent;
+
default:
return DefWndProc(iMessage, wParam, lParam);
}
diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx
index 811f79a6d..686862a2d 100644
--- a/src/ViewStyle.cxx
+++ b/src/ViewStyle.cxx
@@ -139,6 +139,8 @@ ViewStyle::ViewStyle(const ViewStyle &source) {
viewEOL = source.viewEOL;
showMarkedLines = source.showMarkedLines;
extraFontFlag = source.extraFontFlag;
+ extraAscent = source.extraAscent;
+ extraDescent = source.extraDescent;
}
ViewStyle::~ViewStyle() {
@@ -233,6 +235,8 @@ void ViewStyle::Init(size_t stylesSize_) {
viewEOL = false;
showMarkedLines = true;
extraFontFlag = false;
+ extraAscent = 0;
+ extraDescent = 0;
}
void ViewStyle::RefreshColourPalette(Palette &pal, bool want) {
@@ -284,6 +288,8 @@ void ViewStyle::Refresh(Surface &surface) {
someStylesProtected = true;
}
}
+ maxAscent += extraAscent;
+ maxDescent += extraDescent;
lineHeight = maxAscent + maxDescent;
aveCharWidth = styles[STYLE_DEFAULT].aveCharWidth;
diff --git a/src/ViewStyle.h b/src/ViewStyle.h
index 2f2d52461..3f8b856b9 100644
--- a/src/ViewStyle.h
+++ b/src/ViewStyle.h
@@ -102,6 +102,8 @@ public:
int caretWidth;
bool someStylesProtected;
bool extraFontFlag;
+ int extraAscent;
+ int extraDescent;
ViewStyle();
ViewStyle(const ViewStyle &source);