diff options
| author | Robin Haberkorn <rhaberkorn@fmsbw.de> | 2026-02-26 10:38:16 +1100 |
|---|---|---|
| committer | Robin Haberkorn <rhaberkorn@fmsbw.de> | 2026-02-26 10:38:16 +1100 |
| commit | 7621fda67d13735836c6f050d1eec8c691a68292 (patch) | |
| tree | 34eab20f7d23cb50cdb5bf0c973cdd955c67565b /src | |
| parent | be966e893a6453f1f94bf13def75ef14b1a7a4b4 (diff) | |
| download | scintilla-mirror-master.tar.gz | |
Add SCI_SETTABDRAWMODE(SCTD_CONTROLCHAR).master
Allows rendering tabs (ASCII 9) with character representations like any other
control character.
Diffstat (limited to 'src')
| -rw-r--r-- | src/EditView.cxx | 10 | ||||
| -rw-r--r-- | src/Editor.cxx | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/EditView.cxx b/src/EditView.cxx index 2608f11e5..bec07fe95 100644 --- a/src/EditView.cxx +++ b/src/EditView.cxx @@ -352,7 +352,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); @@ -522,7 +522,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); @@ -610,7 +610,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) { @@ -1673,7 +1673,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(); @@ -2178,7 +2178,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)) diff --git a/src/Editor.cxx b/src/Editor.cxx index 5b42407e3..0289fa5e5 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -6984,7 +6984,7 @@ sptr_t Editor::WndProc(Message iMessage, uptr_t wParam, sptr_t lParam) { return static_cast<sptr_t>(vs.tabDrawMode); case Message::SetTabDrawMode: - vs.tabDrawMode = static_cast<TabDrawMode>(wParam); + SetAppearance(vs.tabDrawMode, static_cast<TabDrawMode>(wParam)); Redraw(); break; |
