TSE: Linux: Mouse: Implementation: Feature request

3 views
Skip to first unread message

knud van eeden

unread,
Oct 13, 2025, 7:07:26 AMOct 13
to SemWare TSE Pro Text Editor, S.E. Mitchell
Hello,

Using The Semware Editor Professional (=TSE) editor:

On a mouse totally 9 actions are possible
(=LeftBtn, CenterBtn, RightBtn, WheelUp, WheelDown, WheelLeft, WheelRight, XButton1, XButton2),

For each action 8 key combination possibilities are available
(=default, ALT, CTRL, SHIFT, CTRLALT, ALTSHIFT, CTRLSHIFT, CTRLALTSHIFT).

Thus totally 9 times 8 or thus 72 possibilities to assign your TSE functions to.

In Linux basically none of these 72 possibilities is out of the box possible currently (e.g. TSE for Linux version 4.50.13).

Next step: Create all the default escape codes for each of the below options in Linux Ubuntu.

<LeftBtn>
<Alt LeftBtn>
<Ctrl LeftBtn>
<Shift LeftBtn>
<CtrlAlt LeftBtn>
<AltShift LeftBtn>
<CtrlShift LeftBtn>
<CtrlAltShift LeftBtn>

<CenterBtn>
<Alt CenterBtn>
<Ctrl CenterBtn>
<Shift CenterBtn>
<CtrlAlt CenterBtn>
<AltShift CenterBtn>
<CtrlShift CenterBtn>
<CtrlAltShift CenterBtn>

<RightBtn>
<Alt RightBtn>
<Ctrl RightBtn>
<Shift RightBtn>
<CtrlAlt RightBtn>
<AltShift RightBtn>
<CtrlShift RightBtn>
<CtrlAltShift RightBtn>

<WheelUp>
<Alt WheelUp>
<Ctrl WheelUp>
<Shift WheelUp>
<CtrlAlt WheelUp>
<AltShift WheelUp>
<CtrlShift WheelUp>
<CtrlAltShift WheelUp>

<WheelDown>
<Alt WheelDown>
<Ctrl WheelDown>
<Shift WheelDown>
<CtrlAlt WheelDown>
<AltShift WheelDown>
<CtrlShift WheelDown>
<CtrlAltShift WheelDown>

<WheelLeft>
<Alt WheelLeft>
<Ctrl WheelLeft>
<Shift WheelLeft>
<CtrlAlt WheelLeft>
<AltShift WheelLeft>
<CtrlShift WheelLeft>
<CtrlAltShift WheelLeft>

<WheelRight>
<Alt WheelRight>
<Ctrl WheelRight>
<Shift WheelRight>
<CtrlAlt WheelRight>
<AltShift WheelRight>
<CtrlShift WheelRight>
<CtrlAltShift WheelRight>

<XButton1>
<Alt XButton1>
<Shift XButton1>
<Ctrl XButton1>
<CtrlAlt XButton1>
<AltShift XButton1>
<CtrlShift XButton1>
<CtrlAltShift XButton1>

<XButton2>
<Alt XButton2>
<Ctrl XButton2>
<CtrlAlt XButton2>
<Shift XButton2>
<AltShift XButton2>
<CtrlShift XButton2>
<CtrlAltShift XButton2>


===

Got it — here is a complete, Linux-terminal (xterm/gnome-terminal/etc.) “default” 
set you can use with TSE when you read SGR extended mouse reports (DECSET 1006). 

I will give you 

  (1) how to turn it on

  (2) the encoding rule, then 

  (3) every combo for the 72 cases you listed.

1) Enable SGR mouse (so terminals actually send these)

Send these to the terminal when TSE starts (and reset on exit):

