mapping delete key
Brian K. White
brian at aljex.com
Wed Feb 21 09:29:25 PST 2007
----- Original Message -----
From: "Richard D. Williams" <richard at appgrp.net>
To: <filepro-list at lists.celestial.com>
Sent: Wednesday, February 21, 2007 9:56 AM
Subject: mapping delete key
> Does anyone know how I can change the behavior of the delete key for a
> xterm emulation?
> This would be for filepro only.
>
> I would like to change my filepro termcap so the Delete key works the
> same as the scoansi Delete key instead of having to do a ctrl-c.
>
> I have tried doing stty intr "^?", but that just kills the ctrl-c totally.
>
> My scoansi and cansi work fine.
>
> Richard D. Williams
Basically it's wrong to want to do that.
If you want to use scoansi emulation, then use a scoansi terminal or
emulator.
xterm is an xterm terminal.
Where is there a scoansi terminal emulator that runs under X? I dunno.
I think there actually is a couple now, but none are especially handy. There
is putty for unix now, though binaries are scarce and compiling is not
straightforward. and some other gnome app I think I heard of but never saw.
I have also run all three of putty, anzio(lite & win), and facetwin in wine
on linux, but all of those are slow and cpu intensive and a bit buggy in
that context so thats not a real suggestion either.
It is actually possible to change the behaviour of xterm enough to make the
delete key possible. But this basically makes your xterm into neither a
scoansi terminal nor an xterm terminal. It's now a richard d williams
terminal for which there is no perfected termcap entry like there is for
xterm and scoansi, no perfected fp termcap entry, no perfected terminfo
entry, and any apps that incorrectly make assumptions about the way
terminals behave instead of looking strictly at termcap or terminfo, will
also get it wrong when it comes to this modified xterm. You can't really say
oh this is just for filepro either. before you get into filepro you are at
the shell.You never use vi or less or any other binary but
clerk/report/cabe/etc... ?
It's tricky and insidious because, so far, you just say the delete key, and
it's possible to do that. It's one little key whats the big deal? But the
problem is it's a deviation from a known and defined and described spec.
You'll still probably want to leave everything else the same, which means
you won't write new termcap and terminfo entries that are named "rdwterm"
instead of "xterm", and upload and install them on every remote box that you
might ever telnet or ssh to from your linux console X session, and so every
binary you run will think you are using an "xterm" and it will think it
knows how to correctly work with an "xterm" because it has a definition for
"xterm", except they're all a little wrong. That kind of thing is why some
places have 100 users all sufferring with screens that are basically broken
but not enough to actually stop work, like line-drawing characters that
don't draw correctly, colors that don't quite work right (like background
color not filling in all of the empty space on lines but only wherever the
cursor has actually travelled), break key that doesn't match the on screen
prompts (in your case filepro and every other app will still say "press
Ctrl-C" but really that will be wrong, unless you modify your fp termcap
entry so that the label says "Del" , but then _that_ is wrong for every
other "real" xterm that connects to that box. Conversely, anything that uses
the delete key as xterm uses it, to delete characters, will also not work.
And on top of those, now the backspace key doesn't work, because what you
want the delete key to do, the backspace key normally does, so after you
bugger things around to get the delete key to send a Ctrl-? and tell the
shell to treat Ctrl-? as a break key, now every time you press backspace it
breaks you out of programs instead of backspacing, so now you have to bugger
things even more to get _that_ working, and now your even further from the
defined xterm spec, yet you're still calling yourself "xterm"... If you hire
someone to log in and do some work for you, and xterm being the most common
and cross-platform terminal type these days, they have their anzio or putty
set to xterm, or they are connecting from their own real linux box, your fp
termcap will be wrong and they'll possibly waste time, which you are paying
a lot for, while they figure out why their terminal isn't working right
before they even think about doing anything else. Or you call
Anzio/backupedge/filepro/anyone tech support about something thaqt you don't
realize is related, even a teeny discrepency like that can sometimes be the
cause of a lot of wasted time on the phone just because it breaks an
assumption that everyone is _supposed_ to be able to make. I have seen just
that kind of thing, where several people wasted litterally days, all because
of just that sort of tiny disregard of "the rules".
Does this all sound kind of religeous? YES! And for good reason. That is the
only way to be about this. Define a spec, and then stick to it. Religeously.
Anything else, the slightest deviation, makes the whole point of
specifications and definitions useless. If you need somethiung the spec
doesn't cover or need to to work differently, define (or find) a bew spec
and use that. But do not say you are using one spec and then do something
that is only mostly similar to the spec.
If you could easily swap the position of the gas and brake pedals in your
car, do you think it would be sane to do so? Why not? You like it better
that way, You know how to drive your car. Whats the harm? That could
actually lead to loss of life, but a more analogouis comparison might be
rearranging all the buttons on your telephones. But then that will probably
never result in paid consultants or tech support (that _someone_ pays if not
you) spinning their wheels. Perverting a terminal out of spec falls in
between those extremes, closer to the telephone side admittedly.
All that said, the problem is 4 parts.
A break key can be any single byte, but must be a single byte.
xterm terminals happen to send a multi-byte sequence for the "delete" key.
And the byte you want for break, xterms happen to already use that for
backspace.
1) So part 1 is you have to tell xterm to send a single byte for the delete
key instead of the multi-byte escape sequence it normally sends. This is
possible a number of different ways.,
app-defaults for xterm, or for a specially named copy of xterm is probably
the least disruptive.
2) Then tell xterm to send some other character for backspace (Ctrl-H is the
usual choice)
3) Once at least "1" is done, then the stty command can be used to match it.
4) Once "2" is done another stty command can be used to match that.
1 & 2 can be done at once by:
vi, create a file, named, say, "xterm-scoansi.ad"
---snip---
! make xterm act like scoansi wrt bs & del & break
xterm*VT100.translations: \
<Key>BackSpace: string(0x08) \n\
<Key>Delete: string(0x7F)
---snip---
Now in an open xterm window run this:
xrdb -merge xterm-scoansi.ad
Next, in the same open xterm window
3 & 4 can be done at once with one stty command
stty intr '^?' ersae '^h'
This is untested. If it doesn't work, it's very close and is your best
starting point probably.
Don't for example look at xmodmap, since that will change the behaviour of
the keys in all x apps, like firefox etc... which will end up being a pain
in the neck.
But really, just use Ctrl-C or use a real scoansi emulator. Anything else is
basically not sane.
One of the biggest strengths of unix is how it's ultimately flexable down to
every line of code, and you _can_ do anything you can imagine, but breaking
standards too lightly is still shooting yourself in the foot.
Brian K. White -- brian at aljex.com -- http://www.aljex.com/bkw/
+++++[>+++[>+++++>+++++++<<-]<-]>>+.>.+++++.+++++++.-.[>+<---]>++.
filePro BBx Linux SCO FreeBSD #callahans Satriani Filk!
More information about the Filepro-list
mailing list