
-----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/002901dbe6ac%2421863ad0%246492b070%24%40ecarlo.nl.



This is an extremely valuable and perfectly clear diagnosis! Thank you for performing those thorough tests and for confirming the exact behavior.
Your findings are absolutely consistent with a very well-known limitation of X10 (or "Normal") mouse reporting mode, which is what the Chr(27) + "[?1000h" escape sequence enables.
Here's a breakdown of what's happening based on your observations:
The "Magic Column 93/94":
The X10 mouse reporting protocol transmits coordinates by taking the X and Y values, adding 32 to them, and then sending those ASCII characters.
This protocol fundamentally limits coordinates to a range of 0-223 (because 223 + 32 = 255, which is the maximum value a single 8-bit ASCII character can represent).
Your observation that it stops working after column 93 (i.e., at column 94) indicates that in your specific terminal/WSL/TSE setup, the effective limit for mouse_x via this protocol is even lower than 223. It's likely related to how certain ASCII characters beyond a certain point (like 127 for extended ASCII, or perhaps a specific character like DEL for 127) are handled or how the terminal shifts to a different (and misinterpreted) reporting method.
The 4072 value you're seeing for Query(Key) (which then leads to mouse_x = 4040) is almost certainly the terminal trying to send a multi-byte escape sequence for coordinates exceeding its X10 single-byte limit, and TSE's Query(Key) is misinterpreting the first part of that sequence as a large, erroneous integer.
Impact on Vertical Scrollbar:
Since your vertical scrollbar is positioned at absolute column 134, and the mouse coordinate detection breaks down after column 93, any click on that scrollbar will register the 4072 (or 4040) error, effectively making the scrollbar functionality impossible with the current mouse reporting method.
Workaround Confirmed:
Your discovery that the vertical scrollbar works when the TSE window is narrowed to a total width of 93 columns or less is the definitive proof of this X10 protocol limitation in your environment. By keeping the mouse clicks within the reliable reporting range, the macro can then correctly interpret the coordinates.
Source of the Issue:
You are absolutely correct. The issue is not a bug in the LinuxMouse.sal SAL program itself. The SAL program's logic for parsing mouse events is standard for the X10 protocol.
The problem lies in how your specific combination of Microsoft Terminal / WSL2 / Ubuntu / TSE for Linux v4.50 handles mouse reporting via the X10 protocol when the X coordinate exceeds a certain value. It's an environmental constraint rather than a macro bug.
Conclusion and Path Forward:
Given this clear diagnosis, here are the implications and what you might consider:
The Current Macro (and X10 Protocol) Limitations: The LinuxMouse.sal program, using the [?1000h (X10) mouse tracking mode, will inherently be limited to window widths where mouse clicks do not exceed column 93 in your setup. For wider windows, the mouse coordinate detection for columns >= 94 will consistently fail.
The Workaround: The most direct solution for now, if you need the scrollbar functionality, is to keep your TSE window width to a maximum of 93 columns.
The Ideal (But Challenging) Solution - Modern Mouse Reporting:
The proper long-term solution for supporting wider windows is to use a more modern and robust mouse reporting protocol, specifically SGR (Selective Graphics Rendition) mouse tracking.
How SGR works: Instead of sending single characters, SGR sends human-readable escape sequences like ESC[<button>;<x>;<y>M. This format supports coordinates far beyond 223 (up to 65535).
Enabling SGR: You would change fWrite(_STDOUT_, Chr(27) + "[?1000h") to fWrite(_STDOUT_, Chr(27) + "[?1006h").
The SAL Challenge: The significant hurdle here is that your current SAL macro's after_getkey hook (which uses num_ignorable_keys and Query(Key) - 32) is designed specifically for the X10 protocol's fixed 3-part character sequence. Parsing the variable-length, comma-separated numeric strings of an SGR sequence using Query(Key) in SAL would be very difficult, and possibly impossible, given SAL's string manipulation and input parsing capabilities. You would essentially need a much more sophisticated "parser" in SAL.
Revisiting Query(MouseX) and Query(MouseY) (The Best Hope):
As discussed earlier, TSE itself (the core program) might have more sophisticated internal mouse handling, especially if it's a newer version (which 4.50rc24 implies).
Could you please explicitly test if Query(MouseX) and Query(MouseY) work reliably when you click beyond column 93?
If these functions do return correct coordinates (i.e., not 4072 and they change properly) when clicking in wider windows, then TSE's internal mouse decoding is working correctly, and your macro can simply use those values, bypassing the problematic Query(Key) - 32 logic entirely. This would be the "silver bullet" solution.
In summary, your LinuxMouse.sal macro is functionally sound for the protocol it targets, but that protocol (X10) is hitting its limits in your environment's display size. The true fix lies in either:
Using a narrower window (your current working workaround).
Having TSE itself provide reliable mouse coordinates via Query(MouseX)/Query(MouseY) (needs testing).
A more advanced (and likely very complex for SAL) parsing of a modern mouse protocol like SGR.
To view this discussion visit https://groups.google.com/d/msgid/semware/em23d3dd8a-d34f-41a1-b548-04db92324b3d%405596b8dc.com.
To view this discussion visit https://groups.google.com/d/msgid/semware/1937217384.1069761.1752413112168%40mail.yahoo.com.
--
---
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/001501dbf416%24193ede50%244bbc9af0%24%40ecarlo.nl.
-----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/001501dbf416%24193ede50%244bbc9af0%24%40ecarlo.nl.