On 27.09.17, Ryan Swan wrote:
I'm trying to either detect which mode I'm in, or have some keys to
switch the escape sequences sent for keyboard values. For example,
in Konsole term=LINUX, the ctrl+right key is Key_Ctrl_Right =
"\E[5C"; But in bash.exe, the Windows 10 Bash Subsystem
Key_Ctrl_Right = "\e[1;5C"; I'd like to have the same .jedrc file,
and either press a keystroke or ideally have this difference be
auto-detectable, and appropriately settable.
I tried this and it didn't work:
...
setkey ("keyboard1", "\eT");
setkey ("keyboard2", "\eY");
"setkey()" is used to bind a function/action to a character sequence in
the input stream. This is used to bind the same key sequence to mode
dependent actions (e.g. email mode vs. C mode).
What you seem to be interested in is to make Jed aware of the different
mappings of keypresses to key sequences.
For this, the keydefs.sl defines the "key string variables" like
Key_Ctrl_Right and tries to get this automatically correct for xjed vs. jed
on windows vs. the different terminal emulations.
The file x-keydefs.sl (http://jedmodes.sf.net/mode/x-keydefs) extends the
set of Key_* variables and sets them up for xjed.
In case the automatism fails, you can change the variable values in your
jed.rc file, e.g.
#ifdef IBMPC_SYSTEM
Key_Ctrl_Right = "\e[1;5B"
#endif
If you cannot find a way to auto-detect the environment, you can define
functions to change a set of Key_* variable values.
To find out the character sequence send by a key, you may use a function
similar to:
public define showkey_literal()
{
flush ("Press key:");
variable key = get_keystring();
if (prefix_argument(0))
insert (key);
else
{
#ifdef XWINDOWS
key += sprintf(" X-Keysym: 0x%04X", X_LAST_KEYSYM);
#endif
message ("Key sends " + key);
}
}
Günter
_______________________________________________
For list information, visit <http://jedsoft.org/jed/mailinglists.html>.