diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2025-02-02 13:17:51 +0300 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2025-02-16 02:20:39 +0300 |
commit | b87c56799ab6f6d651e1dc6c712a625545a4ad5f (patch) | |
tree | 726a36ede8cf7a9d310c4299f5fadef6398dcda0 /lib | |
parent | 6c500d60eb7df65b0c71e9b0e0955ff581fc3f5a (diff) | |
download | sciteco-b87c56799ab6f6d651e1dc6c712a625545a4ad5f.tar.gz |
implemented mouse support via special ^KMOUSE and <EJ> with negative keys
* You need to set 0,64ED to enable mouse processing in Curses.
It is always enabled in Gtk as it should never make the experience worse.
sample.teco_ini enables mouse support, since this should be the new default.
`sciteco --no-profile` won't have it enabled, though.
* On curses, it requires the ncurses mouse protocol version 2, which will
also be supported by PDCurses.
* Similar to the Curses API, a special key macro ^KMOUSE is inserted if any of the supported
mouse events has been detected.
* You can then use -EJ to get the type of mouse event, which can be used
with a computed goto in the command-line editing macro.
Alternatively, this could have been solved with separate ^KMOUSE:PRESSED,
^KMOUSE:RELEASED etc. pseudo-key macros.
* The default ^KMOUSE implementation in fnkeys.tes supports the following:
* Left click: Edit command line to jump to position.
* Ctrl+left click: Jump to beginning of line.
* Right click: Insert position or position range (when dragging).
* Double right click: insert range for word under cursor
* Ctrl+right click: Insert beginning of line
* Scroll wheel: scrolls (faster with shift)
* Ctrl+scroll wheel: zoom (GTK-only)
* Currently, there is no visual feedback when "selecting" ranges
via right-click+drag.
This would be tricky to do and most terminal emulators do not appear
to support continuous mouse updates.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/fnkeys.tes | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/lib/fnkeys.tes b/lib/fnkeys.tes index ab78025..857c249 100644 --- a/lib/fnkeys.tes +++ b/lib/fnkeys.tes @@ -124,3 +124,71 @@ 1U[F9] @[F10]{(ESZOOMIN{-12D}} 1U[F10] + +!* + * Mouse integration. + * Might be disabled unless bit 7 (64) is enabled in ED. + * + * Left click: Edit command line to jump to position. + * Ctrl+left click: Jump to beginning of line. + * Right click: Insert position or position range (when dragging). + * Double right click: insert range for word under cursor + * Ctrl+right click: Insertion beginning of line + * Scroll wheel: scrolls (faster with shift) + * Ctrl+scroll wheel: zoom (GTK-only) + *! +@[MOUSE]{ + -2EJESCHARPOSITIONFROMPOINTU.p + -4EJ&2"N Q.pESLINEFROMPOSITIONESPOSITIONFROMLINEU.p ' + 1,Q.pESWORDSTARTPOSITION:U.#ws + 1,Q.pESWORDENDPOSITION:U.#we + Q.p:U.p + + -EJOpressed,released,scrollup,scrolldown + !pressed! + !* left click *! + -3EJ-1"= Q.p-.M#c !* not reached *! ' + { -9D + !* right click *! + -3EJ-3"= Q.p"U I(\.p ' ' + !* middle click *! + -3EJ-2"= :Q~"U I(g~) ' ' + } + !released! + { -9D + -3EJ-3"= Q.p"U + !* right click *! + <-A-("=1;'R> \U.o + Q.o-Q.p"= + .-1"> -2A-)"= + R <-A-("=1;'R> + \-Q.p"= + !* double right-click *! + .,ZD I\.#ws,\.#we + ' + ' ' + ZJ I) + | + Q.o-Q.p"> Q.o,Q.p U.oU.p ' + !* right drag *! + .,ZD I\.o,\.p) + ' + ' ' + } + !scrollup! + -4EJ&2"= + -4EJ&1"=-1|-2',0ESLINESCROLL + | + ESZOOMIN + ' + {-9D} + !scrolldown! + -4EJ&2"= + -4EJ&1"=1|2',0ESLINESCROLL + | + ESZOOMOUT + ' + {-9D} +} +@[MOUSE]{(M[MOUSE]} +1U[MOUSE] |