SetColorTableValue bug from _AFTER_UPDATE_DISPLAY_ hook

32 views
Skip to first unread message

Carlo Hogeveen

unread,
Aug 5, 2025, 7:30:37 AMAug 5
to Semware @ GoogleGroups

This is about a bug in TSE's macro language.
It started with me wanting to redisplay sections of text in the edit window in unique colors.
Temporarily setting a unique color is done with the SetColorTableValue() command in GUI and Linux TSE.
If done from the _AFTER_COMMAND_ hook it works, but sometimes gets overwritten by TSE itself.
If done from the _IDLE_ hook it works, but with a delay waiting for the editor to get idle.
If done from the _AFTER_UPDATE_DISPLAY_ hook, it (re)displays text immediately without getting overwritten, but in TSE's old colors!
The latter seems a bug to me.
Why would SetColorTableValue() not work when called from _AFTER_UPDATE_DISPLAY_?
I created a test macro that reproduces the bug:
https://ecarlo.nl/tse/DemosAndTests.html#Test_ColorTableValue_AFTER_UPDATE_DISPLAY

Carlo



zhong zhao

unread,
Aug 5, 2025, 9:06:08 PMAug 5
to SemWare TSE Pro text editor
Test_ColorTableValue_AFTER_UPDATE_DISPLAY.s

Carlo Hogeveen

unread,
Aug 6, 2025, 5:27:43 AMAug 6
to sem...@googlegroups.com

Hi Zhong Zhao,

My test macro showed two correct lines generated from the _AFTER_COMMAND_ hook, and two incorrect lines generated from the_AFTER_UPDATE_DISPLAY_ hook.

The correct lines show the example, that SetColorTableValue() can generate a large range of dark blue to light blue background colors.

The incorrect lines show the same blue background color throughout the whole line, meaning that SetColorTableValue() did not do what it was asked to do.

Your reply sent my macro back with commented-out code, so that it no longer generates the two correct lines.
I do not understand the meaning of your reply.

Context:
GUI and Linux TSE can show text using at most 16 foreground (letter) colors and 16 background colors concurrently.
A macro that uses SetColorTableValue() from a hook can augment that to 16,777,216 colors each concurrently.
But apparently not if SetColorTableValue() is used from the _AFTER_UPDATE_DISPLAY_ hook.

Carlo



S.E. Mitchell

unread,
Aug 6, 2025, 6:51:24 AMAug 6
to sem...@googlegroups.com
FYI - I am looking into this.
Initial investigation, I could not find anywhere else the internal
tables (that hold the color values) are set except via
SetColorTableValue().
It may have something to do with the double buffering.
And, no refresh flags are set when SetColorTableValue() is called.
Anyway, I will continue to look.
> --
>
> ---
> You received this message because you are subscribed to the Google Groups "SemWare TSE Pro text editor" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to semware+u...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/semware/000e01dc05fc%245b2f8290%24118e87b0%24%40ecarlo.nl.

Carlo Hogeveen

unread,
Aug 6, 2025, 10:53:04 AMAug 6
to sem...@googlegroups.com

Just some additional test info:

I added the bug test also to a _POST_UPDATE_ALL_WINDOWS_ hook: no bug.
https://ecarlo.nl/tse/DemosAndTests.html#Test_ColorTableValue_AFTER_UPDATE_DISPLAY

So SetColorTableValue () works when called from the _IDLE_, AFTER_COMMAND_, and _POST_UPDATE_ALL_WINDOWS_ hooks, but is somehow disabled when called from the _AFTER_UPDATE_DISPLAY_ hook.

Sammy wrote:
> And, no refresh flags are set when SetColorTableValue() is called.

I should hope not. (From my outside point of view.)
That is what enables SetColorTableValue() and PutStrAttrXy() to display 16,777,216 colors concurrently.

Carlo



Carlo Hogeveen

unread,
Aug 7, 2025, 4:36:42 AMAug 7
to sem...@googlegroups.com

Sammy,

I noticed a correlation that does not point to a logical cause, but maybe it points to something related that could help or trigger finding the cause.

The _AFTER_UPDATE_DISPLAY_ hook, which is the only tested hook from which SetColorTableValue() does not work, is also the only tested hook that has the editing window as its video output window.
The other three tested hooks have the whole TSE screen as their video output window.
Maybe there is something in preparing and limiting the video output window that inadvertently also disables SetColorTableValue()?

Straying from the main topic to a related one:
Trying out work-arounds I also tried the HookDisplay() command.
There I was stopped even earlier by the GetStrAttrXY() command not working from its hooks.
This is another case of a TSE command not working from a hook, seemingly for no logical reason.

Hoping these observations help somehow,
Carlo



Carlo Hogeveen

unread,
Aug 7, 2025, 5:38:30 AMAug 7
to sem...@googlegroups.com

Oops:

> Trying out work-arounds I also tried the HookDisplay() command.
> There I was stopped even earlier by the GetStrAttrXY() command not working from its hooks.

This morning I redid the test that led me to that conclusion, and GetStrAttrXY() functioned perfectly.

I did get an interesting SetColorTableValue() result from HookDisplay()'s first hook:
Independent of doing SetCollorTableValue() statements before and between PutStrAttrXY() statements, all PutStrAttrXY() statements in the hook use the last SetCollorTableValue() statement, even if it is placed after all PutStrAttrXY() statements.

I went back to the _AFTER_UPDATE_DISPLAY_ test to see if something similar happens there, but no, the _AFTER_UPDATE_DISPLAY_ hook completely ignores SetCollorTableValue().

Carlo



Carlo Hogeveen

unread,
Aug 7, 2025, 7:01:05 AMAug 7
to sem...@googlegroups.com

Excuse my rambling on, but I am trying to make sense of what is happening, and I came up with a 3-part hypothesis:

1.
The video output window has its own buffering, which does not provide for multiple SetColorTableValue() values.

2.
The _AFTER_UPDATE_DISPLAY_ hook and HookDisplay() hooks use video output buffering per the whole hook, and therefore do not support multiple SetColorTableValue() values.

3.
The _IDLE_, _AFTER_COMMAND_ and _POST_UPDATE_ALL_WINDOWS_ hooks do not use video output buffering for the whole hook, or at all, and are therefore not limited to one SetColorTableValue() value per hook.

Carlo



Reply all
Reply to author
Forward
0 new messages