[scintilla] [patch] added SCI_SETTABDRAWMODE(SCTD_CONTROLCHAR)

60 views
Skip to first unread message

Robin Haberkorn

unread,
Feb 9, 2026, 11:31:52 AMFeb 9
to scintilla...@googlegroups.com
Dear hackers,

here's yet another patch which adds SCI_SETTABDRAWMODE(SCTD_CONTROLCHAR).
In this tab draw mode, tabs are handled like other control characters
and are rendered by their chracter representation.

It's again motivated by SciTECO's command line and syntax highlighting
needs where ASCII 9 is an actual insertion command instead of an
identation no-op.
Perhaps this is potentially useful for other languages as well where
tabs have special meaning beyond identation.

(And yes, it would also be useful for the "Scintilla - the hex editor"
use case, but that's not really doable due to the slow layout algorithm
on excessively long lines.)

Best regards,
Robin
0002-added-SCI_SETTABDRAWMODE-SCTD_CONTROLCHAR.patch
signature.asc

Neil Hodgson

unread,
Feb 9, 2026, 4:42:59 PMFeb 9
to scintilla...@googlegroups.com
Robin Haberkorn:

> here's yet another patch which adds SCI_SETTABDRAWMODE(SCTD_CONTROLCHAR).
> In this tab draw mode, tabs are handled like other control characters
> and are rendered by their chracter representation.

This doesn't reset layout so may show lengthy or truncated [HT].
https://www.scintilla.org/TabBlob.png

Neil

Robin Haberkorn

unread,
Feb 10, 2026, 10:38:36 AMFeb 10
to scintilla...@googlegroups.com
On Mon Feb 9, 2026 at 22:42:44 GMT +01, Neil Hodgson wrote:
> This doesn't reset layout so may show lengthy or truncated [HT].
> https://www.scintilla.org/TabBlob.png

Mhh, it doesn't behave like this on my system (obviously, else
the patch would be useless to me).
But I remember that a previous version of the patch did behave
very similarly.

I will try to reproduce this with a clean (otherwise unpatched)
Scintilla build with Bait.

Best regards,
Robin
signature.asc

Robin Haberkorn

unread,
Feb 14, 2026, 5:54:17 AMFeb 14
to scintilla...@googlegroups.com, Neil Hodgson
On Tue Feb 10, 2026 at 16:38:26 GMT +01, Robin Haberkorn wrote:
> I will try to reproduce this with a clean (otherwise unpatched)
> Scintilla build with Bait.
>

So here it is (see attachment). It is built against a Scintilla (GTK3) with
the patch applied cleanly on top of the tip commit.

I also attached a screenshot. That's how it is supposed to look like.

@Neil: What version did you test against?

Best regards,
Robin
bait-tab-ctrlcode.zip
screenshot-1771065851.png
signature.asc

Neil

unread,
Feb 18, 2026, 5:05:01 PMFeb 18
to scintilla-interest
Robin:
So here it is (see attachment). It is built against a Scintilla (GTK3) with
the patch applied cleanly on top of the tip commit.
...

@Neil: What version did you test against?

Tested against current repositories. I added code to set editor.TabDrawMode in a Lua script in SciTE to exercise this as can be seen in my screenshot.

The issue is that changing the property (`case Message::SetTabDrawMode:`) does not invalidate the layout so the cached positions are retained.

It needs to call something like `InvalidateStyleRedraw` when there is a real change to the tab draw mode. `SetAppearance` may be useful.

This invalidation wasn't needed before as LongArrow versus StrikeOut are just cosmetic modes with no position change.

Neil

Robin Haberkorn

unread,
Feb 25, 2026, 4:42:59 PMFeb 25
to scintilla...@googlegroups.com
On Wed Feb 18, 2026 at 23:05:01 GMT +01, Neil wrote:
> The issue is that changing the property (`case Message::SetTabDrawMode:`)
> does not invalidate the layout so the cached positions are retained.
>
> It needs to call something like `InvalidateStyleRedraw` when there is a
> real change to the tab draw mode. `SetAppearance` may be useful.
>
> This invalidation wasn't needed before as LongArrow versus StrikeOut are
> just cosmetic modes with no position change.
>

Here is a version that calls SetAppearance().
But honestly I couldn't provoke any issue with the first version
of the patch either. I modified bait.c to allow toggling through
the tab draw mode by pressing F1 (see attachment).

@Neil Did you test with a GTK build of SciTE?

Best regards,
Robin
v2-0001-added-SCI_SETTABDRAWMODE-SCTD_CONTROLCHAR.patch
bait.c
signature.asc

Neil Hodgson

unread,
Feb 27, 2026, 1:30:13 AMFeb 27
to scintilla...@googlegroups.com
Robin:

> @Neil Did you test with a GTK build of SciTE?

Originally used the Windows version of SciTE but it happens in GTK as
well. It depends on the caching level and I generally use
`cache.layout=2`.

Using the newer patch that calls `SetAppearance` fixes the problem.

Neil

Neil

unread,
Feb 27, 2026, 5:25:05 PMFeb 27
to scintilla-interest
Robin Haberkorn:
Here is a version that calls SetAppearance().
 

Robin Haberkorn

unread,
Feb 28, 2026, 1:53:38 PM (13 days ago) Feb 28
to scintilla...@googlegroups.com
On Fri Feb 27, 2026 at 07:29:59 GMT +01, Neil Hodgson wrote:
> Originally used the Windows version of SciTE but it happens in GTK as
> well. It depends on the caching level and I generally use
> `cache.layout=2`.
>
> Using the newer patch that calls `SetAppearance` fixes the problem.

Makes sense. Thanks for committing!
signature.asc
Reply all
Reply to author
Forward
0 new messages