aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRobin Haberkorn <rhaberkorn@fmsbw.de>2025-11-02 23:50:08 +0100
committerRobin Haberkorn <rhaberkorn@fmsbw.de>2025-11-12 00:39:57 +0100
commitb64652b857d3a5922c72ccc801ac77aa9cff27c0 (patch)
tree7fa77ec1b0f259c0ea36ed2db46289adf1f213a6
parenta5b8fca36a7a050edfa1c4bb9e91f7722e12f3f6 (diff)
downloadscintilla-mirror-sciteco-rel-5-5-8.tar.gz
added SCI_SETTABDRAWMODE(SCTD_CONTROLCHAR)sciteco-rel-5-5-8
Allows rendering tabs (ASCII 9) with character representations like any other control character. This will not actually change the tab's indentation, so you may need to call SCI_SETTABWIDTH and SCI_SETTABMINIMUMWIDTH as well.
-rw-r--r--doc/ScintillaDoc.html10
-rw-r--r--include/Scintilla.h1
-rw-r--r--include/Scintilla.iface2
-rw-r--r--include/ScintillaTypes.h1
-rw-r--r--src/EditView.cxx10
5 files changed, 19 insertions, 5 deletions
diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html
index deae30251..3e8a15342 100644
--- a/doc/ScintillaDoc.html
+++ b/doc/ScintillaDoc.html
@@ -2884,6 +2884,16 @@ struct Sci_TextToFindFull {
<td>A horizontal line stretching until the tabstop.</td>
</tr>
+
+ <tr>
+ <th align="left"><code>SCTD_CONTROLCHAR</code></th>
+
+ <td>2</td>
+
+ <td>Will be drawn as a control code according to the configured
+ <a href="#CharacterRepresentations">character representation</a>
+ without any indentation.</td>
+ </tr>
</tbody>
</table>
diff --git a/include/Scintilla.h b/include/Scintilla.h
index 115003c1b..f4c237316 100644
--- a/include/Scintilla.h
+++ b/include/Scintilla.h
@@ -78,6 +78,7 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP
#define SCI_SETVIEWWS 2021
#define SCTD_LONGARROW 0
#define SCTD_STRIKEOUT 1
+#define SCTD_CONTROLCHAR 2
#define SCI_GETTABDRAWMODE 2698
#define SCI_SETTABDRAWMODE 2699
#define SCI_POSITIONFROMPOINT 2022
diff --git a/include/Scintilla.iface b/include/Scintilla.iface
index 3e0bbd147..0c83e3fac 100644
--- a/include/Scintilla.iface
+++ b/include/Scintilla.iface
@@ -196,9 +196,11 @@ set void SetViewWS=2021(WhiteSpace viewWS,)
enu TabDrawMode=SCTD_
val SCTD_LONGARROW=0
val SCTD_STRIKEOUT=1
+val SCTD_CONTROLCHAR=2
ali SCTD_LONGARROW=LONG_ARROW
ali SCTD_STRIKEOUT=STRIKE_OUT
+ali SCTD_CONTROLCHAR=CONTROL_CHAR
# Retrieve the current tab draw mode.
# Returns one of SCTD_* constants.
diff --git a/include/ScintillaTypes.h b/include/ScintillaTypes.h
index 411876f97..6e5983aa2 100644
--- a/include/ScintillaTypes.h
+++ b/include/ScintillaTypes.h
@@ -26,6 +26,7 @@ enum class WhiteSpace {
enum class TabDrawMode {
LongArrow = 0,
StrikeOut = 1,
+ ControlChar = 2,
};
enum class EndOfLine {
diff --git a/src/EditView.cxx b/src/EditView.cxx
index 3bf0a1fbb..0dfc0cc97 100644
--- a/src/EditView.cxx
+++ b/src/EditView.cxx
@@ -353,7 +353,7 @@ void LayoutSegments(IPositionCache *pCache,
XYPOSITION representationWidth = 0.0;
// Tab is a special case of representation, taking a variable amount of space
// which will be filled in later.
- if (ll->chars[ts.start] != '\t') {
+ if (ll->chars[ts.start] != '\t' || vstyle.tabDrawMode == TabDrawMode::ControlChar) {
representationWidth = vstyle.controlCharWidth;
if (representationWidth <= 0.0) {
assert(ts.representation->stringRep.length() <= Representation::maxLength);
@@ -526,7 +526,7 @@ void EditView::LayoutLine(const EditModel &model, Surface *surface, const ViewSt
for (const TextSegment &ts : segments) {
if (vstyle.styles[ll->styles[ts.start]].visible &&
ts.representation &&
- (ll->chars[ts.start] == '\t')) {
+ ll->chars[ts.start] == '\t' && vstyle.tabDrawMode != TabDrawMode::ControlChar) {
// Simple visible tab, go to next tab stop
const XYPOSITION startTab = ll->positions[ts.start];
const XYPOSITION nextTab = NextTabstopPos(line, startTab, vstyle.tabWidth);
@@ -614,7 +614,7 @@ void EditView::UpdateBidiData(const EditModel &model, const ViewStyle &vstyle, L
const Representation *repr = model.reprs->RepresentationFromCharacter(std::string_view(&ll->chars[charsInLine], charWidth));
ll->bidiData->widthReprs[charsInLine] = 0.0f;
- if (repr && ll->chars[charsInLine] != '\t') {
+ if (repr && (ll->chars[charsInLine] != '\t' || vstyle.tabDrawMode == TabDrawMode::ControlChar)) {
ll->bidiData->widthReprs[charsInLine] = ll->positions[charsInLine + charWidth] - ll->positions[charsInLine];
}
if (charWidth > 1) {
@@ -1690,7 +1690,7 @@ void DrawBackground(Surface *surface, const EditModel &model, const ViewStyle &v
ColourRGBA textBack = TextBackground(model, vsDraw, ll, background, inSelection,
inHotspot, ll->styles[i], i);
if (ts.representation) {
- if (ll->chars[i] == '\t') {
+ if (ll->chars[i] == '\t' && vsDraw.tabDrawMode != TabDrawMode::ControlChar) {
// Tab display
if (drawWhitespaceBackground && vsDraw.WhiteSpaceVisible(inIndentation)) {
textBack = vsDraw.ElementColourForced(Element::WhiteSpaceBack).Opaque();
@@ -2197,7 +2197,7 @@ void EditView::DrawForeground(Surface *surface, const EditModel &model, const Vi
}
ColourRGBA textBack = TextBackground(model, vsDraw, ll, background, inSelection, inHotspot, styleMain, i);
if (ts.representation) {
- if (ll->chars[i] == '\t') {
+ if (ll->chars[i] == '\t' && vsDraw.tabDrawMode != TabDrawMode::ControlChar) {
// Tab display
if (phasesDraw == PhasesDraw::One) {
if (drawWhitespaceBackground && vsDraw.WhiteSpaceVisible(inIndentation))