ESC[?1002h   # button + drag tracking

ESC[?1006h   # SGR extended coordinates

…and to turn them off later:

ESC[?1002l

ESC[?1006l

These are standard xterm private modes for mouse reporting. (invisible-island.net)

2) How SGR mouse packets are encoded (one line cheat-sheet)

Every mouse event arrives as:

ESC [ < b ; x ; y M     # press/drag

ESC [ < b ; x ; y m     # release (buttons 1–3)
where:
  • b = Button base + Modifier bits

  • x; y = 1-based column,row

  • Here the Modifier bits are+4 for Shift, +8 for Alt (Meta), +16 for Ctrl

  • Here the Button bases:

    • Left=0, Middle=1, Right=2

    • WheelUp=64, WheelDown=65, WheelLeft=66, WheelRight=67
      (Wheel sends only the M “press” form; there is no release.) (shuntksh.com)

Tip: For buttons (Left/Middle/Right), use M on press and m on release to distinguish down/up. For the wheels, you will only ever see M. (invisible-island.net)

3) The full table (plug your current x;y into each)

Legend

SEQ(b) means the literal escape sequence:

ESC[<b;x;yM   # for press/drag
ESC[<b;x;ym   # for release (buttons only)

Left Button (base 0)

  • <LeftBtn>SEQ(0) / release SEQ(0)→m

  • <Alt LeftBtn>SEQ(8) / release →m

  • <Ctrl LeftBtn>SEQ(16) / release →m

  • <Shift LeftBtn>SEQ(4) / release →m

  • <CtrlAlt LeftBtn>SEQ(24) / release →m

  • <AltShift LeftBtn>SEQ(12) / release →m

  • <CtrlShift LeftBtn>SEQ(20) / release →m

  • <CtrlAltShift LeftBtn>SEQ(28) / release →m

Center/Middle Button (base 1)

  • <CenterBtn>SEQ(1) / release →m

  • <Alt CenterBtn>SEQ(9) / release →m

  • <Ctrl CenterBtn>SEQ(17) / release →m

  • <Shift CenterBtn>SEQ(5) / release →m

  • <CtrlAlt CenterBtn>SEQ(25) / release →m

  • <AltShift CenterBtn>SEQ(13) / release →m

  • <CtrlShift CenterBtn>SEQ(21) / release →m

  • <CtrlAltShift CenterBtn>SEQ(29) / release →m

Right Button (base 2)

  • <RightBtn>SEQ(2) / release →m

  • <Alt RightBtn>SEQ(10) / release →m

  • <Ctrl RightBtn>SEQ(18) / release →m

  • <Shift RightBtn>SEQ(6) / release →m

  • <CtrlAlt RightBtn>SEQ(26) / release →m

  • <AltShift RightBtn>SEQ(14) / release →m

  • <CtrlShift RightBtn>SEQ(22) / release →m

  • <CtrlAltShift RightBtn>SEQ(30) / release →m

Wheel Up (base 64) — press only

  • <WheelUp>SEQ(64)

  • <Alt WheelUp>SEQ(72)

  • <Ctrl WheelUp>SEQ(80)

  • <Shift WheelUp>SEQ(68)

  • <CtrlAlt WheelUp>SEQ(88)

  • <AltShift WheelUp>SEQ(76)

  • <CtrlShift WheelUp>SEQ(84)

  • <CtrlAltShift WheelUp>SEQ(92)

Wheel Down (base 65) — press only

  • <WheelDown>SEQ(65)

  • <Alt WheelDown>SEQ(73)

  • <Ctrl WheelDown>SEQ(81)

  • <Shift WheelDown>SEQ(69)

  • <CtrlAlt WheelDown>SEQ(89)

  • <AltShift WheelDown>SEQ(77)

  • <CtrlShift WheelDown>SEQ(85)

  • <CtrlAltShift WheelDown>SEQ(93)

Wheel Left (base 66) — press only

  • <WheelLeft>SEQ(66)

  • <Alt WheelLeft>SEQ(74)

  • <Ctrl WheelLeft>SEQ(82)

  • <Shift WheelLeft>SEQ(70)

  • <CtrlAlt WheelLeft>SEQ(90)

  • <AltShift WheelLeft>SEQ(78)

  • <CtrlShift WheelLeft>SEQ(86)

  • <CtrlAltShift WheelLeft>SEQ(94)

Wheel Right (base 67) — press only

  • <WheelRight>SEQ(67)

  • <Alt WheelRight>SEQ(75)

  • <Ctrl WheelRight>SEQ(83)

  • <Shift WheelRight>SEQ(71)

  • <CtrlAlt WheelRight>SEQ(91)

  • <AltShift WheelRight>SEQ(79)

  • <CtrlShift WheelRight>SEQ(87)

  • <CtrlAltShift WheelRight>SEQ(95)

XButton1 / XButton2 (side buttons)

These are not standardized in terminals: many common Linux terminals (xterm, GNOME Terminal, Xfce4-terminal, Alacritty, tmux panes, etc.) do not report buttons 8/9 via DECSET 1006 at all, or they repurpose them (e.g., as browser back/forward at the window manager level). In practice you usually will not receive SGR packets for them. A common workaround is to map XButton1/XButton2 at the OS/WM level to keystrokes (e.g., Alt+Left / Alt+Right) and catch those as normal key escapes in TSE. (Unix & Linux Stack Exchange)


Notes that help TSE interpret these cleanly

  • Release detection: Only buttons 1–3 (Left/Middle/Right) produce release packets (...m). Scroll wheels do not. (invisible-island.net)

  • Modifiers: The b field always adds +4 (Shift), +8 (Alt/Meta), +16 (Ctrl). If you enable xterm’s “special modifiers” off (ESC[?1035l), Alt tends to be reported as Meta rather than setting the high bit on keycodes—which is what you want for predictable Alt in terminals. (invisible-island.net)

  • Coordinates: x;y are 1-based cell positions (columns;rows). SGR works with big coordinates, unlike legacy X10/1000 mode. (invisible-island.net)

If you want, I can draft a tiny SAL helper that:

  1. enables ?1002h/?1006h on entry,

  2. reads ESC[<b;x;y(M|m) from the console,

  3. decodes b{button, modifiers, wheel}, and

  4. dispatches to your 72 handler procedures.

with friendly greetings
Knud van Eeden



knud van eeden

unread,
Oct 13, 2025, 9:19:34 AMOct 13
to SemWare TSE Pro Text Editor, S.E. Mitchell
FYIO:

Detection of those mouse keys as seen and working in TSE for Microsoft Windows:

Inline image


knud van eeden

unread,
Oct 13, 2025, 10:05:01 AMOct 13
to SemWare TSE Pro Text Editor, S.E. Mitchell
Hello,

A very fast track could be to :

 1. take all your C source code which in TSE for Microsoft Windows checks for the mouse keys.

 2. Inform the AI about the compiler manufacturer and the compiler version to use on Microsoft Windows.

 3. Then ask the AI to convert your X10 based C source code to the equivalent SGR based
C mouse key detection source code.

 4. That will then compiled and tested to work on Microsoft Windows first.

 5. If that works, then asking the AI to generate the equivalent Linux gcc source code to let it also
run and work on Linux non-WSL and Linux WSL.
Reply all
Reply to author
Forward
0 new messages