aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/fnkeys.tes
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2024-09-12 13:55:40 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2024-09-12 16:44:13 +0200
commitabb5d23eba21a2aafda0346c0c5dd845561b2aa2 (patch)
tree9e42c1e72e0d61c322c0af8d54a9d740a7e2e45c /lib/fnkeys.tes
parent73d574b71a10d4661ada20275cafde75aff6c1ba (diff)
downloadsciteco-abb5d23eba21a2aafda0346c0c5dd845561b2aa2.tar.gz
function key macros have been reworked into a more generic key macro feature
* ALL keypresses (the UTF-8 sequences resulting from key presses) can now be remapped. * This is especially useful with Unicode support, as you might want to alias international characters to their corresponding latin form in the start state, so you don't have to change keyboard layouts so often. This is done automatically in Gtk, where we have hardware key press information, but has to be done with key macros in Curses. There is a new key mask 4 (bit 3) for that purpose now. * Also, you might want to define non-ANSI letters to perform special functions in the start state where it won't be accepted by the parser anyway. Suppose you have a macro M→, you could define @^U[^K→]{m→} 1^_U[^K→] This effectively "extends" the parser and allow you to call macro "→" by a single key press. See also #5. * The register prefix has been changed from ^F (for function) to ^K (for key). This is the only thing you have to change in order to migrate existing function key macros. * Key macros are enabled by default. There is no longer any way to disable function key handling in curses, as I never found any reason or need to disable it. Theoretically, the default ESCDELAY could turn out to be too small and function keys don't get through. I doubt that's possible unless on extremely slow serial lines. Even then, you'd have to increase ESCDELAY and instead of disabling function keys simply define an escape surrogate. * The ED flag has been removed and its place is reserved for a future mouse support flag (which does make sense to disable in curses sometimes). fnkeys.tes is consequently also enabled by default in sample.teco_ini. * Key macros are handled as an unit. If one character results in an error, the entire string is rubbed out. This fixes the "CLOSE" key on Gtk. It also makes sure that the original error message is preserved and not overwritten by some subsequent syntax error. It was never useful that we kept inserting characters after the first error.
Diffstat (limited to 'lib/fnkeys.tes')
-rw-r--r--lib/fnkeys.tes59
1 files changed, 28 insertions, 31 deletions
diff --git a/lib/fnkeys.tes b/lib/fnkeys.tes
index 081e7d0..fd6b332 100644
--- a/lib/fnkeys.tes
+++ b/lib/fnkeys.tes
@@ -20,14 +20,14 @@
* Make DELETE an ESCAPE surrogate.
* Macro is enabled everywhere.
*!
-@[DC]{}
+@[ DC]{}
!*
* Make SHIFT+DELETE a rubout/re-insert key.
* This reverses the ^G modifier for BACKSPACE.
* The macro is enabled everywhere.
*!
-@[SDC]{}
+@[ SDC]{}
!*
* Command line editing macros.
@@ -41,16 +41,16 @@
Q.pESGETCOLUMN,4EJ
Q.p-.M#c
}
-@[HOME]{(M[HOME]}
-1U[HOME]
+@[ HOME]{(M[HOME]}
+1U[ HOME]
@[END]{
ESLINEFROMPOSITIONESGETLINEENDPOSITIONU.p
Q.pESGETCOLUMN,4EJ
Q.p:-.M#c
}
-@[END]{(M[END]}
-1U[END]
+@[ END]{(M[END]}
+1U[ END]
@[NPAGE]{
0,4EJ
@@ -58,72 +58,69 @@
ESPOSITIONFROMLINEU.p
Q.p"< Z | Q.p: '-.M#c
}
-@[NPAGE]{(M[NPAGE]}
-1U[NPAGE]
+@[ NPAGE]{(M[NPAGE]}
+1U[ NPAGE]
@[PPAGE]{
0,4EJ
ESLINEFROMPOSITION-(ESLINESONSCREEN)U.l
Q.l"< 0 | Q.lESPOSITIONFROMLINE: '-.M#c
}
-@[PPAGE]{(M[PPAGE]}
-1U[PPAGE]
+@[ PPAGE]{(M[PPAGE]}
+1U[ PPAGE]
@[LEFT]{
."=0|.-1'U.p
Q.pESGETCOLUMN,4EJ
Q.p-.M#c
}
-@[LEFT]{(M[LEFT]}
-1U[LEFT]
+@[ LEFT]{(M[LEFT]}
+1U[ LEFT]
@[SLEFT]{
0,0,ESWORDSTARTPOSITIONESWORDSTARTPOSITIONU.p
Q.pESGETCOLUMN,4EJ
Q.p:-.M#c
}
-@[SLEFT]{(M[SLEFT]}
-1U[SLEFT]
+@[ SLEFT]{(M[SLEFT]}
+1U[ SLEFT]
@[RIGHT]{
.-Z"=.|.+1'U.p
Q.pESGETCOLUMN,4EJ
Q.p-.M#c
}
-@[RIGHT]{(M[RIGHT]}
-1U[RIGHT]
+@[ RIGHT]{(M[RIGHT]}
+1U[ RIGHT]
@[SRIGHT]{
0,0,ESWORDENDPOSITIONESWORDENDPOSITIONU.p
Q.pESGETCOLUMN,4EJ
Q.p:-.M#c
}
-@[SRIGHT]{(M[SRIGHT]}
-1U[SRIGHT]
+@[ SRIGHT]{(M[SRIGHT]}
+1U[ SRIGHT]
@[UP]{
4EJ(ESLINEFROMPOSITION-1)ESFINDCOLUMN:-.M#c
}
-@[UP]{(M[UP]}
-1U[UP]
+@[ UP]{(M[UP]}
+1U[ UP]
@[DOWN]{
4EJ(ESLINEFROMPOSITION+1)ESFINDCOLUMN:-.M#c
}
-@[DOWN]{(M[DOWN]}
-1U[DOWN]
+@[ DOWN]{(M[DOWN]}
+1U[ DOWN]
-@[CLOSE]{(EX)}
-1U[CLOSE]
+@[ CLOSE]{(EX)}
+1U[ CLOSE]
!*
* Zoom with F9/F10 if function keys are enabled.
* This is automatically rubbed out.
*!
-@[F9]{(ESZOOMOUT{-13D}}
-1U[F9]
-@[F10]{(ESZOOMIN{-12D}}
-1U[F10]
-
-!* enable function key (macro) support *!
-0,64ED
+@[ F9]{(ESZOOMOUT{-13D}}
+1U[ F9]
+@[ F10]{(ESZOOMIN{-12D}}
+1U[ F10]